Date: Fri, 09 Jul 1999 23:29:33 +0200 From: Poul-Henning Kamp <phk@critter.freebsd.dk> To: "D. Rock" <rock@dead-end.net> Cc: current@FreeBSD.ORG Subject: Re: dev_t and system accounting Message-ID: <5191.931555773@critter.freebsd.dk> In-Reply-To: Your message of "Fri, 09 Jul 1999 22:14:10 %2B0200." <37865812.DC1A235C@dead-end.net>
next in thread | previous in thread | raw e-mail | index | archive | help
In message <37865812.DC1A235C@dead-end.net>, "D. Rock" writes:
>Hi,
>
>the new dev_t stuff in the kernel keeps system accounting showing up
>the tty properly. After taking a look at the fix for the swap device,
>I propose the following equivalent fix:
Looks good, could you try this version for me ?
Index: sys/acct.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/acct.h,v
retrieving revision 1.9
diff -u -r1.9 acct.h
--- acct.h 1998/02/01 20:08:35 1.9
+++ acct.h 1999/07/09 21:27:49
@@ -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 @@
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 @@
#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.
Index: kern/kern_acct.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/kern_acct.c,v
retrieving revision 1.20
diff -u -r1.20 kern_acct.c
--- kern_acct.c 1999/04/27 11:15:53 1.20
+++ kern_acct.c 1999/07/09 21:26:44
@@ -221,9 +221,9 @@
/* (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;
--
Poul-Henning Kamp FreeBSD coreteam member
phk@FreeBSD.ORG "Real hackers run -current on their laptop."
FreeBSD -- It will take a long time before progress goes too far!
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5191.931555773>
