This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: question about prctl return value type
- From: Florian Weimer <fweimer at redhat dot com>
- To: Yang Xu <xuyang2018 dot jy at cn dot fujitsu dot com>
- Cc: <libc-help at sourceware dot org>
- Date: Wed, 24 Jul 2019 12:48:15 +0200
- Subject: Re: question about prctl return value type
- References: <5D382C5F.6020806@cn.fujitsu.com>
* Yang Xu:
> 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
Note that the actual user-visible header is
sysdeps/unix/sysv/linux/sys/prctl.h, but it has the same issue.
> 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?
I think this is a glibc limitation/bug. The return type should probably
be __register_t (a type that is currently woefully underused). We
cannot simply change the return time because once applications are built
against the new prototype, we need to ensure that they also use the new
glibc.
Would you please file a bug for this?
<https://sourceware.org/bugzilla/> is our bug tracker.
Thanks,
Florian