heirloom-ed
diff sigrelse.c @ 0:1493bea5ac22
Initial version of the standalone heirloom-ed
author | markus schnalke <meillo@marmaro.de> |
---|---|
date | Mon, 05 Sep 2011 16:31:35 +0200 |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/sigrelse.c Mon Sep 05 16:31:35 2011 +0200 1.3 @@ -0,0 +1,41 @@ 1.4 +/* 1.5 + * Copyright (c) 2004 Gunnar Ritter 1.6 + * 1.7 + * This software is provided 'as-is', without any express or implied 1.8 + * warranty. In no event will the authors be held liable for any damages 1.9 + * arising from the use of this software. 1.10 + * 1.11 + * Permission is granted to anyone to use this software for any purpose, 1.12 + * including commercial applications, and to alter it and redistribute 1.13 + * it freely, subject to the following restrictions: 1.14 + * 1.15 + * 1. The origin of this software must not be misrepresented; you must not 1.16 + * claim that you wrote the original software. If you use this software 1.17 + * in a product, an acknowledgment in the product documentation would be 1.18 + * appreciated but is not required. 1.19 + * 1.20 + * 2. Altered source versions must be plainly marked as such, and must not be 1.21 + * misrepresented as being the original software. 1.22 + * 1.23 + * 3. This notice may not be removed or altered from any source distribution. 1.24 + */ 1.25 +/* Sccsid @(#)sigrelse.c 1.8 (gritter) 1/22/06 */ 1.26 + 1.27 +#if defined (__FreeBSD__) || defined (__dietlibc__) || defined (__NetBSD__) || \ 1.28 + defined (__OpenBSD__) || defined (__DragonFly__) || defined (__APPLE__) 1.29 +#include <signal.h> 1.30 +#include "sigset.h" 1.31 + 1.32 +int 1.33 +sigrelse(int sig) 1.34 +{ 1.35 + sigset_t set, oset; 1.36 + 1.37 + if (sig <= 0) 1.38 + return -1; 1.39 + sigemptyset(&set); 1.40 + sigaddset(&set, sig); 1.41 + return sigprocmask(SIG_UNBLOCK, &set, &oset); 1.42 +} 1.43 +#endif /* __FreeBSD__ || __dietlibc__ || __NetBSD__ || __OpenBSD__ || 1.44 + __DragonFly__ || __APPLE__ */