Bug 125751 - man 3 pthread_getschedparam section ERRORS incomplete
Summary: man 3 pthread_getschedparam section ERRORS incomplete
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: standards (show other bugs)
Version: 6.3-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-standards (Nobody)
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2008-07-18 16:30 UTC by Dan Lukes
Modified: 2018-05-23 10:26 UTC (History)
0 users

See Also:


Attachments
pthread.diff (812 bytes, patch)
2011-02-22 21:41 UTC, Bruce Cran
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Lukes 2008-07-18 16:30:01 UTC
    The function

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.

Fix: 

Add the EINVAL error code to ERRORS section, pthread_getschedparam subsection of manual page
Comment 1 Dan Lukes 2008-07-18 16:43:15 UTC
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

					Dan
Comment 2 Bruce Cran freebsd_committer 2011-02-18 10:03:31 UTC
Responsible Changed
From-To: freebsd-doc->brucec

Take.
Comment 3 Bruce Cran freebsd_committer 2011-02-22 21:41:54 UTC
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.

-- 
Bruce Cran
Comment 4 Dan Lukes 2011-02-22 21:54:11 UTC
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 ...

Dan
Comment 5 Mark Linimon freebsd_committer freebsd_triage 2013-07-03 01:50:32 UTC
Responsible Changed
From-To: brucec->freebsd-standards

commit bit has been taken in for safekeeping.
Comment 6 Eitan Adler freebsd_committer freebsd_triage 2018-05-23 10:26:56 UTC
batch change of PRs untouched in 2018 marked "in progress" back to open.