implement new signal syscalls in FreeBSD 4.0-RELEASE, using native syscalls:

sigaction, sigprocmask, sigsuspend, and sigpending.
This commit is contained in:
onoe 2000-07-18 14:15:05 +00:00
parent a49fddc9b3
commit 0dbbd8cec4
7 changed files with 137 additions and 26 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: freebsd_misc.c,v 1.5 2000/04/21 16:18:16 minoura Exp $ */
/* $NetBSD: freebsd_misc.c,v 1.6 2000/07/18 14:15:05 onoe Exp $ */
/*
* Copyright (c) 1995 Frank van der Linden
@ -39,6 +39,8 @@
#include <sys/systm.h>
#include <sys/proc.h>
#include <sys/mount.h>
#include <sys/signal.h>
#include <sys/signalvar.h>
#include <sys/syscallargs.h>
@ -46,6 +48,7 @@
#include <compat/freebsd/freebsd_util.h>
#include <compat/freebsd/freebsd_rtprio.h>
#include <compat/freebsd/freebsd_timex.h>
#include <compat/freebsd/freebsd_signal.h>
int
freebsd_sys_msync(p, v, retval)
@ -104,3 +107,41 @@ freebsd_ntp_adjtime(p, v, retval)
return ENOSYS; /* XXX */
}
int
freebsd_sys_sigaction4(p, v, retval)
struct proc *p;
void *v;
register_t *retval;
{
struct freebsd_sys_sigaction4_args /* {
syscallarg(int) signum;
syscallarg(const struct freebsd_sigaction4 *) nsa;
syscallarg(struct freebsd_sigaction4 *) osa;
} */ *uap = v;
struct freebsd_sigaction4 nesa, oesa;
struct sigaction nbsa, obsa;
int error;
if (SCARG(uap, nsa)) {
error = copyin(SCARG(uap, nsa), &nesa, sizeof(nesa));
if (error)
return (error);
nbsa.sa_handler = nesa.sa_handler;
nbsa.sa_mask = nesa.sa_mask;
nbsa.sa_flags = nesa.sa_flags;
}
error = sigaction1(p, SCARG(uap, signum),
SCARG(uap, nsa) ? &nbsa : 0, SCARG(uap, osa) ? &obsa : 0);
if (error)
return (error);
if (SCARG(uap, osa)) {
oesa.sa_handler = obsa.sa_handler;
oesa.sa_mask = obsa.sa_mask;
oesa.sa_flags = obsa.sa_flags;
error = copyout(&oesa, SCARG(uap, osa), sizeof(oesa));
if (error)
return (error);
}
return (0);
}

View File

@ -0,0 +1,44 @@
/* $NetBSD: freebsd_signal.h,v 1.1 2000/07/18 14:15:05 onoe Exp $ */
/*
* Copyright (c) 2000 Atsushi Onoe
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed for the
* NetBSD Project. See http://www.netbsd.org/ for
* information about NetBSD.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _FREEBSD_SIG_H
#define _FREEBSD_SIG_H
struct freebsd_sigaction4 {
void (*sa_handler) __P((int)); /* signal handler */
int sa_flags; /* see signal options below */
sigset_t sa_mask; /* signal mask to apply */
};
#endif /* _FREEBSD_SIG_H */

View File

@ -1,10 +1,10 @@
/* $NetBSD: freebsd_syscall.h,v 1.33 2000/05/23 16:05:51 tv Exp $ */
/* $NetBSD: freebsd_syscall.h,v 1.34 2000/07/18 14:15:05 onoe Exp $ */
/*
* System call numbers.
*
* DO NOT EDIT-- this file is automatically generated.
* created from NetBSD: syscalls.master,v 1.26 2000/04/21 16:18:16 minoura Exp
* created from NetBSD: syscalls.master,v 1.27 2000/05/23 16:05:51 tv Exp
*/
/* syscall: "syscall" ret: "int" args: */
@ -661,4 +661,16 @@
/* syscall: "__getcwd" ret: "int" args: "char *" "size_t" */
#define FREEBSD_SYS___getcwd 326
/* syscall: "__sigprocmask14" ret: "int" args: "int" "const sigset_t *" "sigset_t *" */
#define FREEBSD_SYS___sigprocmask14 340
/* syscall: "__sigsuspend14" ret: "int" args: "const sigset_t *" */
#define FREEBSD_SYS___sigsuspend14 341
/* syscall: "sigaction4" ret: "int" args: "int" "const struct freebsd_sigaction4 *" "struct freebsd_sigaction4 *" */
#define FREEBSD_SYS_sigaction4 342
/* syscall: "__sigpending14" ret: "int" args: "const sigset_t *" */
#define FREEBSD_SYS___sigpending14 343
#define FREEBSD_SYS_MAXSYSCALL 364

View File

@ -1,10 +1,10 @@
/* $NetBSD: freebsd_syscallargs.h,v 1.33 2000/05/23 16:05:51 tv Exp $ */
/* $NetBSD: freebsd_syscallargs.h,v 1.34 2000/07/18 14:15:05 onoe Exp $ */
/*
* System call argument lists.
*
* DO NOT EDIT-- this file is automatically generated.
* created from NetBSD: syscalls.master,v 1.26 2000/04/21 16:18:16 minoura Exp
* created from NetBSD: syscalls.master,v 1.27 2000/05/23 16:05:51 tv Exp
*/
#ifndef _FREEBSD_SYS__SYSCALLARGS_H_
@ -246,6 +246,12 @@ struct freebsd_sys_lchown_args {
syscallarg(int) gid;
};
struct freebsd_sys_sigaction4_args {
syscallarg(int) signum;
syscallarg(const struct freebsd_sigaction4 *) nsa;
syscallarg(struct freebsd_sigaction4 *) osa;
};
/*
* System call prototypes.
*/
@ -504,4 +510,8 @@ int sys_getsid __P((struct proc *, void *, register_t *));
int sys_mlockall __P((struct proc *, void *, register_t *));
int sys_munlockall __P((struct proc *, void *, register_t *));
int sys___getcwd __P((struct proc *, void *, register_t *));
int sys___sigprocmask14 __P((struct proc *, void *, register_t *));
int sys___sigsuspend14 __P((struct proc *, void *, register_t *));
int freebsd_sys_sigaction4 __P((struct proc *, void *, register_t *));
int sys___sigpending14 __P((struct proc *, void *, register_t *));
#endif /* _FREEBSD_SYS__SYSCALLARGS_H_ */

View File

@ -1,10 +1,10 @@
/* $NetBSD: freebsd_syscalls.c,v 1.32 2000/05/23 16:05:51 tv Exp $ */
/* $NetBSD: freebsd_syscalls.c,v 1.33 2000/07/18 14:15:05 onoe Exp $ */
/*
* System call names.
*
* DO NOT EDIT-- this file is automatically generated.
* created from NetBSD: syscalls.master,v 1.26 2000/04/21 16:18:16 minoura Exp
* created from NetBSD: syscalls.master,v 1.27 2000/05/23 16:05:51 tv Exp
*/
#if defined(_KERNEL) && !defined(_LKM)
@ -428,10 +428,10 @@ char *freebsd_syscallnames[] = {
"#337 (unimplemented kldsym)", /* 337 = unimplemented kldsym */
"#338 (unimplemented jail)", /* 338 = unimplemented jail */
"#339 (unimplemented pioctl)", /* 339 = unimplemented pioctl */
"#340 (unimplemented 4.0 sigprocmask)", /* 340 = unimplemented 4.0 sigprocmask */
"#341 (unimplemented 4.0 sigsuspend)", /* 341 = unimplemented 4.0 sigsuspend */
"#342 (unimplemented 4.0 sigaction)", /* 342 = unimplemented 4.0 sigaction */
"#343 (unimplemented 4.0 sigpending)", /* 343 = unimplemented 4.0 sigpending */
"__sigprocmask14", /* 340 = __sigprocmask14 */
"__sigsuspend14", /* 341 = __sigsuspend14 */
"sigaction4", /* 342 = sigaction4 */
"__sigpending14", /* 343 = __sigpending14 */
"#344 (unimplemented 4.0 sigreturn)", /* 344 = unimplemented 4.0 sigreturn */
"#345 (unimplemented sigtimedwait)", /* 345 = unimplemented sigtimedwait */
"#346 (unimplemented sigwaitinfo)", /* 346 = unimplemented sigwaitinfo */

View File

@ -1,10 +1,10 @@
/* $NetBSD: freebsd_sysent.c,v 1.34 2000/05/23 16:05:51 tv Exp $ */
/* $NetBSD: freebsd_sysent.c,v 1.35 2000/07/18 14:15:05 onoe Exp $ */
/*
* System call switch table.
*
* DO NOT EDIT-- this file is automatically generated.
* created from NetBSD: syscalls.master,v 1.26 2000/04/21 16:18:16 minoura Exp
* created from NetBSD: syscalls.master,v 1.27 2000/05/23 16:05:51 tv Exp
*/
#include "opt_ktrace.h"
@ -793,14 +793,14 @@ struct sysent freebsd_sysent[] = {
sys_nosys }, /* 338 = unimplemented jail */
{ 0, 0,
sys_nosys }, /* 339 = unimplemented pioctl */
{ 0, 0,
sys_nosys }, /* 340 = unimplemented 4.0 sigprocmask */
{ 0, 0,
sys_nosys }, /* 341 = unimplemented 4.0 sigsuspend */
{ 0, 0,
sys_nosys }, /* 342 = unimplemented 4.0 sigaction */
{ 0, 0,
sys_nosys }, /* 343 = unimplemented 4.0 sigpending */
{ 3, s(struct sys___sigprocmask14_args),
sys___sigprocmask14 }, /* 340 = __sigprocmask14 */
{ 1, s(struct sys___sigsuspend14_args),
sys___sigsuspend14 }, /* 341 = __sigsuspend14 */
{ 3, s(struct freebsd_sys_sigaction4_args),
freebsd_sys_sigaction4 }, /* 342 = sigaction4 */
{ 1, s(struct sys___sigpending14_args),
sys___sigpending14 }, /* 343 = __sigpending14 */
{ 0, 0,
sys_nosys }, /* 344 = unimplemented 4.0 sigreturn */
{ 0, 0,

View File

@ -1,4 +1,4 @@
$NetBSD: syscalls.master,v 1.27 2000/05/23 16:05:51 tv Exp $
$NetBSD: syscalls.master,v 1.28 2000/07/18 14:15:05 onoe Exp $
; from: @(#)syscalls.master 8.2 (Berkeley) 1/13/94
@ -586,10 +586,14 @@
337 UNIMPL kldsym
338 UNIMPL jail
339 UNIMPL pioctl
340 UNIMPL 4.0 sigprocmask
341 UNIMPL 4.0 sigsuspend
342 UNIMPL 4.0 sigaction
343 UNIMPL 4.0 sigpending
340 NOARGS { int sys___sigprocmask14(int how, \
const sigset_t *set, \
sigset_t *oset); }
341 NOARGS { int sys___sigsuspend14(const sigset_t *set); }
342 STD { int freebsd_sys_sigaction4(int signum, \
const struct freebsd_sigaction4 *nsa, \
struct freebsd_sigaction4 *osa); }
343 NOARGS { int sys___sigpending14(const sigset_t *set); }
344 UNIMPL 4.0 sigreturn
345 UNIMPL sigtimedwait
346 UNIMPL sigwaitinfo