Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys For the KERN_PROC sysctl, when using KERN_PROC_TTY allow
details: https://anonhg.NetBSD.org/src/rev/863f2134b7ef
branches: trunk
changeset: 484931:863f2134b7ef
user: simonb <simonb%NetBSD.org@localhost>
date: Sat Apr 15 04:38:07 2000 +0000
description:
For the KERN_PROC sysctl, when using KERN_PROC_TTY allow
KERN_PROC_TTY_NODEV to select processes with no controlling
tty and KERN_PROC_TTY_REVOKE to select processes with a
revoked controlling tty.
diffstat:
sys/kern/kern_sysctl.c | 18 +++++++++++++-----
sys/sys/sysctl.h | 8 +++++++-
2 files changed, 20 insertions(+), 6 deletions(-)
diffs (61 lines):
diff -r efff0a3c7116 -r 863f2134b7ef sys/kern/kern_sysctl.c
--- a/sys/kern/kern_sysctl.c Sat Apr 15 03:08:12 2000 +0000
+++ b/sys/kern/kern_sysctl.c Sat Apr 15 04:38:07 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_sysctl.c,v 1.60 2000/03/30 09:27:12 augustss Exp $ */
+/* $NetBSD: kern_sysctl.c,v 1.61 2000/04/15 04:38:07 simonb Exp $ */
/*-
* Copyright (c) 1982, 1986, 1989, 1993
@@ -995,9 +995,17 @@
break;
case KERN_PROC_TTY:
- if ((p->p_flag & P_CONTROLT) == 0 ||
- p->p_session->s_ttyp == NULL ||
- p->p_session->s_ttyp->t_dev != (dev_t)name[1])
+ if (name[1] == KERN_PROC_TTY_REVOKE) {
+ if ((p->p_flag & P_CONTROLT) == 0 ||
+ p->p_session->s_ttyp == NULL ||
+ p->p_session->s_ttyvp != NULL)
+ continue;
+ } else if ((p->p_flag & P_CONTROLT) == 0 ||
+ p->p_session->s_ttyp == NULL) {
+ if ((dev_t)name[1] != KERN_PROC_TTY_NODEV)
+ continue;
+ } else if (p->p_session->s_ttyp->t_dev !=
+ (dev_t)name[1])
continue;
break;
@@ -1056,7 +1064,7 @@
struct tty *tp;
ep->e_paddr = p;
- ep->e_sess = p->p_pgrp->pg_session;
+ ep->e_sess = p->p_session;
ep->e_pcred = *p->p_cred;
ep->e_ucred = *p->p_ucred;
if (p->p_stat == SIDL || P_ZOMBIE(p)) {
diff -r efff0a3c7116 -r 863f2134b7ef sys/sys/sysctl.h
--- a/sys/sys/sysctl.h Sat Apr 15 03:08:12 2000 +0000
+++ b/sys/sys/sysctl.h Sat Apr 15 04:38:07 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sysctl.h,v 1.42 2000/03/28 05:07:42 simonb Exp $ */
+/* $NetBSD: sysctl.h,v 1.43 2000/04/15 04:38:08 simonb Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -222,6 +222,12 @@
#define KERN_PROC_RUID 6 /* by real uid */
/*
+ * KERN_PROC_TTY sub-subtypes
+ */
+#define KERN_PROC_TTY_NODEV NODEV /* no controlling tty */
+#define KERN_PROC_TTY_REVOKE ((dev_t)-2) /* revoked tty */
+
+/*
* KERN_PROC subtype ops return arrays of augmented proc structures:
*/
struct kinfo_proc {
Home |
Main Index |
Thread Index |
Old Index