diff options
Diffstat (limited to 'sysdeps/posix/profil.c')
-rw-r--r-- | sysdeps/posix/profil.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/sysdeps/posix/profil.c b/sysdeps/posix/profil.c index ae0a663533..7e5c6bcd2f 100644 --- a/sysdeps/posix/profil.c +++ b/sysdeps/posix/profil.c @@ -1,5 +1,5 @@ /* Low-level statistical profiling support function. Mostly POSIX.1 version. - Copyright (C) 1996-2018 Free Software Foundation, Inc. + Copyright (C) 1996-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -14,13 +14,14 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ + <https://www.gnu.org/licenses/>. */ #include <sys/types.h> #include <unistd.h> #include <errno.h> #include <signal.h> #include <sys/time.h> +#include <stdint.h> #include <libc-internal.h> #include <sigsetops.h> @@ -36,9 +37,9 @@ static size_t pc_offset; static u_int pc_scale; static inline void -profil_count (void *pc) +profil_count (uintptr_t pc) { - size_t i = (pc - pc_offset - (void *) 0) / 2; + size_t i = (pc - pc_offset) / 2; if (sizeof (unsigned long long int) > sizeof (size_t)) i = (unsigned long long int) i * pc_scale / 65536; @@ -104,8 +105,14 @@ __profil (u_short *sample_buffer, size_t size, size_t offset, u_int scale) pc_offset = offset; pc_scale = scale; - act.sa_handler = (sighandler_t) &__profil_counter; - act.sa_flags = SA_RESTART; +#ifdef SA_SIGINFO + act.sa_sigaction = __profil_counter; + act.sa_flags = SA_SIGINFO; +#else + act.sa_handler = __profil_counter; + act.sa_flags = 0; +#endif + act.sa_flags |= SA_RESTART; __sigfillset (&act.sa_mask); if (__sigaction (SIGPROF, &act, oact_ptr) < 0) return -1; |