提交 a1990e1e 编写于 作者: R rofl0r

add sigandset and sigorset (needed for qemu)

上级 0182c287
......@@ -220,6 +220,9 @@ typedef void (*sig_t)(int);
typedef void (*sighandler_t)(int);
void (*bsd_signal(int, void (*)(int)))(int);
int sigisemptyset(const sigset_t *);
int sigorset (sigset_t *, sigset_t *, sigset_t *);
int sigandset(sigset_t *, sigset_t *, sigset_t *);
#define SA_NOMASK SA_NODEFER
#define SA_ONESHOT SA_RESETHAND
#endif
......
#define _GNU_SOURCE
#include <signal.h>
#include <errno.h>
#define SST_SIZE (sizeof(sigset_t) / sizeof(long))
int sigandset(sigset_t *dest, sigset_t *left, sigset_t *right)
{
if(!dest || !left || !right) {
errno = EINVAL;
return -1;
}
unsigned long i = 0, *d = (void*) dest, *l = (void*) left, *r = (void*) right;
for(; i < SST_SIZE; i++) d[i] = l[i] & r[i];
return 0;
}
#define _GNU_SOURCE
#include <signal.h>
#include <errno.h>
#define SST_SIZE (sizeof(sigset_t) / sizeof(long))
int sigorset(sigset_t *dest, sigset_t *left, sigset_t *right)
{
if(!dest || !left || !right) {
errno = EINVAL;
return -1;
}
unsigned long i = 0, *d = (void*) dest, *l = (void*) left, *r = (void*) right;
for(; i < SST_SIZE; i++) d[i] = l[i] | r[i];
return 0;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册