Created
March 13, 2015 04:10
-
-
Save lilydjwg/0bfa6807b88e6d39a995 to your computer and use it in GitHub Desktop.
zsh/subreap module
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<sys/prctl.h> | |
#include "subreap.mdh" | |
#include "subreap.pro" | |
/**/ | |
static int | |
bin_subreap(char *nam, char **args, Options ops, UNUSED(int func)) | |
{ | |
int reaping = !OPT_ISSET(ops, 'u'); | |
int result = prctl(PR_SET_CHILD_SUBREAPER, reaping); | |
return result; | |
} | |
/* | |
* boot_ is executed when the module is loaded. | |
*/ | |
static struct builtin bintab[] = { | |
BUILTIN("subreap", 0, bin_subreap, 0, -1, 0, "u", NULL), | |
}; | |
static struct features module_features = { | |
bintab, sizeof(bintab)/sizeof(*bintab), | |
0 | |
}; | |
/**/ | |
int | |
setup_(UNUSED(Module m)) | |
{ | |
return 0; | |
} | |
/**/ | |
int | |
features_(Module m, char ***features) | |
{ | |
*features = featuresarray(m, &module_features); | |
return 0; | |
} | |
/**/ | |
int | |
enables_(Module m, int **enables) | |
{ | |
return handlefeatures(m, &module_features, enables); | |
} | |
/**/ | |
int | |
boot_(Module m) | |
{ | |
return 0; | |
} | |
/**/ | |
int | |
cleanup_(Module m) | |
{ | |
return setfeatureenables(m, &module_features, NULL); | |
} | |
/**/ | |
int | |
finish_(UNUSED(Module m)) | |
{ | |
return 0; | |
} |
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
name=zsh/subreap | |
link=dynamic | |
load=no | |
autofeatures="b:subreap" | |
objects="subreap.o" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Put them in zsh source's
Src/Modules
directory and then build.