News for hackers. Stuff that matters.
Re:Not knowing the /proc file system by dale_glass on Wednesday October 25, 2023 @07:22AM (#38011619)
Yup. Some parts of the API are a huge annoyance like that.

Also there's no guarantee whatsoever that /proc/123 is going to refer to a specific process, or to remain existing while you get all the data you need. The whole API is full of race conditions.

Re:Not knowing the /proc file system by knome on Wednesday October 25, 2023 @08:01AM (#38011874)
>Also there's no guarantee whatsoever that /proc/123 is going to refer to a specific process

does using openat solve that or is there some kind of directory inode reuse occurring?

Re:Not knowing the /proc file system by iforgotpassword on Wednesday October 25, 2023 @09:39AM (#38012646)
No, that's usually the way to go, although I couldn't guarantee you that inodes could theoretically get reused; I never checked. I would assume you don't reuse an inode that's still in use...
Re:Not knowing the /proc file system by lathiat on Wednesday October 25, 2023 @09:40AM (#38012663)
See also, pidfd, for similar reasons: https://lwn.net/Articles/794707/