annotate sigrelse.c @ 0:1493bea5ac22 0.1

Initial version of the standalone heirloom-ed
author markus schnalke <meillo@marmaro.de>
date Mon, 05 Sep 2011 16:31:35 +0200
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
1493bea5ac22 Initial version of the standalone heirloom-ed
markus schnalke <meillo@marmaro.de>
parents:
diff changeset
1 /*
1493bea5ac22 Initial version of the standalone heirloom-ed
markus schnalke <meillo@marmaro.de>
parents:
diff changeset
2 * Copyright (c) 2004 Gunnar Ritter
1493bea5ac22 Initial version of the standalone heirloom-ed
markus schnalke <meillo@marmaro.de>
parents:
diff changeset
3 *
1493bea5ac22 Initial version of the standalone heirloom-ed
markus schnalke <meillo@marmaro.de>
parents:
diff changeset
4 * This software is provided 'as-is', without any express or implied
1493bea5ac22 Initial version of the standalone heirloom-ed
markus schnalke <meillo@marmaro.de>
parents:
diff changeset
5 * warranty. In no event will the authors be held liable for any damages
1493bea5ac22 Initial version of the standalone heirloom-ed
markus schnalke <meillo@marmaro.de>
parents:
diff changeset
6 * arising from the use of this software.
1493bea5ac22 Initial version of the standalone heirloom-ed
markus schnalke <meillo@marmaro.de>
parents:
diff changeset
7 *
1493bea5ac22 Initial version of the standalone heirloom-ed
markus schnalke <meillo@marmaro.de>
parents:
diff changeset
8 * Permission is granted to anyone to use this software for any purpose,
1493bea5ac22 Initial version of the standalone heirloom-ed
markus schnalke <meillo@marmaro.de>
parents:
diff changeset
9 * including commercial applications, and to alter it and redistribute
1493bea5ac22 Initial version of the standalone heirloom-ed
markus schnalke <meillo@marmaro.de>
parents:
diff changeset
10 * it freely, subject to the following restrictions:
1493bea5ac22 Initial version of the standalone heirloom-ed
markus schnalke <meillo@marmaro.de>
parents:
diff changeset
11 *
1493bea5ac22 Initial version of the standalone heirloom-ed
markus schnalke <meillo@marmaro.de>
parents:
diff changeset
12 * 1. The origin of this software must not be misrepresented; you must not
1493bea5ac22 Initial version of the standalone heirloom-ed
markus schnalke <meillo@marmaro.de>
parents:
diff changeset
13 * claim that you wrote the original software. If you use this software
1493bea5ac22 Initial version of the standalone heirloom-ed
markus schnalke <meillo@marmaro.de>
parents:
diff changeset
14 * in a product, an acknowledgment in the product documentation would be
1493bea5ac22 Initial version of the standalone heirloom-ed
markus schnalke <meillo@marmaro.de>
parents:
diff changeset
15 * appreciated but is not required.
1493bea5ac22 Initial version of the standalone heirloom-ed
markus schnalke <meillo@marmaro.de>
parents:
diff changeset
16 *
1493bea5ac22 Initial version of the standalone heirloom-ed
markus schnalke <meillo@marmaro.de>
parents:
diff changeset
17 * 2. Altered source versions must be plainly marked as such, and must not be
1493bea5ac22 Initial version of the standalone heirloom-ed
markus schnalke <meillo@marmaro.de>
parents:
diff changeset
18 * misrepresented as being the original software.
1493bea5ac22 Initial version of the standalone heirloom-ed
markus schnalke <meillo@marmaro.de>
parents:
diff changeset
19 *
1493bea5ac22 Initial version of the standalone heirloom-ed
markus schnalke <meillo@marmaro.de>
parents:
diff changeset
20 * 3. This notice may not be removed or altered from any source distribution.
1493bea5ac22 Initial version of the standalone heirloom-ed
markus schnalke <meillo@marmaro.de>
parents:
diff changeset
21 */
1493bea5ac22 Initial version of the standalone heirloom-ed
markus schnalke <meillo@marmaro.de>
parents:
diff changeset
22 /* Sccsid @(#)sigrelse.c 1.8 (gritter) 1/22/06 */
1493bea5ac22 Initial version of the standalone heirloom-ed
markus schnalke <meillo@marmaro.de>
parents:
diff changeset
23
1493bea5ac22 Initial version of the standalone heirloom-ed
markus schnalke <meillo@marmaro.de>
parents:
diff changeset
24 #if defined (__FreeBSD__) || defined (__dietlibc__) || defined (__NetBSD__) || \
1493bea5ac22 Initial version of the standalone heirloom-ed
markus schnalke <meillo@marmaro.de>
parents:
diff changeset
25 defined (__OpenBSD__) || defined (__DragonFly__) || defined (__APPLE__)
1493bea5ac22 Initial version of the standalone heirloom-ed
markus schnalke <meillo@marmaro.de>
parents:
diff changeset
26 #include <signal.h>
1493bea5ac22 Initial version of the standalone heirloom-ed
markus schnalke <meillo@marmaro.de>
parents:
diff changeset
27 #include "sigset.h"
1493bea5ac22 Initial version of the standalone heirloom-ed
markus schnalke <meillo@marmaro.de>
parents:
diff changeset
28
1493bea5ac22 Initial version of the standalone heirloom-ed
markus schnalke <meillo@marmaro.de>
parents:
diff changeset
29 int
1493bea5ac22 Initial version of the standalone heirloom-ed
markus schnalke <meillo@marmaro.de>
parents:
diff changeset
30 sigrelse(int sig)
1493bea5ac22 Initial version of the standalone heirloom-ed
markus schnalke <meillo@marmaro.de>
parents:
diff changeset
31 {
1493bea5ac22 Initial version of the standalone heirloom-ed
markus schnalke <meillo@marmaro.de>
parents:
diff changeset
32 sigset_t set, oset;
1493bea5ac22 Initial version of the standalone heirloom-ed
markus schnalke <meillo@marmaro.de>
parents:
diff changeset
33
1493bea5ac22 Initial version of the standalone heirloom-ed
markus schnalke <meillo@marmaro.de>
parents:
diff changeset
34 if (sig <= 0)
1493bea5ac22 Initial version of the standalone heirloom-ed
markus schnalke <meillo@marmaro.de>
parents:
diff changeset
35 return -1;
1493bea5ac22 Initial version of the standalone heirloom-ed
markus schnalke <meillo@marmaro.de>
parents:
diff changeset
36 sigemptyset(&set);
1493bea5ac22 Initial version of the standalone heirloom-ed
markus schnalke <meillo@marmaro.de>
parents:
diff changeset
37 sigaddset(&set, sig);
1493bea5ac22 Initial version of the standalone heirloom-ed
markus schnalke <meillo@marmaro.de>
parents:
diff changeset
38 return sigprocmask(SIG_UNBLOCK, &set, &oset);
1493bea5ac22 Initial version of the standalone heirloom-ed
markus schnalke <meillo@marmaro.de>
parents:
diff changeset
39 }
1493bea5ac22 Initial version of the standalone heirloom-ed
markus schnalke <meillo@marmaro.de>
parents:
diff changeset
40 #endif /* __FreeBSD__ || __dietlibc__ || __NetBSD__ || __OpenBSD__ ||
1493bea5ac22 Initial version of the standalone heirloom-ed
markus schnalke <meillo@marmaro.de>
parents:
diff changeset
41 __DragonFly__ || __APPLE__ */