gprofng: fix -std=gnu23 compatibility wrt unprototyped functions

C23 removes support for unprototyped functions. Fix function pointer types
accordingly.

This does not fix all instances, there's a few left as I commented on in
PR32374 (e.g. setitimer which I have a local workaround for but it involves
a glibc implementation detail; the Linaro precommit CI tester pointed that
out too, so dropped that).

ChangeLog:
	PR gprofng/32374

	* libcollector/collector.c (collector_sample): Fix prototype.
	* libcollector/envmgmt.c (putenv): Ditto.
	(_putenv): Ditto.
	(__collector_putenv): Ditto.
	(setenv): Ditto.
	(_setenv): Ditto.
	(__collector_setenv): Ditto.
	(unsetenv): Ditto.
	(_unsetenv): Ditto.
	(__collector_unsetenv): Ditto.
	* libcollector/jprofile.c (open_experiment): Ditto.
	(__collector_jprofile_enable_synctrace): Ditto.
	(jprof_find_asyncgetcalltrace): Ditto.
	* libcollector/libcol_util.c (__collector_util_init): Ditto.
	(ARCH): Ditto.
	* libcollector/mmaptrace.c (collector_func_load): Ditto.
	(collector_func_unload): Ditto.
	* libcollector/unwind.c (__collector_ext_unwind_init): Ditto.
	* src/collector_module.h: Ditto.
This commit is contained in:
Sam James 2024-11-16 05:13:48 +00:00
parent bf447eec6d
commit a2f774427e
No known key found for this signature in database
GPG Key ID: 738409F520DF9190
8 changed files with 64 additions and 65 deletions

View File

@ -1578,7 +1578,7 @@ __collector_resume_experiment ()
} }
/* Code to support Samples and Pause/Resume */ /* Code to support Samples and Pause/Resume */
void collector_sample () __attribute__ ((weak, alias ("__collector_sample"))); void collector_sample (char *name) __attribute__ ((weak, alias ("__collector_sample")));
void void
__collector_sample (char *name) __collector_sample (char *name)
{ {

View File

@ -1281,4 +1281,3 @@ __collector_ext_clone_pthread (int (*fn)(void *), void *child_stack, int flags,
int sigprocmask (int, const sigset_t*, sigset_t*) __attribute__ ((weak, alias ("__collector_sigprocmask"))); int sigprocmask (int, const sigset_t*, sigset_t*) __attribute__ ((weak, alias ("__collector_sigprocmask")));
int thr_sigsetmask (int, const sigset_t*, sigset_t*) __attribute__ ((weak, alias ("__collector_thr_sigsetmask"))); int thr_sigsetmask (int, const sigset_t*, sigset_t*) __attribute__ ((weak, alias ("__collector_thr_sigsetmask")));
int setitimer () __attribute__ ((weak, alias ("_setitimer"))); int setitimer () __attribute__ ((weak, alias ("_setitimer")));

View File

@ -685,8 +685,8 @@ __collector_env_update (char *envp[])
/*------------------------------------------------------------- putenv */ /*------------------------------------------------------------- putenv */
int putenv () __attribute__ ((weak, alias ("__collector_putenv"))); int putenv (char*) __attribute__ ((weak, alias ("__collector_putenv")));
int _putenv () __attribute__ ((weak, alias ("__collector_putenv"))); int _putenv (char*) __attribute__ ((weak, alias ("__collector_putenv")));
int int
__collector_putenv (char * string) __collector_putenv (char * string)
@ -694,9 +694,9 @@ __collector_putenv (char * string)
if (CALL_UTIL (putenv) == __collector_putenv || if (CALL_UTIL (putenv) == __collector_putenv ||
CALL_UTIL (putenv) == NULL) CALL_UTIL (putenv) == NULL)
{ // __collector_libc_funcs_init failed { // __collector_libc_funcs_init failed
CALL_UTIL (putenv) = (int(*)())dlsym (RTLD_NEXT, "putenv"); CALL_UTIL (putenv) = (int(*)(char*))dlsym (RTLD_NEXT, "putenv");
if (CALL_UTIL (putenv) == NULL || CALL_UTIL (putenv) == __collector_putenv) if (CALL_UTIL (putenv) == NULL || CALL_UTIL (putenv) == __collector_putenv)
CALL_UTIL (putenv) = (int(*)())dlsym (RTLD_DEFAULT, "putenv"); CALL_UTIL (putenv) = (int(*)(char*))dlsym (RTLD_DEFAULT, "putenv");
if (CALL_UTIL (putenv) == NULL || CALL_UTIL (putenv) == __collector_putenv) if (CALL_UTIL (putenv) == NULL || CALL_UTIL (putenv) == __collector_putenv)
{ {
TprintfT (DBG_LT2, "__collector_putenv(): ERROR: no pointer found.\n"); TprintfT (DBG_LT2, "__collector_putenv(): ERROR: no pointer found.\n");
@ -712,8 +712,8 @@ __collector_putenv (char * string)
} }
/*------------------------------------------------------------- setenv */ /*------------------------------------------------------------- setenv */
int setenv () __attribute__ ((weak, alias ("__collector_setenv"))); int setenv (const char*, const char*, int) __attribute__ ((weak, alias ("__collector_setenv")));
int _setenv () __attribute__ ((weak, alias ("__collector_setenv"))); int _setenv (const char*, const char*, int) __attribute__ ((weak, alias ("__collector_setenv")));
int int
__collector_setenv (const char *name, const char *value, int overwrite) __collector_setenv (const char *name, const char *value, int overwrite)
@ -721,9 +721,9 @@ __collector_setenv (const char *name, const char *value, int overwrite)
if (CALL_UTIL (setenv) == __collector_setenv || if (CALL_UTIL (setenv) == __collector_setenv ||
CALL_UTIL (setenv) == NULL) CALL_UTIL (setenv) == NULL)
{ // __collector_libc_funcs_init failed { // __collector_libc_funcs_init failed
CALL_UTIL (setenv) = (int(*)())dlsym (RTLD_NEXT, "setenv"); CALL_UTIL (setenv) = (int(*)(const char*, const char*, int))dlsym (RTLD_NEXT, "setenv");
if (CALL_UTIL (setenv) == NULL || CALL_UTIL (setenv) == __collector_setenv) if (CALL_UTIL (setenv) == NULL || CALL_UTIL (setenv) == __collector_setenv)
CALL_UTIL (setenv) = (int(*)())dlsym (RTLD_DEFAULT, "setenv"); CALL_UTIL (setenv) = (int(*)(const char*, const char*, int))dlsym (RTLD_DEFAULT, "setenv");
if (CALL_UTIL (setenv) == NULL || CALL_UTIL (setenv) == __collector_setenv) if (CALL_UTIL (setenv) == NULL || CALL_UTIL (setenv) == __collector_setenv)
{ {
TprintfT (DBG_LT2, "__collector_setenv(): ERROR: no pointer found.\n"); TprintfT (DBG_LT2, "__collector_setenv(): ERROR: no pointer found.\n");
@ -758,8 +758,8 @@ __collector_setenv (const char *name, const char *value, int overwrite)
} }
/*------------------------------------------------------------- unsetenv */ /*------------------------------------------------------------- unsetenv */
int unsetenv () __attribute__ ((weak, alias ("__collector_unsetenv"))); int unsetenv (const char*) __attribute__ ((weak, alias ("__collector_unsetenv")));
int _unsetenv () __attribute__ ((weak, alias ("__collector_unsetenv"))); int _unsetenv (const char*) __attribute__ ((weak, alias ("__collector_unsetenv")));
int int
__collector_unsetenv (const char *name) __collector_unsetenv (const char *name)
@ -767,9 +767,9 @@ __collector_unsetenv (const char *name)
if (CALL_UTIL (unsetenv) == __collector_unsetenv || if (CALL_UTIL (unsetenv) == __collector_unsetenv ||
CALL_UTIL (unsetenv) == NULL) CALL_UTIL (unsetenv) == NULL)
{ // __collector_libc_funcs_init failed { // __collector_libc_funcs_init failed
CALL_UTIL (unsetenv) = (int(*)())dlsym (RTLD_NEXT, "unsetenv"); CALL_UTIL (unsetenv) = (int(*)(const char*))dlsym (RTLD_NEXT, "unsetenv");
if (CALL_UTIL (unsetenv) == NULL || CALL_UTIL (unsetenv) == __collector_unsetenv) if (CALL_UTIL (unsetenv) == NULL || CALL_UTIL (unsetenv) == __collector_unsetenv)
CALL_UTIL (unsetenv) = (int(*)())dlsym (RTLD_DEFAULT, "unsetenv"); CALL_UTIL (unsetenv) = (int(*)(const char*))dlsym (RTLD_DEFAULT, "unsetenv");
if (CALL_UTIL (unsetenv) == NULL || CALL_UTIL (unsetenv) == __collector_unsetenv) if (CALL_UTIL (unsetenv) == NULL || CALL_UTIL (unsetenv) == __collector_unsetenv)
{ {
TprintfT (DBG_LT2, "__collector_unsetenv(): ERROR: no pointer found.\n"); TprintfT (DBG_LT2, "__collector_unsetenv(): ERROR: no pointer found.\n");

View File

@ -99,8 +99,8 @@ static void rwrite (int fd, const void *buf, size_t nbyte);
static void addToDynamicArchive (const char* name, const unsigned char* class_data, int class_data_len); static void addToDynamicArchive (const char* name, const unsigned char* class_data, int class_data_len);
static void (*AsyncGetCallTrace)(JVMPI_CallTrace*, jint, ucontext_t*) = NULL; static void (*AsyncGetCallTrace)(JVMPI_CallTrace*, jint, ucontext_t*) = NULL;
static void (*collector_heap_record)(int, int, void*) = NULL; static void (*collector_heap_record)(int, int, void*) = NULL;
static void (*collector_jsync_begin)() = NULL; static void (*collector_jsync_begin)(void) = NULL;
static void (*collector_jsync_end)(hrtime_t, void *) = NULL; static void (*collector_jsync_end)(hrtime_t, void*) = NULL;
#define gethrtime collector_interface->getHiResTime #define gethrtime collector_interface->getHiResTime
@ -224,7 +224,7 @@ open_experiment (const char *exp)
else if (__collector_strStartWith (args, "s:") == 0) else if (__collector_strStartWith (args, "s:") == 0)
{ {
java_sync_mode = 1; java_sync_mode = 1;
collector_jsync_begin = (void(*)(hrtime_t, void *))dlsym (RTLD_DEFAULT, "__collector_jsync_begin"); collector_jsync_begin = (void(*)(void))dlsym (RTLD_DEFAULT, "__collector_jsync_begin");
collector_jsync_end = (void(*)(hrtime_t, void *))dlsym (RTLD_DEFAULT, "__collector_jsync_end"); collector_jsync_end = (void(*)(hrtime_t, void *))dlsym (RTLD_DEFAULT, "__collector_jsync_end");
} }
#endif #endif
@ -249,7 +249,7 @@ __collector_jprofile_enable_synctrace ()
return; return;
} }
java_sync_mode = 1; java_sync_mode = 1;
collector_jsync_begin = (void(*)(hrtime_t, void *))dlsym (RTLD_DEFAULT, "__collector_jsync_begin"); collector_jsync_begin = (void(*)(void))dlsym (RTLD_DEFAULT, "__collector_jsync_begin");
collector_jsync_end = (void(*)(hrtime_t, void *))dlsym (RTLD_DEFAULT, "__collector_jsync_end"); collector_jsync_end = (void(*)(hrtime_t, void *))dlsym (RTLD_DEFAULT, "__collector_jsync_end");
TprintfT (DBG_LT1, "jprofile: turning on Java synctrace, and requesting events\n"); TprintfT (DBG_LT1, "jprofile: turning on Java synctrace, and requesting events\n");
} }
@ -1123,7 +1123,7 @@ jprof_find_asyncgetcalltrace ()
{ {
void *jvmhandle; void *jvmhandle;
if (__collector_VM_ReadByteInstruction == NULL) if (__collector_VM_ReadByteInstruction == NULL)
__collector_VM_ReadByteInstruction = (int(*)()) dlsym (RTLD_DEFAULT, "Async_VM_ReadByteInstruction"); __collector_VM_ReadByteInstruction = (int(*)(unsigned char*)) dlsym (RTLD_DEFAULT, "Async_VM_ReadByteInstruction");
/* look for stack unwind function using default path */ /* look for stack unwind function using default path */
AsyncGetCallTrace = (void (*)(JVMPI_CallTrace*, jint, ucontext_t*)) AsyncGetCallTrace = (void (*)(JVMPI_CallTrace*, jint, ucontext_t*))

View File

@ -1114,7 +1114,7 @@ __collector_util_init ()
ptr = dlsym (libc, "munmap"); ptr = dlsym (libc, "munmap");
if (ptr) if (ptr)
__collector_util_funcs.munmap = (int(*)())ptr; __collector_util_funcs.munmap = (int(*)(void *, size_t))ptr;
else else
{ {
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT munmap: %s\n", dlerror ()); CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT munmap: %s\n", dlerror ());
@ -1123,7 +1123,7 @@ __collector_util_init ()
ptr = dlsym (libc, "close"); ptr = dlsym (libc, "close");
if (ptr) if (ptr)
__collector_util_funcs.close = (int(*)())ptr; __collector_util_funcs.close = (int(*)(int))ptr;
else else
{ {
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT close: %s\n", dlerror ()); CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT close: %s\n", dlerror ());
@ -1158,7 +1158,7 @@ __collector_util_init ()
ptr = dlsym (libc, "close"); ptr = dlsym (libc, "close");
if (ptr) if (ptr)
__collector_util_funcs.close = (int(*)())ptr; __collector_util_funcs.close = (int(*)(int))ptr;
else else
{ {
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT close: %s\n", dlerror ()); CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT close: %s\n", dlerror ());
@ -1167,7 +1167,7 @@ __collector_util_init ()
ptr = dlsym (libc, "read"); ptr = dlsym (libc, "read");
if (ptr) if (ptr)
__collector_util_funcs.read = (ssize_t (*)())ptr; __collector_util_funcs.read = (ssize_t (*)(int, void*, size_t))ptr;
else else
{ {
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT read: %s\n", dlerror ()); CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT read: %s\n", dlerror ());
@ -1176,7 +1176,7 @@ __collector_util_init ()
ptr = dlsym (libc, "write"); ptr = dlsym (libc, "write");
if (ptr) if (ptr)
__collector_util_funcs.write = (ssize_t (*)())ptr; __collector_util_funcs.write = (ssize_t (*)(int, void*, size_t))ptr;
else else
{ {
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT write: %s\n", dlerror ()); CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT write: %s\n", dlerror ());
@ -1186,14 +1186,14 @@ __collector_util_init ()
#if ARCH(Intel) && WSIZE(32) #if ARCH(Intel) && WSIZE(32)
ptr = dlvsym (libc, "pwrite", "GLIBC_2.2"); // it is in /lib/libpthread.so.0 ptr = dlvsym (libc, "pwrite", "GLIBC_2.2"); // it is in /lib/libpthread.so.0
if (ptr) if (ptr)
__collector_util_funcs.pwrite = (ssize_t (*)())ptr; __collector_util_funcs.pwrite = (ssize_t (*)(int, void*, size_t, off_t))ptr;
else else
{ {
Tprintf (DBG_LT0, "libcol_util: WARNING: dlvsym for %s@%s failed. Using dlsym() instead.", "pwrite", "GLIBC_2.2"); Tprintf (DBG_LT0, "libcol_util: WARNING: dlvsym for %s@%s failed. Using dlsym() instead.", "pwrite", "GLIBC_2.2");
#endif /* ARCH(Intel) && WSIZE(32) */ #endif /* ARCH(Intel) && WSIZE(32) */
ptr = dlsym (libc, "pwrite"); ptr = dlsym (libc, "pwrite");
if (ptr) if (ptr)
__collector_util_funcs.pwrite = (ssize_t (*)())ptr; __collector_util_funcs.pwrite = (ssize_t (*)(int, const void*, size_t, off_t))ptr;
else else
{ {
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT pwrite: %s\n", dlerror ()); CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT pwrite: %s\n", dlerror ());
@ -1213,7 +1213,7 @@ __collector_util_init ()
#endif /* ARCH(Intel) && WSIZE(32) */ #endif /* ARCH(Intel) && WSIZE(32) */
ptr = dlsym (libc, "pwrite64"); ptr = dlsym (libc, "pwrite64");
if (ptr) if (ptr)
__collector_util_funcs.pwrite64_ = (ssize_t (*)())ptr; __collector_util_funcs.pwrite64_ = (ssize_t (*)(int, const void*, size_t, off_t))ptr;
else else
__collector_util_funcs.pwrite64_ = __collector_util_funcs.pwrite; __collector_util_funcs.pwrite64_ = __collector_util_funcs.pwrite;
#if ARCH(Intel) && WSIZE(32) #if ARCH(Intel) && WSIZE(32)
@ -1222,7 +1222,7 @@ __collector_util_init ()
ptr = dlsym (libc, "lseek"); ptr = dlsym (libc, "lseek");
if (ptr) if (ptr)
__collector_util_funcs.lseek = (off_t (*)())ptr; __collector_util_funcs.lseek = (off_t (*)(int, off_t, int))ptr;
else else
{ {
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT lseek: %s\n", dlerror ()); CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT lseek: %s\n", dlerror ());
@ -1231,7 +1231,7 @@ __collector_util_init ()
ptr = dlsym (libc, "access"); ptr = dlsym (libc, "access");
if (ptr) if (ptr)
__collector_util_funcs.access = (int(*)())ptr; __collector_util_funcs.access = (int(*)(const char*, int))ptr;
else else
{ {
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT access: %s\n", dlerror ()); CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT access: %s\n", dlerror ());
@ -1240,7 +1240,7 @@ __collector_util_init ()
ptr = dlsym (libc, "mkdir"); ptr = dlsym (libc, "mkdir");
if (ptr) if (ptr)
__collector_util_funcs.mkdir = (int(*)())ptr; __collector_util_funcs.mkdir = (int(*)(const char*, mode_t))ptr;
else else
{ {
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT mkdir: %s\n", dlerror ()); CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT mkdir: %s\n", dlerror ());
@ -1249,7 +1249,7 @@ __collector_util_init ()
ptr = dlsym (libc, "opendir"); ptr = dlsym (libc, "opendir");
if (ptr) if (ptr)
__collector_util_funcs.opendir = (DIR * (*)())ptr; __collector_util_funcs.opendir = (DIR * (*)(const char*))ptr;
else else
{ {
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT opendir: %s\n", dlerror ()); CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT opendir: %s\n", dlerror ());
@ -1258,7 +1258,7 @@ __collector_util_init ()
ptr = dlsym (libc, "closedir"); ptr = dlsym (libc, "closedir");
if (ptr) if (ptr)
__collector_util_funcs.closedir = (int(*)())ptr; __collector_util_funcs.closedir = (int(*)(DIR*))ptr;
else else
{ {
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT closedir: %s\n", dlerror ()); CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT closedir: %s\n", dlerror ());
@ -1267,7 +1267,7 @@ __collector_util_init ()
ptr = dlsym (libc, "execv"); ptr = dlsym (libc, "execv");
if (ptr) if (ptr)
__collector_util_funcs.execv = (int(*)())ptr; __collector_util_funcs.execv = (int(*)(const char*, char* const*))ptr;
else else
{ {
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT execv: %s\n", dlerror ()); CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT execv: %s\n", dlerror ());
@ -1276,7 +1276,7 @@ __collector_util_init ()
ptr = dlsym (libc, "exit"); ptr = dlsym (libc, "exit");
if (ptr) if (ptr)
__collector_util_funcs.exit = (void(*)())ptr; __collector_util_funcs.exit = (void(*)(int))ptr;
else else
{ {
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT exit: %s\n", dlerror ()); CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT exit: %s\n", dlerror ());
@ -1285,7 +1285,7 @@ __collector_util_init ()
ptr = dlsym (libc, "vfork"); ptr = dlsym (libc, "vfork");
if (ptr) if (ptr)
__collector_util_funcs.vfork = (pid_t (*)())ptr; __collector_util_funcs.vfork = (pid_t (*)(void))ptr;
else else
{ {
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT vfork: %s\n", dlerror ()); CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT vfork: %s\n", dlerror ());
@ -1294,7 +1294,7 @@ __collector_util_init ()
ptr = dlsym (libc, "waitpid"); ptr = dlsym (libc, "waitpid");
if (ptr) if (ptr)
__collector_util_funcs.waitpid = (pid_t (*)())ptr; __collector_util_funcs.waitpid = (pid_t (*)(pid_t, int*, int))ptr;
else else
{ {
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT waitpid: %s\n", dlerror ()); CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT waitpid: %s\n", dlerror ());
@ -1313,7 +1313,7 @@ __collector_util_init ()
ptr = dlsym (libc, "getcontext"); ptr = dlsym (libc, "getcontext");
if (ptr) if (ptr)
__collector_util_funcs.getcontext = (int(*)())ptr; __collector_util_funcs.getcontext = (int(*)(ucontext_t*))ptr;
else else
{ {
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT getcontext: %s\n", dlerror ()); CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT getcontext: %s\n", dlerror ());
@ -1331,7 +1331,7 @@ __collector_util_init ()
ptr = dlsym (libc, "putenv"); ptr = dlsym (libc, "putenv");
if (ptr) if (ptr)
__collector_util_funcs.putenv = (int(*)())ptr; __collector_util_funcs.putenv = (int(*)(char*))ptr;
else else
{ {
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT putenv: %s\n", dlerror ()); CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT putenv: %s\n", dlerror ());
@ -1340,7 +1340,7 @@ __collector_util_init ()
ptr = dlsym (libc, "getenv"); ptr = dlsym (libc, "getenv");
if (ptr) if (ptr)
__collector_util_funcs.getenv = (char*(*)())ptr; __collector_util_funcs.getenv = (char*(*)(const char*))ptr;
else else
{ {
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT getenv: %s\n", dlerror ()); CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT getenv: %s\n", dlerror ());
@ -1349,7 +1349,7 @@ __collector_util_init ()
ptr = dlsym (libc, "time"); ptr = dlsym (libc, "time");
if (ptr) if (ptr)
__collector_util_funcs.time = (time_t (*)())ptr; __collector_util_funcs.time = (time_t (*)(time_t*))ptr;
else else
{ {
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT time: %s\n", dlerror ()); CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT time: %s\n", dlerror ());
@ -1358,7 +1358,7 @@ __collector_util_init ()
ptr = dlsym (libc, "mktime"); ptr = dlsym (libc, "mktime");
if (ptr) if (ptr)
__collector_util_funcs.mktime = (time_t (*)())ptr; __collector_util_funcs.mktime = (time_t (*)(struct tm*))ptr;
else else
{ {
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT mktime: %s\n", dlerror ()); CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT mktime: %s\n", dlerror ());
@ -1372,7 +1372,7 @@ __collector_util_init ()
ptr = dlsym (libc, "gmtime_r"); ptr = dlsym (libc, "gmtime_r");
if (ptr) if (ptr)
__collector_util_funcs.gmtime_r = (struct tm * (*)())ptr; __collector_util_funcs.gmtime_r = (struct tm * (*)(const time_t*, struct tm*))ptr;
else else
{ {
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT gmtime_r: %s\n", dlerror ()); CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT gmtime_r: %s\n", dlerror ());
@ -1381,7 +1381,7 @@ __collector_util_init ()
ptr = dlsym (libc, "strtol"); ptr = dlsym (libc, "strtol");
if (ptr) if (ptr)
__collector_util_funcs.strtol = (long (*)())ptr; __collector_util_funcs.strtol = (long (*)(const char*, char**, int))ptr;
else else
{ {
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT strtol: %s\n", dlerror ()); CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT strtol: %s\n", dlerror ());
@ -1390,7 +1390,7 @@ __collector_util_init ()
ptr = dlsym (libc, "strtoll"); ptr = dlsym (libc, "strtoll");
if (ptr) if (ptr)
__collector_util_funcs.strtoll = (long long (*)())ptr; __collector_util_funcs.strtoll = (long long (*)(const char*, char**, int))ptr;
else else
{ {
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT strtoll: %s\n", dlerror ()); CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT strtoll: %s\n", dlerror ());
@ -1402,7 +1402,7 @@ __collector_util_init ()
ptr = dlsym (libc, "setenv"); ptr = dlsym (libc, "setenv");
if (ptr) if (ptr)
__collector_util_funcs.setenv = (int(*)())ptr; __collector_util_funcs.setenv = (int(*)(const char*, const char*, int))ptr;
else else
{ {
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT setenv: %s\n", dlerror ()); CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT setenv: %s\n", dlerror ());
@ -1411,7 +1411,7 @@ __collector_util_init ()
ptr = dlsym (libc, "unsetenv"); ptr = dlsym (libc, "unsetenv");
if (ptr) if (ptr)
__collector_util_funcs.unsetenv = (int(*)())ptr; __collector_util_funcs.unsetenv = (int(*)(const char*))ptr;
else else
{ {
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT unsetenv: %s\n", dlerror ()); CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT unsetenv: %s\n", dlerror ());
@ -1507,7 +1507,7 @@ __collector_util_init ()
ptr = dlsym (libc, "pclose"); ptr = dlsym (libc, "pclose");
if (ptr) if (ptr)
__collector_util_funcs.pclose = (int(*)())ptr; __collector_util_funcs.pclose = (int(*)(FILE*))ptr;
else else
{ {
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT pclose: %s\n", dlerror ()); CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT pclose: %s\n", dlerror ());
@ -1516,7 +1516,7 @@ __collector_util_init ()
ptr = dlsym (libc, "fgets"); ptr = dlsym (libc, "fgets");
if (ptr) if (ptr)
__collector_util_funcs.fgets = (char*(*)())ptr; __collector_util_funcs.fgets = (char*(*)(char*, int, FILE*))ptr;
else else
{ {
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT fgets: %s\n", dlerror ()); CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT fgets: %s\n", dlerror ());
@ -1543,7 +1543,7 @@ __collector_util_init ()
ptr = dlsym (libc, "vsnprintf"); ptr = dlsym (libc, "vsnprintf");
if (ptr) if (ptr)
__collector_util_funcs.vsnprintf = (int(*)())ptr; __collector_util_funcs.vsnprintf = (int(*)(char*, size_t, const char*, ...))ptr;
else else
{ {
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT vsnprintf: %s\n", dlerror ()); CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT vsnprintf: %s\n", dlerror ());
@ -1552,7 +1552,7 @@ __collector_util_init ()
ptr = dlsym (libc, "atoi"); ptr = dlsym (libc, "atoi");
if (ptr) if (ptr)
__collector_util_funcs.atoi = (int(*)())ptr; __collector_util_funcs.atoi = (int(*)(const char*))ptr;
else else
{ {
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT atoi: %s\n", dlerror ()); CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT atoi: %s\n", dlerror ());
@ -1561,7 +1561,7 @@ __collector_util_init ()
ptr = dlsym (libc, "calloc"); ptr = dlsym (libc, "calloc");
if (ptr) if (ptr)
__collector_util_funcs.calloc = (void*(*)())ptr; __collector_util_funcs.calloc = (void*(*)(size_t, size_t))ptr;
else else
{ {
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT calloc: %s\n", dlerror ()); CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT calloc: %s\n", dlerror ());
@ -1571,7 +1571,7 @@ __collector_util_init ()
ptr = dlsym (libc, "free"); ptr = dlsym (libc, "free");
if (ptr) if (ptr)
{ {
__collector_util_funcs.free = (void(*)())ptr; __collector_util_funcs.free = (void(*)(void*))ptr;
} }
else else
{ {
@ -1581,7 +1581,7 @@ __collector_util_init ()
ptr = dlsym (libc, "strdup"); ptr = dlsym (libc, "strdup");
if (ptr) if (ptr)
__collector_util_funcs.libc_strdup = (char*(*)())ptr; __collector_util_funcs.libc_strdup = (char*(*)(const char*))ptr;
else else
{ {
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT strdup: %s\n", dlerror ()); CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT strdup: %s\n", dlerror ());
@ -1594,7 +1594,7 @@ __collector_util_init ()
ptr = dlsym (libc, "strerror"); ptr = dlsym (libc, "strerror");
if (ptr) if (ptr)
__collector_util_funcs.strerror = (char*(*)())ptr; __collector_util_funcs.strerror = (char*(*)(int))ptr;
else else
{ {
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT strerror: %s\n", dlerror ()); CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT strerror: %s\n", dlerror ());
@ -1602,7 +1602,7 @@ __collector_util_init ()
} }
ptr = dlsym (libc, "strerror_r"); ptr = dlsym (libc, "strerror_r");
if (ptr) if (ptr)
__collector_util_funcs.strerror_r = (int(*)())ptr; __collector_util_funcs.strerror_r = (int(*)(int, char*, size_t))ptr;
else else
{ {
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT strerror_r: %s\n", dlerror ()); CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT strerror_r: %s\n", dlerror ());
@ -1610,7 +1610,7 @@ __collector_util_init ()
} }
ptr = dlsym (libc, "strspn"); ptr = dlsym (libc, "strspn");
if (ptr) if (ptr)
__collector_util_funcs.strspn = (size_t (*)())ptr; __collector_util_funcs.strspn = (size_t (*)(const char*, const char*))ptr;
else else
{ {
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT strspn: %s\n", dlerror ()); CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT strspn: %s\n", dlerror ());
@ -1619,7 +1619,7 @@ __collector_util_init ()
ptr = dlsym (libc, "strtoul"); ptr = dlsym (libc, "strtoul");
if (ptr) if (ptr)
__collector_util_funcs.strtoul = (unsigned long int(*)())ptr; __collector_util_funcs.strtoul = (unsigned long int(*)(const char*, char**, int))ptr;
else else
{ {
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT strtoul: %s\n", dlerror ()); CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT strtoul: %s\n", dlerror ());
@ -1628,7 +1628,7 @@ __collector_util_init ()
ptr = dlsym (libc, "strtoull"); ptr = dlsym (libc, "strtoull");
if (ptr) if (ptr)
__collector_util_funcs.strtoull = (unsigned long long int(*)())ptr; __collector_util_funcs.strtoull = (unsigned long long int(*)(const char*, char**, int))ptr;
else else
{ {
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT strtoull: %s\n", dlerror ()); CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT strtoull: %s\n", dlerror ());
@ -1673,7 +1673,7 @@ __collector_util_init ()
ptr = dlsym (libc, "sysconf"); ptr = dlsym (libc, "sysconf");
if (ptr) if (ptr)
__collector_util_funcs.sysconf = (long(*)())ptr; __collector_util_funcs.sysconf = (long(*)(int))ptr;
else else
{ {
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT sysconf: %s\n", dlerror ()); CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT sysconf: %s\n", dlerror ());
@ -1682,7 +1682,7 @@ __collector_util_init ()
ptr = dlsym (libc, "sigfillset"); ptr = dlsym (libc, "sigfillset");
if (ptr) if (ptr)
__collector_util_funcs.sigfillset = (int(*)())ptr; __collector_util_funcs.sigfillset = (int(*)(sigset_t*))ptr;
else else
{ {
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT sigfillset: %s\n", dlerror ()); CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT sigfillset: %s\n", dlerror ());
@ -1691,7 +1691,7 @@ __collector_util_init ()
ptr = dlsym (libc, "sigprocmask"); ptr = dlsym (libc, "sigprocmask");
if (ptr) if (ptr)
__collector_util_funcs.sigprocmask = (int(*)())ptr; __collector_util_funcs.sigprocmask = (int(*)(int, const sigset_t*, sigset_t*))ptr;
else else
{ {
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT sigprocmask: %s\n", dlerror ()); CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT sigprocmask: %s\n", dlerror ());

View File

@ -1209,7 +1209,7 @@ process_vsyscall_page ()
/* /*
* collector API for dynamic functions * collector API for dynamic functions
*/ */
void collector_func_load () __attribute__ ((weak, alias ("__collector_func_load"))); void collector_func_load (char*, char*, char*, void*, int, int, DT_lineno *) __attribute__ ((weak, alias ("__collector_func_load")));
void void
__collector_func_load (char *name, char *alias, char *sourcename, __collector_func_load (char *name, char *alias, char *sourcename,
void *vaddr, int size, int lntsize, DT_lineno *lntable) void *vaddr, int size, int lntsize, DT_lineno *lntable)
@ -1218,7 +1218,7 @@ __collector_func_load (char *name, char *alias, char *sourcename,
vaddr, size, lntsize, lntable); vaddr, size, lntsize, lntable);
} }
void collector_func_unload () __attribute__ ((weak, alias ("__collector_func_unload"))); void collector_func_unload (void *vaddr) __attribute__ ((weak, alias ("__collector_func_unload")));
void void
__collector_func_unload (void *vaddr) __collector_func_unload (void *vaddr)
{ {

View File

@ -421,7 +421,7 @@ __collector_ext_unwind_init (int record)
omp_no_walk = 1; omp_no_walk = 1;
if (__collector_VM_ReadByteInstruction == NULL) if (__collector_VM_ReadByteInstruction == NULL)
__collector_VM_ReadByteInstruction = (int(*)()) dlsym (RTLD_DEFAULT, "Async_VM_ReadByteInstruction"); __collector_VM_ReadByteInstruction = (int(*)(unsigned char*)) dlsym (RTLD_DEFAULT, "Async_VM_ReadByteInstruction");
#if ARCH(SPARC) #if ARCH(SPARC)
#if WSIZE(64) #if WSIZE(64)

View File

@ -110,7 +110,7 @@ typedef struct CollectorUtilFuncs
long (*sysinfo)(int command, char *buf, long count); long (*sysinfo)(int command, char *buf, long count);
time_t (*time)(time_t *tloc); time_t (*time)(time_t *tloc);
int (*unsetenv)(const char *name); int (*unsetenv)(const char *name);
int (*vsnprintf)(char *str, size_t size, const char *format, va_list ap); int (*vsnprintf)(char *str, size_t size, const char *format, ...);
pid_t (*waitpid)(pid_t pid, int *stat_loc, int options); pid_t (*waitpid)(pid_t pid, int *stat_loc, int options);
ssize_t (*write)(int, void *, size_t); ssize_t (*write)(int, void *, size_t);
double (*atof)(); double (*atof)();