From: Joshua Kinard Date: Thu, 4 Feb 2016 21:36:13 +0000 (+1100) Subject: xfs_copy: use POSIX signal API X-Git-Tag: v4.5.0-rc1~40 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ad0a1e9f461d9dee9c20860bf50b9a1a837c3f7b;p=thirdparty%2Fxfsprogs-dev.git xfs_copy: use POSIX signal API uClibc doesn't provide the sigrelse or sighold calls, so this patch replaces them with POSIX signal API calls (sigprocmask(2), etc). Refer to Gentoo Bug #477758: https://bugs.gentoo.org/show_bug.cgi?id=477758 Signed-off-by: Joshua Kinard Suggested-by: René Rhéaume Reviewed-by: Dave Chinner Signed-off-by: Dave Chinner --- diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c index 15a3f337d..3c8998c7b 100644 --- a/copy/xfs_copy.c +++ b/copy/xfs_copy.c @@ -74,6 +74,16 @@ static int format_logs(struct xfs_mount *); #define PRE 0x08 /* append strerror string */ #define LAST 0x10 /* final message we print */ +void +signal_maskfunc(int addset, int newset) +{ + sigset_t set; + + sigemptyset(&set); + sigaddset(&set, addset); + sigprocmask(newset, &set, NULL); +} + void do_message(int flags, int code, const char *fmt, ...) { @@ -477,9 +487,9 @@ write_wbuf(void) if (target[i].state != INACTIVE) pthread_mutex_unlock(&targ[i].wait); /* wake up */ - sigrelse(SIGCHLD); + signal_maskfunc(SIGCHLD, SIG_UNBLOCK); pthread_mutex_lock(&mainwait); - sighold(SIGCHLD); + signal_maskfunc(SIGCHLD, SIG_BLOCK); } void @@ -893,7 +903,7 @@ main(int argc, char **argv) /* set up sigchild signal handler */ signal(SIGCHLD, handler); - sighold(SIGCHLD); + signal_maskfunc(SIGCHLD, SIG_BLOCK); /* make children */