News for hackers. Stuff that matters.
Re:Ghosts of Unix past, part 3: Unfixable designs (2010) by asveikau on Monday May 17, 2021 @01:18PM (#27185802)
This is a (rare?) instance where I would say Win32 gives you some remedy over POSIX. On Windows, you can open a handle and deal with that, rather than a pid. Once the handle is open, it isn't subject to this recycling problem.

However if opening a handle based on pid you may want to double-check that the handle matches your expectation before using it, since that would be prone to the same race.

Re:Ghosts of Unix past, part 3: Unfixable designs (2010) by simcop2387 on Monday May 17, 2021 @01:34PM (#27185936)
This is actually what pidfd does on linux, you get a handle to the process that lets you interact with it in that same manner. Once the process exits the handle gets closed and all the operations will report an error even if you have a recycled pid
Re:Ghosts of Unix past, part 3: Unfixable designs (2010) by surajrmal on Tuesday May 18, 2021 @03:21AM (#27192038)
Not that it matters much these days, but do note that pidfd is a Linux concept, not a posix one. It's also a fairly recent one and it'll be a number of years before many people can use it even still. Windows by comparison has had a solution for white some time.
Re:Ghosts of Unix past, part 3: Unfixable designs (2010) by surajrmal on Tuesday May 18, 2021 @03:16AM (#27192015)
I dont care much for Windows, but I would argue that it's well architected compared to nix in many regards.