1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-30 22:43:12 +03:00

linux: Avoid shifting a negative signed on POSIX timer interface

The current macros uses pid as signed value, which triggers a compiler
warning for process and thread timers.  Replace MAKE_PROCESS_CPUCLOCK
with static inline function that expects the pid as unsigned.  These
are similar to what Linux does internally.

Checked on x86_64-linux-gnu.
Reviewed-by: Arjun Shankar <arjun@redhat.com>
This commit is contained in:
Adhemerval Zanella
2022-08-30 09:08:02 -03:00
parent 643a2d0139
commit 9b5e138f2b
5 changed files with 28 additions and 10 deletions

View File

@ -29,7 +29,7 @@ __clock_getcpuclockid (pid_t pid, clockid_t *clock_id)
/* The clockid_t value is a simple computation from the PID.
But we do a clock_getres call to validate it. */
const clockid_t pidclock = MAKE_PROCESS_CPUCLOCK (pid, CPUCLOCK_SCHED);
const clockid_t pidclock = make_process_cpuclock (pid, CPUCLOCK_SCHED);
#ifndef __NR_clock_getres_time64
# define __NR_clock_getres_time64 __NR_clock_getres