this post was submitted on 07 Jul 2024
837 points (92.9% liked)

linuxmemes

20454 readers
135 users here now

I use Arch btw


Sister communities:

Community rules

  1. Follow the site-wide rules and code of conduct
  2. Be civil
  3. Post Linux-related content
  4. No recent reposts

Please report posts and comments that break these rules!

founded 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] senkora 3 points 1 month ago (1 children)

I haven’t tried this, but if you just need the parent to call waitpid on the child’s pid then you should be able to do that by attaching to the process via gdb, breaking, and then manually invoking waitpid and continuing.

[–] [email protected] 8 points 1 month ago* (last edited 1 month ago)

I think that should do it. I'll try later today and report back.

Of course, this risks getting into an even worse state, because if the parent later tries to correctly wait for its child, the call will hang.

Edit: Will clean up the orphan/defunct process.

If the parent ever tried to wait, they would either get ECHILD if there are no children, or it would block until a child exited.

Will likely cause follow on issues - reaping someone elses children is generally frowned upon :D.