Today I learned - getpid() in glibc used to cache the result (pid). This was removed in recent glibc because it was "not reliable". What? How can getpid value change over time???? https://sourceware.org/glibc/wiki/Release/2.25#pid_cache_removal …
-
-
fork. The fork function itself updated the cached value but vfork, clone, manual fork syscall, etc. could all be problematic.
3 replies 1 retweet 7 likes -
thanks Rich. what's .
@musllibc's behavior in this regard? http://www.etalabs.net/compare_libcs.html …1 reply 0 retweets 1 like -
Replying to @__dotblake @majek04 and
We don't cache pid and mask all signals between getpid & use of the result. But tid is cached in tcb because otherwise locks are hideously slow.
1 reply 1 retweet 2 likes -
Replying to @RichFelker @__dotblake and
Difference is that most functions that use tid aren't AS-safe, meaning use in contexts where weird forkings could have invalidated them is already UB.
1 reply 0 retweets 2 likes
Replying to @RichFelker @__dotblake and
For the few that are AS-safe (raise comes to mind) we mask signals and gettid.
4:02 PM - 28 Feb 2018
0 replies
0 retweets
2 likes
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.