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
This commit is contained in:
deraadt 2021-12-13 16:37:37 +00:00
parent 9e257558e2
commit 5e1064a7ac
4 changed files with 11 additions and 12 deletions

View File

@ -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 */

View File

@ -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;

View File

@ -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 */

View File

@ -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);