More tweaks to the libbsd.so compatibility library:
* added sigsetmask(), and sigblock() * added ALIGN(), ALIGNBYTES, and howmany() macros git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19493 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2006, Haiku, Inc. All Rights Reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#ifndef _BSD_SIGNAL_H_
|
||||||
|
#define _BSD_SIGNAL_H_
|
||||||
|
|
||||||
|
|
||||||
|
#include_next <signal.h>
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int sigsetmask(int mask);
|
||||||
|
int sigblock(int mask);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _BSD_SIGNAL_H_ */
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2006, Haiku, Inc. All Rights Reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#ifndef _BSD_SYS_PARAM_H_
|
||||||
|
#define _BSD_SYS_PARAM_H_
|
||||||
|
|
||||||
|
|
||||||
|
#include_next <sys/param.h>
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _ALIGNBYTES
|
||||||
|
# define _ALIGNBYTES 7
|
||||||
|
#endif
|
||||||
|
#ifndef _ALIGN
|
||||||
|
# define _ALIGN(p) (((unsigned)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ALIGNBYTES
|
||||||
|
# define ALIGNBYTES _ALIGNBYTES
|
||||||
|
#endif
|
||||||
|
#ifndef ALIGN
|
||||||
|
# define ALIGN(p) _ALIGN(p)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef howmany
|
||||||
|
# define howmany(x, y) (((x) + ((y) - 1)) / (y))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _BSD_SYS_PARAM_H_ */
|
||||||
@@ -10,6 +10,7 @@ SharedLibrary libbsd.so :
|
|||||||
getpass.c
|
getpass.c
|
||||||
issetugid.c
|
issetugid.c
|
||||||
progname.c
|
progname.c
|
||||||
|
signal.c
|
||||||
stringlist.c
|
stringlist.c
|
||||||
unvis.c
|
unvis.c
|
||||||
vis.c
|
vis.c
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2006, Haiku, Inc. All Rights Reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Axel Dörfler, [email protected]
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
sigsetmask(int mask)
|
||||||
|
{
|
||||||
|
sigset_t set = mask;
|
||||||
|
sigset_t oset;
|
||||||
|
|
||||||
|
if (sigprocmask(SIG_SETMASK, &set, &oset) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return (int)oset;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
sigblock(int mask)
|
||||||
|
{
|
||||||
|
sigset_t set = mask;
|
||||||
|
sigset_t oset;
|
||||||
|
|
||||||
|
if (sigprocmask(SIG_BLOCK, &set, &oset) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return (int)oset;
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user