Background
I am writing a shared library in C, dynamically linked with LD_PRELOAD, that is meant to intercept and override network calls from the application preloading it, such as socket(), connect(), recv(), send(), etc.
In the init of the library I launch a thread with pthread_create(). This thread polls some kernel memory, which is mapped to user space.
The library is meant to be generic enough to deal with - but not limited to - networking benchmark applications such as netperf, iperf, sockperf.
My issue
Everything works fine, life is sweet in most of the cases except one. Deamonized applications. For instance, if I launch netserver (the server side of the netperf benchmarking application) as a deamon, i.e. without the -D parameter, one of the first things the application does is call fork(). On fork, the parent is closed using exit(EXIT_SUCCESS) and the child listens for connections. The fact that the parent exits kills my polling thread. 
So what I'd like to achieve is have the child spawn a new polling thread if the parent has gone. I can intercept and override the fork() call but fundamentally, how can I have the child know whether the parent has gone or not? I can't take any assumption because the library has to be generic.
Thanks.