mheily / libkqueue

kqueue(2) compatibility library
Other
238 stars 77 forks source link

Waiting for non-child exit on Linux #154

Open RJVB opened 1 year ago

RJVB commented 1 year ago

https://github.com/mheily/libkqueue/blob/24f20f05abd7e981cbccc46645ba053756c0ff81/BUGS.md?plain=1#L65

I've been looking into this, and I think there's a work-around mentioned here: https://stackoverflow.com/a/22893464/1460868 : using ptrace(2). There are limits to that too (only 1 other process can wait) but on my ageing Ubuntu 14.04 system I didn't have to tweak a file under /proc/sys/kernel in order to make it possible to do strace -qqe '' -p PID>.

You'd probably want to limit this only to non-child process (by querying /proc/PID/tasks/PID/children?) and get the relevant, stripped-down code from https://github.com/strace/strace .