From 358dfb0319f43843affeda044fb91b3e385a5cf5 Mon Sep 17 00:00:00 2001 From: phk Date: Sat, 10 Jul 1999 06:27:36 +0000 Subject: [PATCH] Fix a dev_t/udev_t issue with accounting. lastcomm now shows the right tty again. Submitted by: "D. Rock" Reviewed by: phk --- sys/kern/kern_acct.c | 6 +++--- sys/sys/acct.h | 11 +++++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/sys/kern/kern_acct.c b/sys/kern/kern_acct.c index 61e49abef179..f76c2e2191b1 100644 --- a/sys/kern/kern_acct.c +++ b/sys/kern/kern_acct.c @@ -37,7 +37,7 @@ * SUCH DAMAGE. * * @(#)kern_acct.c 8.1 (Berkeley) 6/14/93 - * $Id: kern_acct.c,v 1.19 1998/06/05 21:44:19 dg Exp $ + * $Id: kern_acct.c,v 1.20 1999/04/27 11:15:53 phk Exp $ */ #include @@ -221,9 +221,9 @@ acct_process(p) /* (7) The terminal from which the process was started */ if ((p->p_flag & P_CONTROLT) && p->p_pgrp->pg_session->s_ttyp) - acct.ac_tty = p->p_pgrp->pg_session->s_ttyp->t_dev; + acct.ac_tty = dev2udev(p->p_pgrp->pg_session->s_ttyp->t_dev); else - acct.ac_tty = NODEV; + acct.ac_tty = NOUDEV; /* (8) The boolean flags that tell how the process terminated, etc. */ acct.ac_flag = p->p_acflag; diff --git a/sys/sys/acct.h b/sys/sys/acct.h index ddaef2dd4e6e..e38675d1ae5a 100644 --- a/sys/sys/acct.h +++ b/sys/sys/acct.h @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)acct.h 8.4 (Berkeley) 1/9/95 - * $Id: acct.h,v 1.8 1997/02/22 09:44:48 peter Exp $ + * $Id: acct.h,v 1.9 1998/02/01 20:08:35 bde Exp $ */ #ifndef _SYS_ACCT_H_ @@ -49,6 +49,12 @@ */ typedef u_int16_t comp_t; +#ifdef KERNEL +#define __dev_t udev_t +#else +#define __dev_t dev_t +#endif + #define AC_COMM_LEN 16 struct acct { char ac_comm[AC_COMM_LEN]; /* command name */ @@ -60,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 */ #define AFORK 0x01 /* forked but not exec'ed */ #define ASU 0x02 /* used super-user permissions */ @@ -69,6 +75,7 @@ struct acct { #define AXSIG 0x10 /* killed by a signal */ u_int8_t ac_flag; /* accounting flags */ }; +#undef __dev_t /* * 1/AHZ is the granularity of the data encoded in the comp_t fields.