1/*
2 * Copyright (c) 1982, 1986, 1989, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
--- 13 unchanged lines hidden (view full) ---
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)kern_proc.c 8.7 (Berkeley) 2/14/95
30 * $FreeBSD: head/sys/kern/kern_proc.c 130640 2004-06-17 17:16:53Z phk $
31 */
32
33#include <sys/cdefs.h>
34__FBSDID("$FreeBSD: head/sys/kern/kern_proc.c 130640 2004-06-17 17:16:53Z phk $");
35
36#include "opt_ktrace.h"
37#include "opt_kstack_pages.h"
38
39#include <sys/param.h>
40#include <sys/systm.h>
41#include <sys/kernel.h>
42#include <sys/lock.h>
--- 752 unchanged lines hidden (view full) ---
795 }
796 }
797 if ((p->p_flag & P_CONTROLT) && tp != NULL) {
798 kp->ki_tdev = dev2udev(tp->t_dev);
799 kp->ki_tpgid = tp->t_pgrp ? tp->t_pgrp->pg_id : NO_PID;
800 if (tp->t_session)
801 kp->ki_tsid = tp->t_session->s_sid;
802 } else
803 kp->ki_tdev = NODEV;
804 if (p->p_comm[0] != '\0') {
805 strlcpy(kp->ki_comm, p->p_comm, sizeof(kp->ki_comm));
806 strlcpy(kp->ki_ocomm, p->p_comm, sizeof(kp->ki_ocomm));
807 }
808 kp->ki_siglist = p->p_siglist;
809 SIGSETOR(kp->ki_siglist, td->td_siglist);
810 kp->ki_sigmask = td->td_sigmask;
811 kp->ki_xstat = p->p_xstat;
--- 195 unchanged lines hidden (view full) ---
1007 if ((p->p_flag & P_CONTROLT) == 0 ||
1008 p->p_session == NULL) {
1009 PROC_UNLOCK(p);
1010 continue;
1011 }
1012 SESS_LOCK(p->p_session);
1013 if (p->p_session->s_ttyp == NULL ||
1014 dev2udev(p->p_session->s_ttyp->t_dev) !=
1015 (dev_t)name[0]) {
1016 SESS_UNLOCK(p->p_session);
1017 PROC_UNLOCK(p);
1018 continue;
1019 }
1020 SESS_UNLOCK(p->p_session);
1021 break;
1022
1023 case KERN_PROC_UID:
--- 219 unchanged lines hidden ---
2 * Copyright (c) 1982, 1986, 1989, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
--- 13 unchanged lines hidden (view full) ---
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)kern_proc.c 8.7 (Berkeley) 2/14/95
30 * $FreeBSD: head/sys/kern/kern_proc.c 130640 2004-06-17 17:16:53Z phk $
31 */
32
33#include <sys/cdefs.h>
34__FBSDID("$FreeBSD: head/sys/kern/kern_proc.c 130640 2004-06-17 17:16:53Z phk $");
35
36#include "opt_ktrace.h"
37#include "opt_kstack_pages.h"
38
39#include <sys/param.h>
40#include <sys/systm.h>
41#include <sys/kernel.h>
42#include <sys/lock.h>
--- 752 unchanged lines hidden (view full) ---
795 }
796 }
797 if ((p->p_flag & P_CONTROLT) && tp != NULL) {
798 kp->ki_tdev = dev2udev(tp->t_dev);
799 kp->ki_tpgid = tp->t_pgrp ? tp->t_pgrp->pg_id : NO_PID;
800 if (tp->t_session)
801 kp->ki_tsid = tp->t_session->s_sid;
802 } else
803 kp->ki_tdev = NODEV;
804 if (p->p_comm[0] != '\0') {
805 strlcpy(kp->ki_comm, p->p_comm, sizeof(kp->ki_comm));
806 strlcpy(kp->ki_ocomm, p->p_comm, sizeof(kp->ki_ocomm));
807 }
808 kp->ki_siglist = p->p_siglist;
809 SIGSETOR(kp->ki_siglist, td->td_siglist);
810 kp->ki_sigmask = td->td_sigmask;
811 kp->ki_xstat = p->p_xstat;
--- 195 unchanged lines hidden (view full) ---
1007 if ((p->p_flag & P_CONTROLT) == 0 ||
1008 p->p_session == NULL) {
1009 PROC_UNLOCK(p);
1010 continue;
1011 }
1012 SESS_LOCK(p->p_session);
1013 if (p->p_session->s_ttyp == NULL ||
1014 dev2udev(p->p_session->s_ttyp->t_dev) !=
1015 (dev_t)name[0]) {
1016 SESS_UNLOCK(p->p_session);
1017 PROC_UNLOCK(p);
1018 continue;
1019 }
1020 SESS_UNLOCK(p->p_session);
1021 break;
1022
1023 case KERN_PROC_UID:
--- 219 unchanged lines hidden ---