Darwin's sigprocmask is an hybrid between or modern sigprocmak (old set

argument, large sigset), and the older sigprocset (no old set argument,
small sigset). It feature old set argument and small sigset.

We now emulates this correctly.
This commit is contained in:
manu 2003-12-16 16:13:59 +00:00
parent 4a58b169c3
commit 966a0ee30b
6 changed files with 79 additions and 21 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: darwin_signal.c,v 1.13 2003/12/16 13:38:25 manu Exp $ */
/* $NetBSD: darwin_signal.c,v 1.14 2003/12/16 16:13:59 manu Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: darwin_signal.c,v 1.13 2003/12/16 13:38:25 manu Exp $");
__KERNEL_RCSID(0, "$NetBSD: darwin_signal.c,v 1.14 2003/12/16 16:13:59 manu Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -188,6 +188,58 @@ darwin_sigfilter(l, ksi)
return EINVAL;
}
int
darwin_sys_sigprocmask(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
struct darwin_sys_sigprocmask_args /* {
syscallarg(int) how;
syscallarg(sigset13_t *) set;
syscallarg(sigset13_t *) oset;
} */ *uap = v;
struct sys___sigprocmask14_args cup;
struct proc *p = l->l_proc;
int error;
sigset13_t kdset, kdoset;
sigset_t kbset, kboset;
sigset_t *ubset;
sigset_t *uboset = NULL;
caddr_t sg = stackgap_init(p, 0);
ubset = stackgap_alloc(p, &sg, sizeof(*ubset));
if (SCARG(uap, oset) != NULL)
uboset = stackgap_alloc(p, &sg, sizeof(*uboset));
if ((error = copyin(SCARG(uap, set), &kdset, sizeof(kdset))) != 0)
return error;
native_sigset13_to_sigset(&kdset, &kbset);
if ((error = copyout(&kbset, ubset, sizeof(kbset))) != 0)
return error;
SCARG(&cup, how) = SCARG(uap, how);
SCARG(&cup, set) = ubset;
SCARG(&cup, oset) = uboset;
if ((error = sys___sigprocmask14(l, &cup, retval)) != 0)
return error;
if (SCARG(uap, oset) != NULL) {
if ((error = copyin(uboset, &kboset, sizeof(kboset))) != 0)
return error;
native_sigset_to_sigset13(&kboset, &kdoset);
if ((error = copyout(&kdoset,
SCARG(uap, oset), sizeof(kdoset))) != 0)
return error;
}
return 0;
}
void
native_to_darwin_siginfo(ksi, dsi)
const struct ksiginfo *ksi;

View File

@ -1,10 +1,10 @@
/* $NetBSD: darwin_syscall.h,v 1.35 2003/12/04 23:59:50 manu Exp $ */
/* $NetBSD: darwin_syscall.h,v 1.36 2003/12/16 16:13:59 manu Exp $ */
/*
* System call numbers.
*
* DO NOT EDIT-- this file is automatically generated.
* created from NetBSD: syscalls.master,v 1.18 2003/11/20 07:12:35 manu Exp
* created from NetBSD: syscalls.master,v 1.19 2003/12/04 23:59:50 manu Exp
*/
/* syscall: "syscall" ret: "int" args: "int" "..." */
@ -125,8 +125,8 @@
#define DARWIN_SYS_getgid 47
#endif
/* syscall: "sigprocmask13" ret: "int" args: "int" "int" */
#define DARWIN_SYS_sigprocmask13 48
/* syscall: "sigprocmask" ret: "int" args: "int" "sigset13_t *" "sigset13_t *" */
#define DARWIN_SYS_sigprocmask 48
/* syscall: "__getlogin" ret: "int" args: "char *" "size_t" */
#define DARWIN_SYS___getlogin 49

View File

@ -1,10 +1,10 @@
/* $NetBSD: darwin_syscallargs.h,v 1.35 2003/12/04 23:59:50 manu Exp $ */
/* $NetBSD: darwin_syscallargs.h,v 1.36 2003/12/16 16:13:59 manu Exp $ */
/*
* System call argument lists.
*
* DO NOT EDIT-- this file is automatically generated.
* created from NetBSD: syscalls.master,v 1.18 2003/11/20 07:12:35 manu Exp
* created from NetBSD: syscalls.master,v 1.19 2003/12/04 23:59:50 manu Exp
*/
#ifndef _DARWIN_SYS__SYSCALLARGS_H_
@ -128,6 +128,12 @@ struct darwin_sys_sigaction_args {
#else
#endif
struct darwin_sys_sigprocmask_args {
syscallarg(int) how;
syscallarg(sigset13_t *) set;
syscallarg(sigset13_t *) oset;
};
struct bsd_sys_acct_args {
syscallarg(const char *) path;
};
@ -405,7 +411,7 @@ int sys_getgid_with_egid(struct lwp *, void *, register_t *);
int sys_getgid(struct lwp *, void *, register_t *);
#endif
int compat_13_sys_sigprocmask(struct lwp *, void *, register_t *);
int darwin_sys_sigprocmask(struct lwp *, void *, register_t *);
int sys___getlogin(struct lwp *, void *, register_t *);

View File

@ -1,14 +1,14 @@
/* $NetBSD: darwin_syscalls.c,v 1.35 2003/12/04 23:59:50 manu Exp $ */
/* $NetBSD: darwin_syscalls.c,v 1.36 2003/12/16 16:13:59 manu Exp $ */
/*
* System call names.
*
* DO NOT EDIT-- this file is automatically generated.
* created from NetBSD: syscalls.master,v 1.18 2003/11/20 07:12:35 manu Exp
* created from NetBSD: syscalls.master,v 1.19 2003/12/04 23:59:50 manu Exp
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: darwin_syscalls.c,v 1.35 2003/12/04 23:59:50 manu Exp $");
__KERNEL_RCSID(0, "$NetBSD: darwin_syscalls.c,v 1.36 2003/12/16 16:13:59 manu Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ktrace.h"
@ -93,7 +93,7 @@ const char *const darwin_syscallnames[] = {
#else
"getgid", /* 47 = getgid */
#endif
"sigprocmask13", /* 48 = sigprocmask13 */
"sigprocmask", /* 48 = sigprocmask */
"__getlogin", /* 49 = __getlogin */
"__setlogin", /* 50 = __setlogin */
"acct", /* 51 = acct */

View File

@ -1,14 +1,14 @@
/* $NetBSD: darwin_sysent.c,v 1.36 2003/12/04 23:59:50 manu Exp $ */
/* $NetBSD: darwin_sysent.c,v 1.37 2003/12/16 16:13:59 manu Exp $ */
/*
* System call switch table.
*
* DO NOT EDIT-- this file is automatically generated.
* created from NetBSD: syscalls.master,v 1.18 2003/11/20 07:12:35 manu Exp
* created from NetBSD: syscalls.master,v 1.19 2003/12/04 23:59:50 manu Exp
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: darwin_sysent.c,v 1.36 2003/12/04 23:59:50 manu Exp $");
__KERNEL_RCSID(0, "$NetBSD: darwin_sysent.c,v 1.37 2003/12/16 16:13:59 manu Exp $");
#include "opt_ktrace.h"
#include "opt_nfsserver.h"
@ -144,8 +144,8 @@ struct sysent darwin_sysent[] = {
{ 0, 0, 0,
sys_getgid }, /* 47 = getgid */
#endif
{ 2, s(struct compat_13_sys_sigprocmask_args), 0,
compat_13_sys_sigprocmask }, /* 48 = sigprocmask13 */
{ 3, s(struct darwin_sys_sigprocmask_args), 0,
darwin_sys_sigprocmask }, /* 48 = sigprocmask */
{ 2, s(struct sys___getlogin_args), 0,
sys___getlogin }, /* 49 = __getlogin */
{ 1, s(struct sys___setlogin_args), 0,

View File

@ -1,4 +1,4 @@
$NetBSD: syscalls.master,v 1.19 2003/12/04 23:59:50 manu Exp $
$NetBSD: syscalls.master,v 1.20 2003/12/16 16:13:59 manu Exp $
; @(#)syscalls.master 8.2 (Berkeley) 1/13/94
@ -150,8 +150,8 @@
#else
47 NOARGS { gid_t sys_getgid(void); }
#endif
48 NOARGS { int compat_13_sys_sigprocmask(int how, \
int mask); } sigprocmask13
48 STD { int darwin_sys_sigprocmask(int how, \
sigset13_t *set, sigset13_t *oset); }
49 NOARGS { int sys___getlogin(char *namebuf, size_t namelen); }
50 NOARGS { int sys___setlogin(const char *namebuf); }
51 NODEF { int bsd_sys_acct(const char *path); }