Mercurial > illumos > illumos-gate
changeset 10927:ac35db8a7412
PSARC 2009/595 delete ssig system call trap
6896743 The ancient SVR3 ssig() system call trap should be deleted
author | Roger A. Faulkner <Roger.Faulkner@Sun.COM> |
---|---|
date | Mon, 02 Nov 2009 06:49:25 -0800 |
parents | 0f7be8ada1ff |
children | eb060666c73f |
files | usr/src/cmd/truss/actions.c usr/src/cmd/truss/codes.c usr/src/cmd/truss/print.c usr/src/cmd/truss/print.h usr/src/cmd/truss/proto.h usr/src/cmd/truss/systable.c usr/src/uts/common/Makefile.files usr/src/uts/common/os/sysent.c usr/src/uts/common/sys/iso/signal_iso.h usr/src/uts/common/sys/syscall.h usr/src/uts/common/syscall/ssig.c usr/src/uts/intel/os/name_to_sysnum usr/src/uts/sparc/os/name_to_sysnum |
diffstat | 13 files changed, 40 insertions(+), 339 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/cmd/truss/actions.c Mon Nov 02 10:34:51 2009 +0100 +++ b/usr/src/cmd/truss/actions.c Mon Nov 02 06:49:25 2009 -0800 @@ -20,15 +20,13 @@ */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* Copyright (c) 1988 AT&T */ /* All Rights Reserved */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <stdio.h> #include <stdlib.h> #include <unistd.h> @@ -96,7 +94,7 @@ (void) fputc('\t', stdout); if (Lsp->pr_flags & PR_VFORKP) (void) fputs("(waiting for child to exit()/exec()...)\n", - stdout); + stdout); else (void) fputs("(sleeping...)\n", stdout); pri->length = 0; @@ -134,7 +132,7 @@ putpname(pri); timestamp(pri); (void) printf(" Continued with signal #%d, %s", - sig, signame(pri, sig)); + sig, signame(pri, sig)); if (Lsp->pr_action.sa_handler == SIG_DFL) (void) printf(" [default]"); else if (Lsp->pr_action.sa_handler == SIG_IGN) @@ -174,11 +172,11 @@ putpname(pri); timestamp(pri); (void) printf(" Stopped by signal #%d, %s", - sig, signame(pri, sig)); + sig, signame(pri, sig)); if ((Lsp->pr_flags & PR_ASLEEP) && (sys = Lsp->pr_syscall) > 0 && sys <= PRMAXSYS) (void) printf(", in %s()", - sysname(pri, sys, getsubcode(pri))); + sysname(pri, sys, getsubcode(pri))); (void) fputc('\n', stdout); Flush(); } @@ -252,11 +250,11 @@ putpname(pri); timestamp(pri); (void) printf(" Received signal #%d, %s", - sig, signame(pri, sig)); + sig, signame(pri, sig)); if ((Lsp->pr_flags & PR_ASLEEP) && (sys = Lsp->pr_syscall) > 0 && sys <= PRMAXSYS) (void) printf(", in %s()", - sysname(pri, sys, getsubcode(pri))); + sysname(pri, sys, getsubcode(pri))); if (Lsp->pr_action.sa_handler == SIG_DFL) (void) printf(" [default]"); else if (Lsp->pr_action.sa_handler == SIG_IGN) @@ -296,12 +294,12 @@ timestamp(pri); (void) printf(" Incurred fault #%d, %s %%pc = 0x%.8lX", - flt, proc_fltname(flt, pri->flt_name, sizeof (pri->flt_name)), - (long)Lsp->pr_reg[R_PC]); + flt, proc_fltname(flt, pri->flt_name, sizeof (pri->flt_name)), + (long)Lsp->pr_reg[R_PC]); if (flt == FLTPAGE) (void) printf(" addr = 0x%.8lX", - (long)Lsp->pr_info.si_addr); + (long)Lsp->pr_info.si_addr); (void) fputc('\n', stdout); if (Lsp->pr_info.si_signo != 0) print_siginfo(pri, &Lsp->pr_info); @@ -329,7 +327,7 @@ (void) memset(pri->sys_args, 0, sizeof (pri->sys_args)); if (what != Lsp->pr_syscall) { /* assertion */ (void) printf("%s\t*** Inconsistent syscall: %d vs %d ***\n", - pri->pname, what, Lsp->pr_syscall); + pri->pname, what, Lsp->pr_syscall); } nargs = Lsp->pr_nsysarg; for (i = 0; @@ -422,11 +420,11 @@ argv = (long)psinfo.pr_argv; if (data_model == PR_MODEL_LP64) (void) Pread(Proc, &offset, - sizeof (offset), argv); + sizeof (offset), argv); else { offset32 = 0; (void) Pread(Proc, &offset32, - sizeof (offset32), argv); + sizeof (offset32), argv); offset = offset32; } } @@ -440,7 +438,7 @@ while (len >= pri->sys_psize) { free(pri->sys_path); pri->sys_path = my_malloc(pri->sys_psize *= 2, - "pathname buffer"); + "pathname buffer"); } (void) strcpy(pri->sys_path, s); /* remember pathname */ } @@ -472,7 +470,7 @@ name = sysname(pri, what, raw? -1 : subcode); grow(pri, strlen(name) + 1); pri->sys_leng = snprintf(pri->sys_string, pri->sys_ssize, - "%s(", name); + "%s(", name); for (i = 0; i < nargs; i++) { arg = pri->sys_args[i]; x = stp->arg[i]; @@ -486,7 +484,7 @@ outstring(pri, ", "); if (x == LLO) (*Print[x])(pri, raw, arg, - pri->sys_args[++i]); + pri->sys_args[++i]); else (*Print[x])(pri, raw, arg); /* @@ -614,13 +612,13 @@ pri->length += 8; } pri->length += - 7 + printf("\t(returning as child ...)"); + 7 + printf("\t(returning as child ...)"); } if (what == SYS_lwp_create && pri->Errno == 0 && pri->Rval1 == 0) { pri->length &= ~07; pri->length += - 7 + printf("\t(returning as new lwp ...)"); + 7 + printf("\t(returning as new lwp ...)"); } if (pri->Errno != 0 || (what != SYS_exec && what != SYS_execve)) { @@ -722,16 +720,6 @@ fmt = "= 0x%.8lX"; } break; - case SYS_signal: - if (raw) - /* EMPTY */; - else if (rv1 == (int)SIG_DFL) - fmt = "= SIG_DFL"; - else if (rv1 == (int)SIG_IGN) - fmt = "= SIG_IGN"; - else if (rv1 == (int)SIG_HOLD) - fmt = "= SIG_HOLD"; - break; case SYS_sigtimedwait: if (raw) /* EMPTY */; @@ -860,8 +848,8 @@ if (ISREAD(what) || ISWRITE(what)) { if (pri->iob_buf[0] != '\0') (void) printf("%s 0x%.8lX: %s\n", - pri->pname, pri->sys_args[1], - pri->iob_buf); + pri->pname, pri->sys_args[1], + pri->iob_buf); } } @@ -928,7 +916,7 @@ if (s != (char *)NULL) (void) printf("%s 0x%.8lX: \"%s\"\n", - pri->pname, addr, s); + pri->pname, addr, s); } } } @@ -958,14 +946,14 @@ if (data_model == PR_MODEL_LP64) { int64_t xnargs; ap = (long)(Lsp->pr_reg[R_SP]) + 16 * sizeof (int64_t) - + STACK_BIAS; + + STACK_BIAS; fail = (Pread(Proc, &xnargs, sizeof (xnargs), ap) != - sizeof (xnargs)); + sizeof (xnargs)); nargs = (int)xnargs; } else { ap = (long)(Lsp->pr_reg[R_SP]) + 16 * sizeof (int32_t); fail = (Pread(Proc, &nargs, sizeof (nargs), ap) != - sizeof (nargs)); + sizeof (nargs)); } ap += ptrsize; #endif /* sparc */ @@ -1034,7 +1022,7 @@ while (!interrupt) { if (Pread(Proc, argaddr, ptrsize, ap) != ptrsize) { (void) printf("\n%s\t*** Bad argument list? ***\n", - pri->pname); + pri->pname); return; } ap += ptrsize;
--- a/usr/src/cmd/truss/codes.c Mon Nov 02 10:34:51 2009 +0100 +++ b/usr/src/cmd/truss/codes.c Mon Nov 02 06:49:25 2009 -0800 @@ -1903,34 +1903,6 @@ return (str); } -const char * -sigarg(private_t *pri, int arg) -{ - char *str = NULL; - int sig = (arg & SIGNO_MASK); - - str = pri->code_buf; - arg &= ~SIGNO_MASK; - if (arg & ~(SIGDEFER|SIGHOLD|SIGRELSE|SIGIGNORE|SIGPAUSE)) - (void) snprintf(pri->code_buf, sizeof (pri->code_buf), - "%s|0x%X", signame(pri, sig), arg); - else { - (void) strcpy(str, signame(pri, sig)); - if (arg & SIGDEFER) - (void) strcat(str, "|SIGDEFER"); - if (arg & SIGHOLD) - (void) strcat(str, "|SIGHOLD"); - if (arg & SIGRELSE) - (void) strcat(str, "|SIGRELSE"); - if (arg & SIGIGNORE) - (void) strcat(str, "|SIGIGNORE"); - if (arg & SIGPAUSE) - (void) strcat(str, "|SIGPAUSE"); - } - - return ((const char *)str); -} - #define ALL_O_FLAGS \ (O_NDELAY|O_APPEND|O_SYNC|O_DSYNC|O_NONBLOCK|O_CREAT|O_TRUNC\ |O_EXCL|O_NOCTTY|O_LARGEFILE|O_RSYNC|O_XATTR|O_NOFOLLOW|O_NOLINKS)
--- a/usr/src/cmd/truss/print.c Mon Nov 02 10:34:51 2009 +0100 +++ b/usr/src/cmd/truss/print.c Mon Nov 02 06:49:25 2009 -0800 @@ -491,43 +491,9 @@ } void -prt_sig(private_t *pri, int raw, long val) /* print signal name plus flags */ -{ - const char *s = raw? NULL : sigarg(pri, (int)val); - - if (s == NULL) - prt_hex(pri, 0, val); - else - outstring(pri, s); -} - -/* print signal name, masked with SIGNO_MASK */ -void -prt_six(private_t *pri, int raw, long val) +prt_sig(private_t *pri, int raw, long val) /* print signal name */ { - const char *s = raw? NULL : sigarg(pri, (int)val & SIGNO_MASK); - - if (s == NULL) - prt_hex(pri, 0, val); - else - outstring(pri, s); -} - -void -prt_act(private_t *pri, int raw, long val) /* print signal action value */ -{ - const char *s; - - if (raw) - s = NULL; - else if (val == (int)SIG_DFL) - s = "SIG_DFL"; - else if (val == (int)SIG_IGN) - s = "SIG_IGN"; - else if (val == (int)SIG_HOLD) - s = "SIG_HOLD"; - else - s = NULL; + const char *s = raw? NULL : signame(pri, (int)val); if (s == NULL) prt_hex(pri, 0, val); @@ -2659,7 +2625,7 @@ prt_uts, /* UTS -- print utssys code */ prt_opn, /* OPN -- print open code */ prt_sig, /* SIG -- print signal name plus flags */ - prt_act, /* ACT -- print signal action value */ + prt_nov, /* Was ACT, now available for reuse */ prt_msc, /* MSC -- print msgsys command */ prt_msf, /* MSF -- print msgsys flags */ prt_smc, /* SMC -- print semsys command */ @@ -2671,7 +2637,7 @@ prt_rst, /* RST -- print string returned by syscall */ prt_smf, /* SMF -- print streams message flags */ prt_ioa, /* IOA -- print ioctl argument */ - prt_six, /* SIX -- print signal, masked with SIGNO_MASK */ + prt_nov, /* Was SIX, now available for reuse */ prt_mtf, /* MTF -- print mount flags */ prt_mft, /* MFT -- print mount file system type */ prt_iob, /* IOB -- print contents of I/O buffer */
--- a/usr/src/cmd/truss/print.h Mon Nov 02 10:34:51 2009 +0100 +++ b/usr/src/cmd/truss/print.h Mon Nov 02 06:49:25 2009 -0800 @@ -49,7 +49,7 @@ #define UTS 9 /* print utssys code */ #define OPN 10 /* print open code */ #define SIG 11 /* print signal name plus flags */ -#define ACT 12 /* print signal action value */ +/* Number 12 now available for reuse */ #define MSC 13 /* print msgsys command */ #define MSF 14 /* print msgsys flags */ #define SMC 15 /* print semsys command */ @@ -61,7 +61,7 @@ #define RST 21 /* print string returned by sys call */ #define SMF 22 /* print streams message flags */ #define IOA 23 /* print ioctl argument */ -#define SIX 24 /* print signal, masked with SIGNO_MASK */ +/* Number 24 now available for reuse */ #define MTF 25 /* print mount flags */ #define MFT 26 /* print mount file system type */ #define IOB 27 /* print contents of I/O buffer */
--- a/usr/src/cmd/truss/proto.h Mon Nov 02 10:34:51 2009 +0100 +++ b/usr/src/cmd/truss/proto.h Mon Nov 02 06:49:25 2009 -0800 @@ -18,20 +18,18 @@ * * CDDL HEADER END */ + /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ - #ifndef _PROTO_H #define _PROTO_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/procset.h> #ifdef __cplusplus @@ -71,7 +69,6 @@ extern const char *plockname(int); extern const char *si86name(int); extern const char *utscode(int); -extern const char *sigarg(private_t *, int); extern const char *openarg(private_t *, int); extern const char *whencearg(int); extern const char *msgflags(private_t *, int);
--- a/usr/src/cmd/truss/systable.c Mon Nov 02 10:34:51 2009 +0100 +++ b/usr/src/cmd/truss/systable.c Mon Nov 02 06:49:25 2009 -0800 @@ -265,7 +265,7 @@ {"plock", 1, DEC, NOV, PLK}, /* 45 */ {"setgid", 1, DEC, NOV, UNS}, /* 46 */ {"getgid", 0, UNS, UNS}, /* 47 */ -{"signal", 2, HEX, NOV, SIG, ACT}, /* 48 */ +{ NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX}, {"msgsys", 6, DEC, NOV, DEC, DEC, DEC, DEC, DEC, DEC}, /* 49 */ {"sysi86", 4, HEX, NOV, S86, HEX, HEX, HEX, DEC, DEC}, /* 50 */ {"acct", 1, DEC, NOV, STG}, /* 51 */ @@ -506,16 +506,6 @@ }; #define NFCNTLCODE (sizeof (fcntltable) / sizeof (struct systable)) -const struct systable sigtable[] = { -{"signal", 2, HEX, NOV, SIG, ACT}, /* 0 */ -{"sigset", 2, HEX, NOV, SIX, ACT}, /* 1 */ -{"sighold", 1, HEX, NOV, SIX}, /* 2 */ -{"sigrelse", 1, HEX, NOV, SIX}, /* 3 */ -{"sigignore", 1, HEX, NOV, SIX}, /* 4 */ -{"sigpause", 1, HEX, NOV, SIX}, /* 5 */ -}; -#define NSIGCODE (sizeof (sigtable) / sizeof (struct systable)) - const struct systable msgtable[] = { {"msgget", 3, DEC, NOV, HID, KEY, MSF}, /* 0 */ {"msgctl", 4, DEC, NOV, HID, DEC, MSC, HEX}, /* 1 */ @@ -859,11 +849,6 @@ { "getpgid", SYS_pgrpsys }, { "setpgid", SYS_pgrpsys }, { "getegid", SYS_getgid }, - { "sigset", SYS_signal }, - { "sighold", SYS_signal }, - { "sigrelse", SYS_signal }, - { "sigignore", SYS_signal }, - { "sigpause", SYS_signal }, { "msgget", SYS_msgsys }, { "msgctl", SYS_msgsys }, { "msgctl64", SYS_msgsys }, @@ -1023,10 +1008,6 @@ if ((unsigned)subcode < NOPEN64CODE) stp = &open64table[subcode]; break; - case SYS_signal: /* signal() + sigset() family */ - if ((unsigned)subcode < NSIGCODE) - stp = &sigtable[subcode]; - break; case SYS_msgsys: /* msgsys() */ if ((unsigned)subcode < NMSGCODE) stp = &msgtable[subcode]; @@ -1264,16 +1245,6 @@ subcode = arg0; } break; - case SYS_signal: /* signal() + sigset() family */ - switch (arg0 & ~SIGNO_MASK) { - default: subcode = 0; break; - case SIGDEFER: subcode = 1; break; - case SIGHOLD: subcode = 2; break; - case SIGRELSE: subcode = 3; break; - case SIGIGNORE: subcode = 4; break; - case SIGPAUSE: subcode = 5; break; - } - break; case SYS_kaio: /* kaio() */ subcode = arg0 & ~AIO_POLL_BIT; break; @@ -1348,7 +1319,6 @@ return (PRMAXSYS + 1 + NOPENCODE - 1 + NOPEN64CODE - 1 - + NSIGCODE - 1 + NMSGCODE - 1 + NSEMCODE - 1 + NSHMCODE - 1 @@ -1394,8 +1364,6 @@ return (NOPENCODE); case SYS_open64: return (NOPEN64CODE); - case SYS_signal: /* signal() + sigset() family */ - return (NSIGCODE); case SYS_msgsys: /* msgsys() */ return (NMSGCODE); case SYS_semsys: /* semsys() */
--- a/usr/src/uts/common/Makefile.files Mon Nov 02 10:34:51 2009 +0100 +++ b/usr/src/uts/common/Makefile.files Mon Nov 02 06:49:25 2009 -0800 @@ -310,7 +310,6 @@ sock_conf.o \ space.o \ sscanf.o \ - ssig.o \ stat.o \ statfs.o \ statvfs.o \
--- a/usr/src/uts/common/os/sysent.c Mon Nov 02 10:34:51 2009 +0100 +++ b/usr/src/uts/common/os/sysent.c Mon Nov 02 06:49:25 2009 -0800 @@ -109,7 +109,6 @@ int setuid(); uintptr_t shmsys(); uint64_t sidsys(); -int ssig(); int sigprocmask(); int sigsuspend(); int sigaltstack(); @@ -486,7 +485,7 @@ /* 45 */ SYSENT_LOADABLE(), /* (was proc lock) */ /* 46 */ SYSENT_CI("setgid", setgid, 1), /* 47 */ SYSENT_2CI("getgid", getgid, 0), - /* 48 */ SYSENT_CI("sig", ssig, 2), + /* 48 */ SYSENT_LOADABLE(), /* (was ssig) */ /* 49 */ SYSENT_LOADABLE(), /* msgsys */ /* 50 */ IF_x86( SYSENT_CI("sysi86", sysi86, 4), @@ -889,7 +888,7 @@ /* 45 */ SYSENT_LOADABLE32(), /* (was proc lock) */ /* 46 */ SYSENT_CI("setgid", setgid, 1), /* 47 */ SYSENT_2CI("getgid", getgid, 0), - /* 48 */ SYSENT_CI("sig", ssig, 2), + /* 48 */ SYSENT_LOADABLE32(), /* (was ssig) */ /* 49 */ SYSENT_LOADABLE32(), /* msgsys */ /* 50 */ IF_386_ABI( SYSENT_CI("sysi86", sysi86, 4),
--- a/usr/src/uts/common/sys/iso/signal_iso.h Mon Nov 02 10:34:51 2009 +0100 +++ b/usr/src/uts/common/sys/iso/signal_iso.h Mon Nov 02 06:49:25 2009 -0800 @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,15 +18,15 @@ * * CDDL HEADER END */ + /* - * Copyright 1993-2003 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ - /* * An application should not include this header directly. Instead it * should be included only through the inclusion of other Sun headers. @@ -43,8 +42,6 @@ #ifndef _SYS_SIGNAL_ISO_H #define _SYS_SIGNAL_ISO_H -#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 11.44 */ - #include <sys/unistd.h> /* needed for _SC_SIGRT_MIN/MAX */ #ifdef __cplusplus @@ -133,13 +130,6 @@ #define SIG_UNBLOCK 2 #define SIG_SETMASK 3 -#define SIGNO_MASK 0xFF -#define SIGDEFER 0x100 -#define SIGHOLD 0x200 -#define SIGRELSE 0x400 -#define SIGIGNORE 0x800 -#define SIGPAUSE 0x1000 - #ifdef __cplusplus } #endif
--- a/usr/src/uts/common/sys/syscall.h Mon Nov 02 10:34:51 2009 +0100 +++ b/usr/src/uts/common/sys/syscall.h Mon Nov 02 06:49:25 2009 -0800 @@ -104,17 +104,6 @@ #define SYS_plock 45 #define SYS_setgid 46 #define SYS_getgid 47 -#define SYS_signal 48 - /* - * subcodes: - * signal(sig, f) :: signal(sig, f) ((sig&SIGNO_MASK) == sig) - * sigset(sig, f) :: signal(sig|SIGDEFER, f) - * sighold(sig) :: signal(sig|SIGHOLD) - * sigrelse(sig) :: signal(sig|SIGRELSE) - * sigignore(sig) :: signal(sig|SIGIGNORE) - * sigpause(sig) :: signal(sig|SIGPAUSE) - * see <sys/signal.h> - */ #define SYS_msgsys 49 /* * subcodes:
--- a/usr/src/uts/common/syscall/ssig.c Mon Nov 02 10:34:51 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,165 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ - -#include <sys/param.h> -#include <sys/types.h> -#include <sys/sysmacros.h> -#include <sys/systm.h> -#include <sys/user.h> -#include <sys/errno.h> -#include <sys/proc.h> -#include <sys/fault.h> -#include <sys/procset.h> -#include <sys/signal.h> -#include <sys/schedctl.h> -#include <sys/debug.h> - - -/* - * ssig() is the old common entry for signal, sigset, sighold, - * sigrelse, sigignore and sigpause. - * - * All of these interfaces have been reimplemented in libc using - * calls to sigaction, sigsuspend and sigprocmask. - * - * This kernel interface is no longer called by any application - * that is dynamically linked with libc. It exists solely for - * the benefit of really old statically-linked applications. - * It should be removed from the system. - */ - -int -ssig(int signo, void (*func)()) -{ - int sig; - struct proc *p; - int flags; - int retval = 0; - int sigcld_look = 0; - - sig = signo & SIGNO_MASK; - - if (sig <= 0 || sig >= NSIG || sigismember(&cantmask, sig)) - return (set_errno(EINVAL)); - - p = ttoproc(curthread); - mutex_enter(&p->p_lock); - schedctl_finish_sigblock(curthread); - switch (signo & ~SIGNO_MASK) { - - case SIGHOLD: /* sighold */ - sigaddset(&curthread->t_hold, sig); - mutex_exit(&p->p_lock); - return (0); - - case SIGRELSE: /* sigrelse */ - sigdelset(&curthread->t_hold, sig); - curthread->t_sig_check = 1; /* so ISSIG will see release */ - mutex_exit(&p->p_lock); - return (0); - - case SIGPAUSE: /* sigpause */ - sigdelset(&curthread->t_hold, sig); - curthread->t_sig_check = 1; /* so ISSIG will see release */ - /* pause() */ - while (cv_wait_sig_swap(&curthread->t_delay_cv, &p->p_lock)) - ; - mutex_exit(&p->p_lock); - return (set_errno(EINTR)); - - case SIGIGNORE: /* signore */ - sigdelset(&curthread->t_hold, sig); - curthread->t_sig_check = 1; /* so ISSIG will see release */ - func = SIG_IGN; - flags = 0; - break; - - case SIGDEFER: /* sigset */ - if (sigismember(&curthread->t_hold, sig)) - retval = (int)SIG_HOLD; - else - retval = (int)(uintptr_t)PTOU(curproc)->u_signal[sig-1]; - if (func == SIG_HOLD) { - sigaddset(&curthread->t_hold, sig); - mutex_exit(&p->p_lock); - return (retval); - } - -#if defined(__sparc) - /* - * Check alignment of handler - */ - if (func != SIG_IGN && func != SIG_DFL && - ((uintptr_t)func & 0x3) != 0) { - mutex_exit(&p->p_lock); - return (set_errno(EINVAL)); - } -#endif - sigdelset(&curthread->t_hold, sig); - curthread->t_sig_check = 1; /* so post_syscall sees it */ - flags = 0; - break; - - case 0: /* signal */ -#if defined(__sparc) - /* - * Check alignment of handler - */ - if (func != SIG_IGN && func != SIG_DFL && - ((uintptr_t)func & 0x3) != 0) { - mutex_exit(&p->p_lock); - return (set_errno(EINVAL)); - } -#endif - retval = (int)(uintptr_t)PTOU(curproc)->u_signal[sig-1]; - flags = SA_RESETHAND|SA_NODEFER; - break; - - default: /* error */ - mutex_exit(&p->p_lock); - return (set_errno(EINVAL)); - } - - if (sigismember(&stopdefault, sig)) - flags |= SA_RESTART; - else if (sig == SIGCLD) { - flags |= SA_NOCLDSTOP; - if (func == SIG_IGN) - flags |= SA_NOCLDWAIT; - sigcld_look = 1; - } - - setsigact(sig, func, nullsmask, flags); - mutex_exit(&p->p_lock); - - if (sigcld_look) - sigcld_repost(); - - return (retval); -}