Created
February 14, 2014 12:34
-
-
Save lilydjwg/9000254 to your computer and use it in GitHub Desktop.
make processes reap their own children processes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<sys/prctl.h> | |
__attribute__ ((constructor)) static void setup(void) { | |
if(prctl(PR_SET_CHILD_SUBREAPER, 1) != 0){ | |
perror("prctl"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
gcc -shared -fPIC -o libsubreap.so libsubreap.c
then tryexport LD_PRELOAD=./libsubreap.so
.Linux 3.4+ only.