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:
parent
caddb025c9
commit
8f813eeb9d
23
headers/compatibility/bsd/signal.h
Normal file
23
headers/compatibility/bsd/signal.h
Normal file
@ -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_ */
|
30
headers/compatibility/bsd/sys/param.h
Normal file
30
headers/compatibility/bsd/sys/param.h
Normal file
@ -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
|
||||
issetugid.c
|
||||
progname.c
|
||||
signal.c
|
||||
stringlist.c
|
||||
unvis.c
|
||||
vis.c
|
||||
|
37
src/libs/bsd/signal.c
Normal file
37
src/libs/bsd/signal.c
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright 2006, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Axel Dörfler, axeld@pinc-software.de
|
||||
*/
|
||||
|
||||
|
||||
#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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user