Fix a dev_t/udev_t issue with accounting. lastcomm now shows the

right tty again.

Submitted by:	"D. Rock" <rock@dead-end.net>
Reviewed by:	phk
This commit is contained in:
phk 1999-07-10 06:27:36 +00:00
parent 416153043a
commit 358dfb0319
2 changed files with 12 additions and 5 deletions

View File

@ -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 <sys/param.h>
@ -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;

View File

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