diff --git a/headers/compatibility/bsd/signal.h b/headers/compatibility/bsd/signal.h new file mode 100644 index 0000000000..a9ef3abf1b --- /dev/null +++ b/headers/compatibility/bsd/signal.h @@ -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 + + +#ifdef __cplusplus +extern "C" { +#endif + +int sigsetmask(int mask); +int sigblock(int mask); + +#ifdef __cplusplus +} +#endif + +#endif /* _BSD_SIGNAL_H_ */ diff --git a/headers/compatibility/bsd/sys/param.h b/headers/compatibility/bsd/sys/param.h new file mode 100644 index 0000000000..37858057bf --- /dev/null +++ b/headers/compatibility/bsd/sys/param.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 + + +#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_ */ diff --git a/src/libs/bsd/Jamfile b/src/libs/bsd/Jamfile index e1147491d9..65f9e2c032 100644 --- a/src/libs/bsd/Jamfile +++ b/src/libs/bsd/Jamfile @@ -10,6 +10,7 @@ SharedLibrary libbsd.so : getpass.c issetugid.c progname.c + signal.c stringlist.c unvis.c vis.c diff --git a/src/libs/bsd/signal.c b/src/libs/bsd/signal.c new file mode 100644 index 0000000000..2e58618bb9 --- /dev/null +++ b/src/libs/bsd/signal.c @@ -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 + + +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; +} +