Search
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
LTTng-UST
All Projects
LTTng
»
LTTng-UST
Overview
Activity
Roadmap
Issues
Gantt
Calendar
News
Repository
Download (1.05 KB)
Bug #1171
ยป lttng_ust_elf_test.c
Stefan Palade
, 11/14/2018 01:35 PM
#include
<stdlib.h>
#include
<stdio.h>
#include
<dlfcn.h>
#include
<unistd.h>
#define LLTNG_UST_LIB "/usr/lib64/liblttng-ust.so.0"
int
main
(
int
argc
,
char
**
argv
)
{
int
ret
;
char
exe
[
1024
];
void
*
handle
;
ret
=
readlink
(
"/proc/self/exe"
,
exe
,
sizeof
(
exe
)
-
1
);
if
(
ret
==
-
1
)
{
fprintf
(
stderr
,
"ERROR readlink
\n
"
);
exit
(
1
);
}
exe
[
ret
]
=
0
;
fprintf
(
stderr
,
"Delete %s
\n
"
,
exe
);
ret
=
remove
(
exe
);
if
(
ret
==
-
1
)
{
fprintf
(
stderr
,
"ERROR remove"
);
exit
(
1
);
}
ret
=
readlink
(
"/proc/self/exe"
,
exe
,
sizeof
(
exe
)
-
1
);
if
(
ret
==
-
1
)
{
fprintf
(
stderr
,
"ERROR readlink
\n
"
);
exit
(
1
);
}
exe
[
ret
]
=
0
;
fprintf
(
stderr
,
"New /proc/self/exe link:
\"
%s
\"\n
"
,
exe
);
fprintf
(
stderr
,
"Loading %s
\n
"
,
LLTNG_UST_LIB
);
handle
=
dlopen
(
LLTNG_UST_LIB
,
RTLD_LAZY
);
if
(
!
handle
)
{
fprintf
(
stderr
,
"ERROR dlopen: %s
\n
"
,
dlerror
());
exit
(
1
);
}
fprintf
(
stderr
,
"lttng-ust loaded
\n
"
);
dlclose
(
handle
);
fprintf
(
stderr
,
"lttng-ust unloaded
\n
"
);
}
(1-1/1)
Loading...