Skip to contentSkip to conversation

Remove ESRCH from pthread_* man pages or document it as nonstandard

DISCUSSION Rich Felker 1 participant 1 message Feb 10, 2020 Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore
#0 lore raw

Use of a pthread_t after its lifetime has ended is undefined behavior. Pre-2008 POSIX wrongly had ESRCH errors specified for a number of interfaces, conflicting with explicitly making such use UB; this was fixed as a result of Austin Group interpretation 142:

https://collaboration.opengroup.org/austin/interps/documents/14366/AI-142.txt

However, the man pages still have ESRCH listed for most if not all of the pthread_* interfaces that take a pthread_t argument.

Could this be removed, or annotated to clarify that (1) this is not standard/portable behavior programmers can rely on (FYI: musl does not do it), and (2) like all instances of the pattern "use of resource identifier after the resource it refers to has been released/freed", passing a pthread_t whose lifetime may have ended is inherently a bug.

This came up again on the musl mailing list today:

https://www.openwall.com/lists/musl/2020/02/10/3

Rich