* Send a SIGIO or SIGURG signal to a process or process group using stored * credentials rather than those of the current process. */
| 3902 | * credentials rather than those of the current process. |
| 3903 | */ |
| 3904 | void |
| 3905 | pgsigio(struct sigio **sigiop, int sig, int checkctty) |
| 3906 | { |
| 3907 | ksiginfo_t ksi; |
| 3908 | struct sigio *sigio; |
| 3909 | |
| 3910 | ksiginfo_init(&ksi); |
| 3911 | ksi.ksi_signo = sig; |
| 3912 | ksi.ksi_code = SI_KERNEL; |
| 3913 | |
| 3914 | SIGIO_LOCK(); |
| 3915 | sigio = *sigiop; |
| 3916 | if (sigio == NULL) { |
| 3917 | SIGIO_UNLOCK(); |
| 3918 | return; |
| 3919 | } |
| 3920 | if (sigio->sio_pgid > 0) { |
| 3921 | PROC_LOCK(sigio->sio_proc); |
| 3922 | if (CANSIGIO(sigio->sio_ucred, sigio->sio_proc->p_ucred)) |
| 3923 | kern_psignal(sigio->sio_proc, sig); |
| 3924 | PROC_UNLOCK(sigio->sio_proc); |
| 3925 | } else if (sigio->sio_pgid < 0) { |
| 3926 | struct proc *p; |
| 3927 | |
| 3928 | PGRP_LOCK(sigio->sio_pgrp); |
| 3929 | LIST_FOREACH(p, &sigio->sio_pgrp->pg_members, p_pglist) { |
| 3930 | PROC_LOCK(p); |
| 3931 | if (p->p_state == PRS_NORMAL && |
| 3932 | CANSIGIO(sigio->sio_ucred, p->p_ucred) && |
| 3933 | (checkctty == 0 || (p->p_flag & P_CONTROLT))) |
| 3934 | kern_psignal(p, sig); |
| 3935 | PROC_UNLOCK(p); |
| 3936 | } |
| 3937 | PGRP_UNLOCK(sigio->sio_pgrp); |
| 3938 | } |
| 3939 | SIGIO_UNLOCK(); |
| 3940 | } |
| 3941 | |
| 3942 | static int |
| 3943 | filt_sigattach(struct knote *kn) |
no test coverage detected