2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
22 /* Copyright (c) 1995-1998 Apple Computer, Inc. All Rights Reserved */
24 * Copyright (c) 1982, 1986, 1989, 1991, 1993
25 * The Regents of the University of California. All rights reserved.
26 * (c) UNIX System Laboratories, Inc.
27 * All or some portions of this file are derived from material licensed
28 * to the University of California by American Telephone and Telegraph
29 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
30 * the permission of UNIX System Laboratories, Inc.
32 * Redistribution and use in source and binary forms, with or without
33 * modification, are permitted provided that the following conditions
35 * 1. Redistributions of source code must retain the above copyright
36 * notice, this list of conditions and the following disclaimer.
37 * 2. Redistributions in binary form must reproduce the above copyright
38 * notice, this list of conditions and the following disclaimer in the
39 * documentation and/or other materials provided with the distribution.
40 * 3. All advertising materials mentioning features or use of this software
41 * must display the following acknowledgement:
42 * This product includes software developed by the University of
43 * California, Berkeley and its contributors.
44 * 4. Neither the name of the University nor the names of its contributors
45 * may be used to endorse or promote products derived from this software
46 * without specific prior written permission.
48 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
49 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
50 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
51 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
52 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
53 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
54 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
55 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
56 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
57 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
60 * @(#)kern_sig.c 8.7 (Berkeley) 4/18/94
63 #define SIGPROP /* include signal properties table */
64 #include <sys/param.h>
65 #include <sys/signalvar.h>
66 #include <sys/resourcevar.h>
67 #include <sys/namei.h>
68 #include <sys/vnode.h>
70 #include <sys/systm.h>
71 #include <sys/timeb.h>
72 #include <sys/times.h>
76 #include <sys/kernel.h>
78 #include <sys/ktrace.h>
79 #include <sys/syslog.h>
83 #include <sys/mount.h>
85 #include <kern/cpu_number.h>
88 #include <sys/user.h> /* for coredump */
89 #include <kern/ast.h> /* for APC support */
90 #include <kern/thread.h>
91 #include <kern/thread_call.h>
93 void stop
__P((struct proc
*p
));
94 int cansignal
__P((struct proc
*, struct pcred
*, struct proc
*, int));
95 int killpg1
__P((struct proc
*, int, int, int));
96 void sigexit_locked
__P((struct proc
*, int));
97 void setsigvec
__P((struct proc
*, int, struct sigaction
*));
98 void exit1
__P((struct proc
*, int, int *));
99 int signal_lock
__P((struct proc
*));
100 int signal_unlock
__P((struct proc
*));
101 void signal_setast
__P((thread_act_t
*));
102 void signal_clearast
__P((thread_act_t
*));
103 void psignal_lock
__P((struct proc
*, int, int, int));
106 void ram_printf
__P((int));
108 unsigned int rdebug_proc
=0;
116 #endif /* SIGNAL_DEBUG */
118 signal_lock(struct proc
*p
)
124 int register sp
, *fp
, numsaved
;
126 __asm__
volatile("mr %0,r1" : "=r" (sp
));
128 fp
= (int *)*((int *)sp
);
129 for (numsaved
= 0; numsaved
< 3; numsaved
++) {
130 p
->lockpc
[numsaved
] = fp
[2];
137 #endif /* SIGNAL_DEBUG */
140 error
= lockmgr(&p
->signal_lock
, LK_EXCLUSIVE
, 0, (struct proc
*)0);
147 signal_unlock(struct proc
*p
)
152 int register sp
, *fp
, numsaved
;
154 __asm__
volatile("mr %0,r1" : "=r" (sp
));
156 fp
= (int *)*((int *)sp
);
157 for (numsaved
= 0; numsaved
< 3; numsaved
++) {
158 p
->unlockpc
[numsaved
] = fp
[2];
165 #endif /* SIGNAL_DEBUG */
167 return(lockmgr(&p
->signal_lock
, LK_RELEASE
, (simple_lock_t
)0, (struct proc
*)0));
171 signal_setast(sig_actthread
)
172 thread_act_t
*sig_actthread
;
174 thread_ast_set(sig_actthread
, AST_BSD
);
175 if ((thread_act_t
*)current_act() == sig_actthread
)
180 signal_clearast(sig_actthread
)
181 thread_act_t
*sig_actthread
;
183 thread_ast_clear(sig_actthread
, AST_BSD
);
184 if ((thread_act_t
*)current_act() == sig_actthread
)
189 * Can process p, with pcred pc, send the signal signum to process q?
192 cansignal(p
, pc
, q
, signum
)
198 if (pc
->pc_ucred
->cr_uid
== 0)
199 return (1); /* root can always signal */
201 if (signum
== SIGCONT
&& q
->p_session
== p
->p_session
)
202 return (1); /* SIGCONT in session */
205 * Using kill(), only certain signals can be sent to setugid
208 if (q
->p_flag
& P_SUGID
) {
221 if (pc
->p_ruid
== q
->p_cred
->p_ruid
||
222 pc
->pc_ucred
->cr_uid
== q
->p_cred
->p_ruid
||
223 pc
->p_ruid
== q
->p_ucred
->cr_uid
||
224 pc
->pc_ucred
->cr_uid
== q
->p_ucred
->cr_uid
)
231 * because the P_SUGID test exists, this has extra tests which
234 if (pc
->p_ruid
== q
->p_cred
->p_ruid
||
235 pc
->p_ruid
== q
->p_cred
->p_svuid
||
236 pc
->pc_ucred
->cr_uid
== q
->p_cred
->p_ruid
||
237 pc
->pc_ucred
->cr_uid
== q
->p_cred
->p_svuid
||
238 pc
->p_ruid
== q
->p_ucred
->cr_uid
||
239 pc
->pc_ucred
->cr_uid
== q
->p_ucred
->cr_uid
)
244 struct sigaction_args
{
246 struct sigaction
*nsa
;
247 struct sigaction
*osa
;
252 sigaction(p
, uap
, retval
)
254 register struct sigaction_args
*uap
;
257 struct sigaction vec
;
258 register struct sigaction
*sa
;
259 register struct sigacts
*ps
= p
->p_sigacts
;
263 signum
= uap
->signum
;
264 if (signum
<= 0 || signum
>= NSIG
||
265 signum
== SIGKILL
|| signum
== SIGSTOP
)
269 sa
->sa_handler
= ps
->ps_sigact
[signum
];
270 sa
->sa_mask
= ps
->ps_catchmask
[signum
];
271 bit
= sigmask(signum
);
273 if ((ps
->ps_sigonstack
& bit
) != 0)
274 sa
->sa_flags
|= SA_ONSTACK
;
275 if ((ps
->ps_sigintr
& bit
) == 0)
276 sa
->sa_flags
|= SA_RESTART
;
277 if (p
->p_flag
& P_NOCLDSTOP
)
278 sa
->sa_flags
|= SA_NOCLDSTOP
;
279 if (error
= copyout((caddr_t
)sa
, (caddr_t
)uap
->osa
,
284 if (error
= copyin((caddr_t
)uap
->nsa
, (caddr_t
)sa
,
287 setsigvec(p
, signum
, sa
);
293 reset_sigbits(thread_act_t th_act
, int bit
)
296 ut
= get_bsdthread_info(th_act
);
303 clear_sigbits (struct proc
*p
, int bit
)
305 task_t task
= p
->task
;
307 p
->p_siglist
&= ~(bit
);
308 task_act_iterate_wth_args(task
, reset_sigbits
, bit
);
314 setsigvec(p
, signum
, sa
)
315 register struct proc
*p
;
317 register struct sigaction
*sa
;
319 register struct sigacts
*ps
= p
->p_sigacts
;
322 bit
= sigmask(signum
);
324 * Change setting atomically.
326 ps
->ps_sigact
[signum
] = sa
->sa_handler
;
327 ps
->ps_catchmask
[signum
] = sa
->sa_mask
&~ sigcantmask
;
328 if ((sa
->sa_flags
& SA_RESTART
) == 0)
329 ps
->ps_sigintr
|= bit
;
331 ps
->ps_sigintr
&= ~bit
;
332 if (sa
->sa_flags
& SA_ONSTACK
)
333 ps
->ps_sigonstack
|= bit
;
335 ps
->ps_sigonstack
&= ~bit
;
336 if (sa
->sa_flags
& SA_USERTRAMP
)
337 ps
->ps_usertramp
|= bit
;
339 ps
->ps_usertramp
&= ~bit
;
340 if (signum
== SIGCHLD
) {
341 if (sa
->sa_flags
& SA_NOCLDSTOP
)
342 p
->p_flag
|= P_NOCLDSTOP
;
344 p
->p_flag
&= ~P_NOCLDSTOP
;
347 * Set bit in p_sigignore for signals that are set to SIG_IGN,
348 * and for signals set to SIG_DFL where the default is to ignore.
349 * However, don't put SIGCONT in p_sigignore,
350 * as we have to restart the process.
352 if (sa
->sa_handler
== SIG_IGN
||
353 (sigprop
[signum
] & SA_IGNORE
&& sa
->sa_handler
== SIG_DFL
)) {
354 p
->p_siglist
&= ~bit
; /* never to be seen again */
356 * If this is a thread signal, clean out the
359 if (bit
& threadmask
) {
360 register task_t task
= p
->task
;
362 task_act_iterate_wth_args(task
, reset_sigbits
, bit
);
364 if (signum
!= SIGCONT
)
365 p
->p_sigignore
|= bit
; /* easier in psignal */
366 p
->p_sigcatch
&= ~bit
;
368 p
->p_sigignore
&= ~bit
;
369 if (sa
->sa_handler
== SIG_DFL
)
370 p
->p_sigcatch
&= ~bit
;
372 p
->p_sigcatch
|= bit
;
377 * Initialize signal state for process 0;
378 * set to ignore signals that are ignored by default.
386 for (i
= 0; i
< NSIG
; i
++)
387 if (sigprop
[i
] & SA_IGNORE
&& i
!= SIGCONT
)
388 p
->p_sigignore
|= sigmask(i
);
392 * Reset signals for an exec of the specified process.
396 register struct proc
*p
;
398 register struct sigacts
*ps
= p
->p_sigacts
;
399 register int nc
, mask
;
402 * Reset caught signals. Held signals remain held
403 * through p_sigmask (unless they were caught,
404 * and are now ignored by default).
406 while (p
->p_sigcatch
) {
407 nc
= ffs((long)p
->p_sigcatch
);
409 p
->p_sigcatch
&= ~mask
;
410 if (sigprop
[nc
] & SA_IGNORE
) {
412 p
->p_sigignore
|= mask
;
413 p
->p_siglist
&= ~mask
;
415 ps
->ps_sigact
[nc
] = SIG_DFL
;
418 * Reset stack state to the user stack.
419 * Clear set of signals caught on the signal stack.
421 ps
->ps_sigstk
.ss_flags
= SA_DISABLE
;
422 ps
->ps_sigstk
.ss_size
= 0;
423 ps
->ps_sigstk
.ss_sp
= 0;
428 * Manipulate signal mask.
429 * Note that we receive new mask, not pointer,
430 * and return old mask as return value;
431 * the library stub does the rest.
433 struct sigprocmask_args
{
438 sigprocmask(p
, uap
, retval
)
439 register struct proc
*p
;
440 struct sigprocmask_args
*uap
;
445 *retval
= p
->p_sigmask
;
449 p
->p_sigmask
|= uap
->mask
&~ sigcantmask
;
453 p
->p_sigmask
&= ~(uap
->mask
);
454 signal_setast(current_act());
458 p
->p_sigmask
= uap
->mask
&~ sigcantmask
;
459 signal_setast(current_act());
471 sigpending(p
, uap
, retval
)
477 *retval
= p
->p_siglist
;
483 * Generalized interface signal handler, 4.3-compatible.
485 struct osigvec_args
{
492 osigvec(p
, uap
, retval
)
494 register struct osigvec_args
*uap
;
498 register struct sigacts
*ps
= p
->p_sigacts
;
499 register struct sigvec
*sv
;
503 signum
= uap
->signum
;
504 if (signum
<= 0 || signum
>= NSIG
||
505 signum
== SIGKILL
|| signum
== SIGSTOP
)
509 *(sig_t
*)&sv
->sv_handler
= ps
->ps_sigact
[signum
];
510 sv
->sv_mask
= ps
->ps_catchmask
[signum
];
511 bit
= sigmask(signum
);
513 if ((ps
->ps_sigonstack
& bit
) != 0)
514 sv
->sv_flags
|= SV_ONSTACK
;
515 if ((ps
->ps_sigintr
& bit
) != 0)
516 sv
->sv_flags
|= SV_INTERRUPT
;
517 if (p
->p_flag
& P_NOCLDSTOP
)
518 sv
->sv_flags
|= SA_NOCLDSTOP
;
519 if (error
= copyout((caddr_t
)sv
, (caddr_t
)uap
->osv
,
524 if (error
= copyin((caddr_t
)uap
->nsv
, (caddr_t
)sv
,
527 sv
->sv_flags
^= SA_RESTART
; /* opposite of SV_INTERRUPT */
528 setsigvec(p
, signum
, (struct sigaction
*)sv
);
533 struct osigblock_args
{
537 osigblock(p
, uap
, retval
)
538 register struct proc
*p
;
539 struct osigblock_args
*uap
;
543 *retval
= p
->p_sigmask
;
544 p
->p_sigmask
|= uap
->mask
&~ sigcantmask
;
548 struct osigsetmask_args
{
552 osigsetmask(p
, uap
, retval
)
554 struct osigsetmask_args
*uap
;
558 *retval
= p
->p_sigmask
;
559 p
->p_sigmask
= uap
->mask
&~ sigcantmask
;
562 #endif /* COMPAT_43 */
565 * Suspend process until signal, providing mask to be set
566 * in the meantime. Note nonstandard calling convention:
567 * libc stub passes mask, not pointer, to save a copyin.
573 unix_syscall_return(EINTR
);
576 struct sigsuspend_args
{
582 sigsuspend(p
, uap
, retval
)
583 register struct proc
*p
;
584 struct sigsuspend_args
*uap
;
587 register struct sigacts
*ps
= p
->p_sigacts
;
590 * When returning from sigpause, we want
591 * the old mask to be restored after the
592 * signal handler has finished. Thus, we
593 * save it here and mark the sigacts structure
596 ps
->ps_oldmask
= p
->p_sigmask
;
597 ps
->ps_flags
|= SAS_OLDMASK
;
598 p
->p_sigmask
= uap
->mask
&~ sigcantmask
;
599 (void) tsleep0((caddr_t
) p
, PPAUSE
|PCATCH
, "pause", 0, sigcontinue
);
600 /* always return EINTR rather than ERESTART... */
605 struct osigstack_args
{
606 struct sigstack
*nss
;
607 struct sigstack
*oss
;
611 osigstack(p
, uap
, retval
)
613 register struct osigstack_args
*uap
;
621 ss
.ss_sp
= psp
->ps_sigstk
.ss_sp
;
622 ss
.ss_onstack
= psp
->ps_sigstk
.ss_flags
& SA_ONSTACK
;
623 if (uap
->oss
&& (error
= copyout((caddr_t
)&ss
,
624 (caddr_t
)uap
->oss
, sizeof (struct sigstack
))))
626 if (uap
->nss
&& (error
= copyin((caddr_t
)uap
->nss
,
627 (caddr_t
)&ss
, sizeof (ss
))) == 0) {
628 psp
->ps_sigstk
.ss_sp
= ss
.ss_sp
;
629 psp
->ps_sigstk
.ss_size
= 0;
630 psp
->ps_sigstk
.ss_flags
|= ss
.ss_onstack
& SA_ONSTACK
;
631 psp
->ps_flags
|= SAS_ALTSTACK
;
635 #endif /* COMPAT_43 */
637 struct sigaltstack_args
{
638 struct sigaltstack
*nss
;
639 struct sigaltstack
*oss
;
643 sigaltstack(p
, uap
, retval
)
645 register struct sigaltstack_args
*uap
;
649 struct sigaltstack ss
;
653 if ((psp
->ps_flags
& SAS_ALTSTACK
) == 0)
654 psp
->ps_sigstk
.ss_flags
|= SA_DISABLE
;
655 if (uap
->oss
&& (error
= copyout((caddr_t
)&psp
->ps_sigstk
,
656 (caddr_t
)uap
->oss
, sizeof (struct sigaltstack
))))
660 if (error
= copyin((caddr_t
)uap
->nss
, (caddr_t
)&ss
,
663 if (ss
.ss_flags
& SA_DISABLE
) {
664 if (psp
->ps_sigstk
.ss_flags
& SA_ONSTACK
)
666 psp
->ps_flags
&= ~SAS_ALTSTACK
;
667 psp
->ps_sigstk
.ss_flags
= ss
.ss_flags
;
670 if (ss
.ss_size
< MINSIGSTKSZ
)
672 psp
->ps_flags
|= SAS_ALTSTACK
;
683 kill(cp
, uap
, retval
)
684 register struct proc
*cp
;
685 register struct kill_args
*uap
;
688 register struct proc
*p
;
689 register struct pcred
*pc
= cp
->p_cred
;
691 if ((u_int
)uap
->signum
>= NSIG
)
694 /* kill single process */
695 if ((p
= pfind(uap
->pid
)) == NULL
)
697 if (!cansignal(cp
, pc
, p
, uap
->signum
))
700 psignal(p
, uap
->signum
);
704 case -1: /* broadcast signal */
705 return (killpg1(cp
, uap
->signum
, 0, 1));
706 case 0: /* signal own process group */
707 return (killpg1(cp
, uap
->signum
, 0, 0));
708 default: /* negative explicit process group */
709 return (killpg1(cp
, uap
->signum
, -(uap
->pid
), 0));
715 struct okillpg_args
{
721 okillpg(p
, uap
, retval
)
723 register struct okillpg_args
*uap
;
727 if ((u_int
)uap
->signum
>= NSIG
)
729 return (killpg1(p
, uap
->signum
, uap
->pgid
, 0));
731 #endif /* COMPAT_43 */
734 * Common code for kill process group/broadcast kill.
735 * cp is calling process.
738 killpg1(cp
, signum
, pgid
, all
)
739 register struct proc
*cp
;
740 int signum
, pgid
, all
;
742 register struct proc
*p
;
743 register struct pcred
*pc
= cp
->p_cred
;
751 for (p
= allproc
.lh_first
; p
!= 0; p
= p
->p_list
.le_next
) {
752 if (p
->p_pid
<= 1 || p
->p_flag
& P_SYSTEM
||
753 p
== cp
|| !cansignal(cp
, pc
, p
, signum
))
762 * zero pgid means send to my process group.
770 for (p
= pgrp
->pg_members
.lh_first
; p
!= 0;
771 p
= p
->p_pglist
.le_next
) {
772 if (p
->p_pid
<= 1 || p
->p_flag
& P_SYSTEM
||
773 p
->p_stat
== SZOMB
||
774 !cansignal(cp
, pc
, p
, signum
))
781 return (nfound
? 0 : ESRCH
);
785 * Send a signal to a process group.
788 gsignal(pgid
, signum
)
793 if (pgid
&& (pgrp
= pgfind(pgid
)))
794 pgsignal(pgrp
, signum
, 0);
798 * Send a signal to a process group. If checktty is 1,
799 * limit to members which have a controlling terminal.
802 pgsignal(pgrp
, signum
, checkctty
)
804 int signum
, checkctty
;
806 register struct proc
*p
;
809 for (p
= pgrp
->pg_members
.lh_first
; p
!= 0;
810 p
= p
->p_pglist
.le_next
)
811 if (checkctty
== 0 || p
->p_flag
& P_CONTROLT
)
816 * Send a signal caused by a trap to a specific thread.
819 threadsignal(sig_actthread
, signum
, code
)
820 register thread_act_t
*sig_actthread
;
824 register struct uthread
*uth
;
825 register struct task
* sig_task
;
826 register struct proc
*p
;
829 if ((u_int
)signum
>= NSIG
|| signum
== 0)
832 mask
= sigmask(signum
);
833 if ((mask
& threadmask
) == 0)
835 sig_task
= get_threadtask(sig_actthread
);
836 p
= (struct proc
*)(get_bsdtask_info(sig_task
));
838 uth
= get_bsdthread_info(sig_actthread
);
839 if (uth
&& (uth
->uu_flag
& P_VFORK
))
842 if (!(p
->p_flag
& P_TRACED
) && (p
->p_sigignore
& mask
))
847 /* mark on process as well */
848 p
->p_siglist
|= mask
;
849 signal_setast(sig_actthread
);
855 register struct proc
*p
;
857 boolean_t funnel_state
;
858 register int sigbits
, mask
, signum
;
860 thread_funnel_set(kernel_flock
, TRUE
);
862 if (p
->p_sigpending
== 0)
869 sigbits
= p
->p_sigpending
;
872 signum
= ffs((long)sigbits
);
873 mask
= sigmask(signum
);
874 p
->p_sigpending
&= ~mask
;
876 psignal_lock(p
, signum
, 0, 0);
880 p
->p_flag
&= ~P_SIGTHR
;
882 thread_funnel_set(kernel_flock
, FALSE
);
887 register struct proc
*p
;
890 psignal_lock(p
, signum
, 1, 1);
895 psignal_vfork(p
, new_task
, thr_act
, signum
)
896 register struct proc
*p
;
898 thread_act_t thr_act
;
903 register int s
, prop
;
904 register sig_t action
;
908 if ((u_int
)signum
>= NSIG
|| signum
== 0)
909 panic("psignal signal number");
910 mask
= sigmask(signum
);
911 prop
= sigprop
[signum
];
914 if(rdebug_proc
&& (p
== rdebug_proc
)) {
917 #endif /* SIGNAL_DEBUG */
919 if ((new_task
== TASK_NULL
) || (thr_act
== (thread_act_t
)NULL
) || is_kerneltask(new_task
))
926 * proc is traced, always give parent a chance.
930 if (p
->p_nice
> NZERO
&& action
== SIG_DFL
&& (prop
& SA_KILL
) &&
931 (p
->p_flag
& P_TRACED
) == 0)
935 p
->p_siglist
&= ~stopsigmask
;
937 if (prop
& SA_STOP
) {
939 * If sending a tty stop signal to a member of an orphaned
940 * process group, discard the signal here if the action
941 * is default; don't stop the process below if sleeping,
942 * and don't clear any pending SIGCONT.
944 if (prop
& SA_TTYSTOP
&& p
->p_pgrp
->pg_jobc
== 0 &&
947 p
->p_siglist
&= ~contsigmask
;
949 p
->p_siglist
|= mask
;
951 /* Deliver signal to the activation passed in */
952 thread_ast_set(thr_act
, AST_BSD
);
955 * SIGKILL priority twiddling moved here from above because
956 * it needs sig_thread. Could merge it into large switch
957 * below if we didn't care about priority for tracing
958 * as SIGKILL's action is always SIG_DFL.
960 if ((signum
== SIGKILL
) && (p
->p_nice
> NZERO
)) {
964 * we need to make changes here to get nice to work
965 * reset priority to BASEPRI_USER
971 * This Process is traced - wake it up (if not already
972 * stopped) so that it can discover the signal in
973 * issig() and stop for the parent.
975 if (p
->p_flag
& P_TRACED
) {
976 if (p
->p_stat
!= SSTOP
)
983 * If we're being traced (possibly because someone attached us
984 * while we were stopped), check for a signal from the debugger.
986 if (p
->p_stat
== SSTOP
) {
987 if ((p
->p_flag
& P_TRACED
) != 0 && p
->p_xstat
!= 0)
988 p
->p_siglist
|= sigmask(p
->p_xstat
);
992 * setrunnable(p) in BSD
1001 * Send the signal to the process. If the signal has an action, the action
1002 * is usually performed by the target process rather than the caller; we add
1003 * the signal to the set of pending signals for the process.
1006 * o When a stop signal is sent to a sleeping process that takes the
1007 * default action, the process is stopped without awakening it.
1008 * o SIGCONT restarts stopped processes (or puts them back to sleep)
1009 * regardless of the signal action (eg, blocked or ignored).
1011 * Other ignored signals are discarded immediately.
1014 psignal_lock(p
, signum
, withlock
, pend
)
1015 register struct proc
*p
;
1016 register int signum
;
1017 register int withlock
;
1020 register int s
, prop
;
1021 register sig_t action
;
1022 thread_act_t sig_thread_act
;
1023 thread_t sig_thread
;
1024 register task_t sig_task
;
1025 register thread_t cur_thread
;
1026 thread_act_t
*cur_act
;
1031 if ((u_int
)signum
>= NSIG
|| signum
== 0)
1032 panic("psignal signal number");
1033 mask
= sigmask(signum
);
1034 prop
= sigprop
[signum
];
1037 if(rdebug_proc
&& (p
== rdebug_proc
)) {
1040 #endif /* SIGNAL_DEBUG */
1042 if (thread_funnel_get() == (funnel_t
*)network_flock
) {
1044 thread_funnel_switch(NETWORK_FUNNEL
, KERNEL_FUNNEL
);
1047 * We will need the task pointer later. Grab it now to
1048 * check for a zombie process. Also don't send signals
1049 * to kernel internal tasks.
1051 if (((sig_task
= p
->task
) == TASK_NULL
) || is_kerneltask(sig_task
)) {
1053 thread_funnel_switch(KERNEL_FUNNEL
, NETWORK_FUNNEL
);
1058 * do not send signals to the process that has the thread
1059 * doing a reboot(). Not doing so will mark that thread aborted
1060 * and can cause IO failures wich will cause data loss.
1062 if (ISSET(p
->p_flag
, P_REBOOT
)) {
1064 thread_funnel_switch(KERNEL_FUNNEL
, NETWORK_FUNNEL
);
1069 * if the traced process is blocked waiting for
1070 * gdb then do not block the caller just pend
1071 * the signal. Setup a callout to process the
1072 * pended signal if not alreadu set
1074 if (pend
&& (p
->p_flag
& P_TRACED
) && p
->sigwait
) {
1075 p
->p_sigpending
|= mask
;
1076 if (!(p
->p_flag
& P_SIGTHR
)) {
1077 p
->p_flag
|= P_SIGTHR
;
1078 thread_call_func((thread_call_func_t
)psignal_pend
, p
,
1082 thread_funnel_switch(KERNEL_FUNNEL
, NETWORK_FUNNEL
);
1090 * If proc is traced, always give parent a chance.
1092 if (p
->p_flag
& P_TRACED
)
1096 * If the signal is being ignored,
1097 * then we forget about it immediately.
1098 * (Note: we don't set SIGCONT in p_sigignore,
1099 * and if it is set to SIG_IGN,
1100 * action will be SIG_DFL here.)
1102 if (p
->p_sigignore
& mask
)
1104 if (p
->p_sigmask
& mask
)
1106 else if (p
->p_sigcatch
& mask
)
1112 if (p
->p_nice
> NZERO
&& action
== SIG_DFL
&& (prop
& SA_KILL
) &&
1113 (p
->p_flag
& P_TRACED
) == 0)
1117 p
->p_siglist
&= ~stopsigmask
;
1119 if (prop
& SA_STOP
) {
1121 * If sending a tty stop signal to a member of an orphaned
1122 * process group, discard the signal here if the action
1123 * is default; don't stop the process below if sleeping,
1124 * and don't clear any pending SIGCONT.
1126 if (prop
& SA_TTYSTOP
&& p
->p_pgrp
->pg_jobc
== 0 &&
1129 p
->p_siglist
&= ~contsigmask
;
1131 p
->p_siglist
|= mask
;
1134 * Defer further processing for signals which are held,
1135 * except that stopped processes must be continued by SIGCONT.
1137 if (action
== SIG_HOLD
&& ((prop
& SA_CONT
) == 0 || p
->p_stat
!= SSTOP
))
1141 * Deliver the signal to the first thread in the task. This
1142 * allows single threaded applications which use signals to
1143 * be able to be linked with multithreaded libraries. We have
1144 * an implicit reference to the current_thread, but need
1145 * an explicit one otherwise. The thread reference keeps
1146 * the corresponding task data structures around too. This
1147 * reference is released by thread_deallocate.
1150 cur_thread
= current_thread(); /* this is a shuttle */
1151 cur_act
= current_act();
1153 if ((p
->p_flag
& P_INVFORK
) && p
->p_vforkact
) {
1154 sig_thread_act
= p
->p_vforkact
;
1156 kret
= check_actforsig(sig_task
, sig_thread_act
, &sig_thread
, 1);
1157 if (kret
== KERN_SUCCESS
) {
1158 goto psig_foundthread
;
1162 /* If successful return with ast set */
1163 kret
= (kern_return_t
)get_signalact(sig_task
,
1164 &sig_thread_act
, &sig_thread
, 1);
1166 if ((kret
!= KERN_SUCCESS
) || (sig_thread_act
== THREAD_NULL
)) {
1168 /* if it is sigkill, may be we should
1169 * inject a thread to terminate
1172 printf("WARNING: no activation in psignal\n");
1176 #endif /* SIGNAL_DEBUG */
1181 if (sig_thread
== THREAD_NULL
) {
1183 printf("WARNING: valid act; but no shutte in psignal\n");
1186 /* FIXME : NO VALID SHUTTLE */
1192 * SIGKILL priority twiddling moved here from above because
1193 * it needs sig_thread. Could merge it into large switch
1194 * below if we didn't care about priority for tracing
1195 * as SIGKILL's action is always SIG_DFL.
1197 if ((signum
== SIGKILL
) && (p
->p_nice
> NZERO
)) {
1201 * we need to make changes here to get nice to work
1202 * reset priority to BASEPRI_USER
1208 * Process is traced - wake it up (if not already
1209 * stopped) so that it can discover the signal in
1210 * issig() and stop for the parent.
1212 if (p
->p_flag
& P_TRACED
) {
1213 if (p
->p_stat
!= SSTOP
)
1219 if (action
!= SIG_DFL
) {
1221 * User wants to catch the signal.
1222 * Wake up the thread, but don't un-suspend it
1223 * (except for SIGCONT).
1226 (void) task_resume(sig_task
);
1229 /* Default action - varies */
1230 if (mask
& stopsigmask
) {
1232 * These are the signals which by default
1235 * Don't clog system with children of init
1236 * stopped from the keyboard.
1238 if (!(prop
& SA_STOP
) && p
->p_pptr
== initproc
) {
1239 psignal_lock(p
, SIGKILL
, 0, 1);
1240 p
->p_siglist
&= ~mask
;
1247 if (!is_thread_running(sig_thread
)) {
1248 /* Thread is not running
1249 * If task hasn't already been stopped by
1250 * a signal, stop it.
1252 p
->p_siglist
&= ~mask
;
1253 if (get_task_userstop(sig_task
) == 0) {
1255 * p_cursig must not be set, because
1256 * it will be psig()'d if it is not
1257 * zero, and the signal is being
1258 * handled here. But save the signal
1259 * in p_stopsig so WUNTRACED
1260 * option to wait can find it.
1262 p
->p_xstat
= signum
;
1263 if ((p
->p_pptr
->p_flag
& P_NOCLDSTOP
) == 0)
1264 psignal(p
->p_pptr
, SIGCHLD
);
1268 /* unconditional check is bad */
1269 signal_clearast(sig_thread_act
);
1273 if (p
->p_stat
!= SZOMB
)
1274 signal_setast(cur_act
);
1281 * Signals ignored by default have been dealt
1282 * with already, since their bits are on in
1288 * Kill signal always sets process running and
1292 * Process will be running after 'run'
1296 thread_abort(sig_thread_act
);
1302 * Let the process run. If it's sleeping on an
1303 * event, it remains so.
1305 if (p
->p_flag
& P_TTYSLEEP
) {
1306 p
->p_flag
&= ~P_TTYSLEEP
;
1307 wakeup(&p
->p_siglist
);
1309 (void) task_resume(sig_task
);
1311 p
->p_siglist
&= ~mask
;
1314 /* do not clear AST as tcsh is sendig SIGTERM followed by
1315 * SIGCONT and the ast was getting cleared unconditinally
1316 * This is not right.
1318 signal_clearast(sig_thread_act
);
1324 * All other signals wake up the process, but don't
1333 * If we're being traced (possibly because someone attached us
1334 * while we were stopped), check for a signal from the debugger.
1336 if (p
->p_stat
== SSTOP
) {
1337 if ((p
->p_flag
& P_TRACED
) != 0 && p
->p_xstat
!= 0)
1338 p
->p_siglist
|= sigmask(p
->p_xstat
);
1342 * setrunnable(p) in BSD
1347 * Wake up the thread if it is interruptible.
1349 thread_abort_safely(sig_thread_act
);
1354 thread_funnel_switch(KERNEL_FUNNEL
, NETWORK_FUNNEL
);
1361 thread_t self
= current_thread();
1363 p
->exit_thread
= self
;
1364 (void) task_suspend(p
->task
);
1371 thread_t self
= current_thread();
1373 while (p
->sigwait
|| p
->exit_thread
) {
1374 if (p
->exit_thread
) {
1375 if (p
->exit_thread
!= self
) {
1377 * Already exiting - no signals.
1379 thread_abort(current_act());
1383 if(assert_wait_possible()) {
1384 assert_wait((caddr_t
)&p
->sigwait_thread
,
1385 (THREAD_INTERRUPTIBLE
));
1390 if (thread_should_abort(self
)) {
1392 * Terminate request - clean up.
1401 * If the current process has received a signal (should be caught or cause
1402 * termination, should interrupt current syscall), return the signal number.
1403 * Stop signals with default action are processed immediately, then cleared;
1404 * they aren't returned. This is checked after each entry to the system for
1405 * a syscall or trap (though this can usually be done without calling issignal
1406 * by checking the pending signal masks in the CURSIG macro.) The normal call
1409 * while (signum = CURSIG(curproc))
1414 register struct proc
*p
;
1416 register int signum
, mask
, prop
, sigbits
;
1417 task_t task
= p
->task
;
1418 thread_t cur_thread
;
1419 thread_act_t cur_act
;
1421 struct uthread
* ut
;
1424 cur_thread
= current_thread();
1425 cur_act
= current_act();
1431 * Try to grab the signal lock.
1433 if (sig_try_locked(p
) <= 0) {
1438 ut
= get_bsdthread_info(cur_act
);
1440 sigbits
= (ut
->uu_sig
|p
->p_siglist
) & ~p
->p_sigmask
;
1442 if (p
->p_flag
& P_PPWAIT
)
1443 sigbits
&= ~stopsigmask
;
1444 if (sigbits
== 0) { /* no signal to send */
1448 signum
= ffs((long)sigbits
);
1449 mask
= sigmask(signum
);
1450 prop
= sigprop
[signum
];
1452 if (mask
& threadmask
) {
1453 /* we can take this signal */
1454 ut
->uu_sig
&= ~mask
;
1458 * We should see pending but ignored signals
1459 * only if P_TRACED was on when they were posted.
1461 if (mask
& p
->p_sigignore
&& (p
->p_flag
& P_TRACED
) == 0) {
1462 p
->p_siglist
&= ~mask
; /* take the signal! */
1465 if (p
->p_flag
& P_TRACED
&& (p
->p_flag
& P_PPWAIT
) == 0) {
1467 register task_t task
;
1469 * If traced, always stop, and stay
1470 * stopped until released by the debugger.
1472 /* ptrace debugging */
1473 p
->p_xstat
= signum
;
1474 psignal(p
->p_pptr
, SIGCHLD
);
1476 * XXX Have to really stop for debuggers;
1477 * XXX stop() doesn't do the right thing.
1478 * XXX Inline the task_suspend because we
1479 * XXX have to diddle Unix state in the
1485 p
->sigwait_thread
= cur_act
;
1487 p
->p_flag
&= ~P_WAITED
;
1488 p
->p_siglist
&= ~mask
; /* clear the old signal */
1490 wakeup((caddr_t
)p
->p_pptr
);
1491 assert_wait((caddr_t
)&p
->sigwait
, (THREAD_INTERRUPTIBLE
));
1494 p
->sigwait_thread
= NULL
;
1495 wakeup((caddr_t
)&p
->sigwait_thread
);
1498 * This code is to detect when gdb is killed
1499 * even as the traced program is attached.
1500 * pgsignal would get the SIGKILL to traced program
1501 * That's what we are trying to see (I hope)
1503 if (p
->p_siglist
& sigmask(SIGKILL
)) {
1505 * Wait event may still be outstanding;
1506 * clear it, since sig_lock_to_exit will
1509 clear_wait(current_thread(), THREAD_INTERRUPTED
);
1510 sig_lock_to_exit(p
);
1512 * Since this thread will be resumed
1513 * to allow the current syscall to
1514 * be completed, must save u_qsave
1515 * before calling exit(). (Since exit()
1516 * calls closef() which can trash u_qsave.)
1519 exit1(p
,signum
, (int *)NULL
);
1524 * We may have to quit
1526 if (thread_should_abort(current_thread())) {
1531 * If parent wants us to take the signal,
1532 * then it will leave it in p->p_xstat;
1533 * otherwise we just look for signals again.
1535 signum
= p
->p_xstat
;
1539 * Put the new signal into p_siglist. If the
1540 * signal is being masked, look for other signals.
1542 mask
= sigmask(signum
);
1543 if (mask
& threadmask
)
1546 p
->p_siglist
|= mask
;
1547 if (p
->p_sigmask
& mask
)
1552 * Decide whether the signal should be returned.
1553 * Return the signal's number, or fall through
1554 * to clear it from the pending mask.
1557 switch ((long)p
->p_sigacts
->ps_sigact
[signum
]) {
1561 * Don't take default actions on system processes.
1563 if (p
->p_pptr
->p_pid
== 0) {
1566 * Are you sure you want to ignore SIGSEGV
1569 printf("Process (pid %d) got signal %d\n",
1572 break; /* == ignore */
1576 * If there is a pending stop signal to process
1577 * with default action, stop here,
1578 * then clear the signal. However,
1579 * if process is member of an orphaned
1580 * process group, ignore tty stop signals.
1582 if (prop
& SA_STOP
) {
1583 if (p
->p_flag
& P_TRACED
||
1584 (p
->p_pgrp
->pg_jobc
== 0 &&
1586 break; /* == ignore */
1587 p
->p_xstat
= signum
;
1589 if ((p
->p_pptr
->p_flag
& P_NOCLDSTOP
) == 0)
1590 psignal(p
->p_pptr
, SIGCHLD
);
1593 * We may have to quit
1595 if (thread_should_abort(current_thread())) {
1600 } else if (prop
& SA_IGNORE
) {
1602 * Except for SIGCONT, shouldn't get here.
1603 * Default action is to ignore; drop it.
1605 break; /* == ignore */
1607 p
->p_siglist
&= ~mask
; /* take the signal! */
1608 p
->p_sigpending
&= ~mask
; /* take the pending signal */
1616 * Masking above should prevent us ever trying
1617 * to take action on an ignored signal other
1618 * than SIGCONT, unless process is traced.
1620 if ((prop
& SA_CONT
) == 0 &&
1621 (p
->p_flag
& P_TRACED
) == 0)
1622 printf("issignal\n");
1623 break; /* == ignore */
1627 * This signal has an action, let
1628 * postsig() process it.
1630 p
->p_siglist
&= ~mask
; /* take the signal! */
1631 p
->p_sigpending
&= ~mask
; /* take the pending signal */
1635 p
->p_siglist
&= ~mask
; /* take the signal! */
1636 p
->p_sigpending
&= ~mask
; /* take the pending signal */
1641 /* called from _sleep */
1644 register struct proc
*p
;
1646 register int signum
, mask
, prop
, sigbits
;
1647 task_t task
= p
->task
;
1648 thread_t cur_thread
;
1649 thread_act_t cur_act
;
1651 struct uthread
* ut
;
1654 if (p
->p_siglist
== 0)
1657 if (((p
->p_siglist
& ~p
->p_sigmask
) == 0) && ((p
->p_flag
& P_TRACED
) == 0))
1660 cur_thread
= current_thread();
1661 cur_act
= current_act();
1663 ut
= get_bsdthread_info(cur_act
);
1665 sigbits
= (ut
->uu_sig
| p
->p_siglist
) & ~p
->p_sigmask
;
1668 if (p
->p_flag
& P_PPWAIT
)
1669 sigbits
&= ~stopsigmask
;
1670 if (sigbits
== 0) { /* no signal to send */
1674 signum
= ffs((long)sigbits
);
1675 mask
= sigmask(signum
);
1676 prop
= sigprop
[signum
];
1679 * We should see pending but ignored signals
1680 * only if P_TRACED was on when they were posted.
1682 if (mask
& p
->p_sigignore
&& (p
->p_flag
& P_TRACED
) == 0) {
1685 if (p
->p_flag
& P_TRACED
&& (p
->p_flag
& P_PPWAIT
) == 0) {
1687 * Put the new signal into p_siglist. If the
1688 * signal is being masked, look for other signals.
1690 mask
= sigmask(signum
);
1691 if (p
->p_sigmask
& mask
)
1697 * Decide whether the signal should be returned.
1698 * Return the signal's number, or fall through
1699 * to clear it from the pending mask.
1702 switch ((long)p
->p_sigacts
->ps_sigact
[signum
]) {
1706 * Don't take default actions on system processes.
1708 if (p
->p_pptr
->p_pid
== 0) {
1711 * Are you sure you want to ignore SIGSEGV
1714 printf("Process (pid %d) got signal %d\n",
1717 break; /* == ignore */
1721 * If there is a pending stop signal to process
1722 * with default action, stop here,
1723 * then clear the signal. However,
1724 * if process is member of an orphaned
1725 * process group, ignore tty stop signals.
1727 if (prop
& SA_STOP
) {
1728 if (p
->p_flag
& P_TRACED
||
1729 (p
->p_pgrp
->pg_jobc
== 0 &&
1731 break; /* == ignore */
1734 } else if (prop
& SA_IGNORE
) {
1736 * Except for SIGCONT, shouldn't get here.
1737 * Default action is to ignore; drop it.
1739 break; /* == ignore */
1747 * Masking above should prevent us ever trying
1748 * to take action on an ignored signal other
1749 * than SIGCONT, unless process is traced.
1751 if ((prop
& SA_CONT
) == 0 &&
1752 (p
->p_flag
& P_TRACED
) == 0)
1753 printf("issignal\n");
1754 break; /* == ignore */
1758 * This signal has an action, let
1759 * postsig() process it.
1763 sigbits
&= ~mask
; /* take the signal! */
1769 * Put the argument process into the stopped state and notify the parent
1770 * via wakeup. Signals are handled elsewhere. The process must not be
1775 register struct proc
*p
;
1778 p
->p_flag
&= ~P_WAITED
;
1779 wakeup((caddr_t
)p
->p_pptr
);
1780 (void) task_suspend(p
->task
); /*XXX*/
1784 * Take the action for the specified signal
1785 * from the current set of pending signals.
1789 register int signum
;
1791 register struct proc
*p
= current_proc();
1792 register struct sigacts
*ps
= p
->p_sigacts
;
1793 register sig_t action
;
1795 int mask
, returnmask
;
1801 * This must be called on master cpu
1803 if (cpu_number() != master_cpu
)
1804 panic("psig not on master");
1809 * Try to grab the signal lock.
1811 if (sig_try_locked(p
) <= 0) {
1816 mask
= sigmask(signum
);
1817 p
->p_siglist
&= ~mask
;
1818 action
= ps
->ps_sigact
[signum
];
1820 if (KTRPOINT(p
, KTR_PSIG
))
1821 ktrpsig(p
->p_tracep
,
1822 signum
, action
, ps
->ps_flags
& SAS_OLDMASK
?
1823 ps
->ps_oldmask
: p
->p_sigmask
, 0);
1825 if (action
== SIG_DFL
) {
1827 * Default action, where the default is to kill
1828 * the process. (Other cases were ignored above.)
1830 /* called with signal_lock() held */
1831 sigexit_locked(p
, signum
);
1836 * If we get here, the signal must be caught.
1839 if (action
== SIG_IGN
|| (p
->p_sigmask
& mask
))
1841 "postsig: processing masked or ignored signal\n");
1844 * Set the new mask value and also defer further
1845 * occurences of this signal.
1847 * Special case: user has done a sigpause. Here the
1848 * current mask is not of interest, but rather the
1849 * mask from before the sigpause is what we want
1850 * restored after the signal processing is completed.
1852 if (ps
->ps_flags
& SAS_OLDMASK
) {
1853 returnmask
= ps
->ps_oldmask
;
1854 ps
->ps_flags
&= ~SAS_OLDMASK
;
1856 returnmask
= p
->p_sigmask
;
1857 p
->p_sigmask
|= ps
->ps_catchmask
[signum
] | mask
;
1858 if (ps
->ps_sig
!= signum
) {
1864 p
->p_stats
->p_ru
.ru_nsignals
++;
1865 sendsig(p
, action
, signum
, returnmask
, code
);
1871 * Force the current process to exit with the specified signal, dumping core
1872 * if appropriate. We bypass the normal tests for masked and caught signals,
1873 * allowing unrecoverable failures to terminate the process without changing
1874 * signal state. Mark the accounting record with the signal termination.
1875 * If dumping core, save the signal number for the debugger. Calls exit and
1878 /* called with signal lock */
1880 sigexit_locked(p
, signum
)
1881 register struct proc
*p
;
1885 sig_lock_to_exit(p
);
1886 p
->p_acflag
|= AXSIG
;
1887 if (sigprop
[signum
] & SA_CORE
) {
1888 p
->p_sigacts
->ps_sig
= signum
;
1889 if (coredump(p
) == 0)
1890 signum
|= WCOREFLAG
;
1893 exit1(p
, W_EXITCODE(0, signum
), (int *)NULL
);
1898 bsd_ast(thread_act_t thr_act
)
1900 struct proc
*p
= current_proc();
1901 struct uthread
*ut
= get_bsdthread_info(thr_act
);
1904 boolean_t funnel_state
;
1909 funnel_state
= thread_funnel_set(kernel_flock
, TRUE
);
1911 if ((p
->p_flag
& P_OWEUPC
) && (p
->p_flag
& P_PROFIL
)) {
1912 pc
= get_useraddr();
1913 addupc_task(p
, pc
, 1);
1914 p
->p_flag
&= ~P_OWEUPC
;
1917 if (CHECK_SIGNALS(p
, current_thread(), ut
)) {
1918 while (signum
= issignal(p
))
1923 (void) thread_funnel_set(kernel_flock
, FALSE
);
1927 * Follwing routines are called using callout from bsd_hardclock
1928 * so that psignals are called in a thread context and are funneled
1931 psignal_vtalarm(struct proc
*p
)
1933 boolean_t funnel_state
;
1937 funnel_state
= thread_funnel_set(kernel_flock
, TRUE
);
1938 psignal_lock(p
, SIGVTALRM
, 1, 1);
1939 (void) thread_funnel_set(kernel_flock
, FALSE
);
1943 psignal_xcpu(struct proc
*p
)
1945 boolean_t funnel_state
;
1949 funnel_state
= thread_funnel_set(kernel_flock
, TRUE
);
1950 psignal_lock(p
, SIGXCPU
, 1, 1);
1951 (void) thread_funnel_set(kernel_flock
, FALSE
);
1955 psignal_sigprof(struct proc
*p
)
1957 boolean_t funnel_state
;
1961 funnel_state
= thread_funnel_set(kernel_flock
, TRUE
);
1962 psignal_lock(p
, SIGPROF
, 1, 1);
1963 (void) thread_funnel_set(kernel_flock
, FALSE
);
1966 /* ptrace set runnalbe */
1968 pt_setrunnable(struct proc
*p
)
1974 if (p
->p_flag
& P_TRACED
) {
1977 wakeup((caddr_t
)&(p
->sigwait
));