summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2021-12-13 16:37:38 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2021-12-13 16:37:38 +0000
commitba1590a4b017c07576ce93524f047637c9acbcea (patch)
treed334c30bc23bef8e9958e5effc64fa96ac185c7d
parentb5a48fb59d56fd5cd0c65a32b200d21132781170 (diff)
acct(4) ac_tty shouldn't need NODEV from sys/param.h (which is kernel API),
-1 is sufficient to indicate the process had no controlling tty, removing one more sys/param.h include in our userland ok millert
-rw-r--r--share/man/man5/acct.56
-rw-r--r--sys/kern/kern_acct.c4
-rw-r--r--sys/sys/acct.h4
-rw-r--r--usr.bin/lastcomm/lastcomm.c9
4 files changed, 11 insertions, 12 deletions
diff --git a/share/man/man5/acct.5 b/share/man/man5/acct.5
index cbadbc43651..a2d17bec782 100644
--- a/share/man/man5/acct.5
+++ b/share/man/man5/acct.5
@@ -1,4 +1,4 @@
-.\" $OpenBSD: acct.5,v 1.24 2021/02/04 02:03:53 rob Exp $
+.\" $OpenBSD: acct.5,v 1.25 2021/12/13 16:37:37 deraadt Exp $
.\" $NetBSD: acct.5,v 1.4 1995/10/22 01:40:10 ghudson Exp $
.\"
.\" Copyright (c) 1991, 1993
@@ -30,7 +30,7 @@
.\"
.\" @(#)acct.5 8.1 (Berkeley) 6/5/93
.\"
-.Dd $Mdocdate: February 4 2021 $
+.Dd $Mdocdate: December 13 2021 $
.Dt ACCT 5
.Os
.Sh NAME
@@ -66,7 +66,7 @@ struct acct {
gid_t ac_gid; /* group id */
u_int16_t ac_mem; /* average memory usage */
comp_t ac_io; /* count of IO blocks */
- dev_t ac_tty; /* controlling tty */
+ dev_t ac_tty; /* controlling tty, or -1 */
#define AFORK 0x01 /* fork'd but not exec'd */
#define AMAP 0x04 /* system call or stack mapping violation */
diff --git a/sys/kern/kern_acct.c b/sys/kern/kern_acct.c
index 46cd094f47a..e8499529eeb 100644
--- a/sys/kern/kern_acct.c
+++ b/sys/kern/kern_acct.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_acct.c,v 1.44 2021/01/29 00:31:41 rob Exp $ */
+/* $OpenBSD: kern_acct.c,v 1.45 2021/12/13 16:37:37 deraadt Exp $ */
/* $NetBSD: kern_acct.c,v 1.42 1996/02/04 02:15:12 christos Exp $ */
/*-
@@ -230,7 +230,7 @@ acct_process(struct proc *p)
pr->ps_pgrp->pg_session->s_ttyp)
acct.ac_tty = pr->ps_pgrp->pg_session->s_ttyp->t_dev;
else
- acct.ac_tty = NODEV;
+ acct.ac_tty = -1;
/* (8) The boolean flags that tell how process terminated or misbehaved. */
acct.ac_flag = pr->ps_acflag;
diff --git a/sys/sys/acct.h b/sys/sys/acct.h
index 2bf59d06ba1..e802b258a84 100644
--- a/sys/sys/acct.h
+++ b/sys/sys/acct.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: acct.h,v 1.10 2021/02/04 02:03:53 rob Exp $ */
+/* $OpenBSD: acct.h,v 1.11 2021/12/13 16:37:37 deraadt Exp $ */
/* $NetBSD: acct.h,v 1.16 1995/03/26 20:23:52 jtc Exp $ */
/*-
@@ -54,7 +54,7 @@ struct acct {
gid_t ac_gid; /* group id */
u_int16_t ac_mem; /* average memory usage */
comp_t ac_io; /* count of IO blocks */
- dev_t ac_tty; /* controlling tty */
+ dev_t ac_tty; /* controlling tty, or -1 */
#define AFORK 0x01 /* fork'd but not exec'd */
#define AMAP 0x04 /* system call or stack mapping violation */
diff --git a/usr.bin/lastcomm/lastcomm.c b/usr.bin/lastcomm/lastcomm.c
index 949afc0cfb8..b9261145063 100644
--- a/usr.bin/lastcomm/lastcomm.c
+++ b/usr.bin/lastcomm/lastcomm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lastcomm.c,v 1.29 2019/09/09 20:02:27 bluhm Exp $ */
+/* $OpenBSD: lastcomm.c,v 1.30 2021/12/13 16:37:37 deraadt Exp $ */
/* $NetBSD: lastcomm.c,v 1.9 1995/10/22 01:43:42 ghudson Exp $ */
/*
@@ -30,7 +30,7 @@
* SUCH DAMAGE.
*/
-#include <sys/param.h> /* NODEV */
+#include <sys/types.h>
#include <sys/stat.h>
#include <sys/acct.h>
@@ -118,8 +118,7 @@ main(int argc, char *argv[])
p < &ab.ac_comm[sizeof ab.ac_comm] && *p; ++p)
if (!isprint((unsigned char)*p))
*p = '?';
- if (!*argv || requested(argv, &ab))
- {
+ if (!*argv || requested(argv, &ab)) {
t = expand(ab.ac_utime) + expand(ab.ac_stime);
(void)printf("%-*.*s %-7s %-*.*s %-*.*s %6.2f secs %.16s",
(int)sizeof ab.ac_comm,
@@ -199,7 +198,7 @@ getdev(dev_t dev)
static dev_t lastdev = (dev_t)-1;
static char *lastname;
- if (dev == NODEV) /* Special case. */
+ if (dev == -1) /* Special case. */
return ("__");
if (dev == lastdev) /* One-element cache. */
return (lastname);