int pthread_getschedparam(pthread_t thread, int *policy, struct sched_param *param);
will return EINVAL in the case the policy or param is NULL
It apply to al three implementations:
Reentrant C Library (libc_r, -lc_r)
POSIX Threads Library (libpthread, -lpthread)
1:1 Threading Library (libthr, -lthr)
Unfortunately, the manual page mention the ESRCH as the only error code fur such function.
Add the EINVAL error code to ERRORS section, pthread_getschedparam subsection of manual page
Note, if the first param is NULL or something that can't be thread ID
then the function also return EINVAL.
The ESRCH is returned for such ID's that are thread ID, but thread in
question doesn't exist
According to POSIX EINVAL isn't a valid return value, which is why it's not
documented. It appears that if the parameters are NULL 0 is expected to be
returned; in glibc on Linux if both are NULL then 0 is returned otherwise if
just one is NULL then a segfault occurs.
I'd like to commit the attached patch which I think brings the implementation
more in-line with POSIX: return 0 if either parameters are NULL and return
ESRCH from functions which search for a pthread_t if a thread doesn't exist
regardless of whether it's NULL or otherwise.
On 02/22/11 22:41, Bruce Cran:
> According to POSIX EINVAL isn't a valid return value
I don't have problem with proposed patch. I reported the issue because I
got EIVAL and it has not been documented.
Either code or documentation needs to be changed to make them
consistent, but I don't care what part will be corrected.
Thank you for taking those ancient PRs ...
commit bit has been taken in for safekeeping.
batch change of PRs untouched in 2018 marked "in progress" back to open.