This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
question about prctl return value type
- From: Yang Xu <xuyang2018 dot jy at cn dot fujitsu dot com>
- To: <libc-help at sourceware dot org>
- Date: Wed, 24 Jul 2019 18:01:03 +0800
- Subject: question about prctl return value type
Hi All
Since kernel syscall use long value for return, why we set int in sys/prctl.h(glibc). as below:
/include/sys/prctl.h
1 #ifndef _SYS_PRCTL_H
2 #include_next <sys/prctl.h>
3
4 # ifndef _ISOMAC
5
6 extern int __prctl (int __option, ...);
7
8 # endif /* !_ISOMAC */
9 #endif
If we calling prctl(PR_SET_TIMERSLACK, ULONG_MAX) and then calling prctl(PR_GET_TIMERSLACK), the value
will be truncated into INT_MAX(or convered into unsinged,it is UINT_MAX) on 64bit machine. Or, this is a
glibc limitation for prctl interfaces?
ps:After kernel commit da8b44d5a9f ("timer: convert timer_slack_ns from unsigned long to u64"),
we limit under ULONG_MAX when calling PR_GET_TIMERSLACK. I think we can use long instead of int in sys/prctl.h.
Thanks
Yang Xu