diff options
Diffstat (limited to 'libsandbox/wrapper-funcs')
-rw-r--r-- | libsandbox/wrapper-funcs/fork.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/libsandbox/wrapper-funcs/fork.c b/libsandbox/wrapper-funcs/fork.c new file mode 100644 index 0000000..c250018 --- /dev/null +++ b/libsandbox/wrapper-funcs/fork.c @@ -0,0 +1,24 @@ +/* + * fork() wrapper. + * + * Copyright 1999-2009 Gentoo Foundation + * Licensed under the GPL-2 + */ + +/* We're only wrapping fork() as a poor man's pthread_atfork(). That would + * require dedicated linkage against libpthread. So here we force the locks + * to a consistent state before forking. #263657 + */ + +#define WRAPPER_ARGS_PROTO +#define WRAPPER_ARGS +#define WRAPPER_SAFE() 0 +#define WRAPPER_PRE_CHECKS() \ +({ \ + /* pthread_atfork(sb_lock, sb_unlock, sb_unlock); */ \ + sb_lock(); \ + result = SB_HIDDEN_FUNC(WRAPPER_NAME)(WRAPPER_ARGS_FULL); \ + sb_unlock(); \ + false; \ +}) +#include "__wrapper_simple.c" |