Subject: Re: p_flag in struct proc: int -> uint64_t
To: None <tech-kern@NetBSD.org>
From: Elad Efrat <elad@NetBSD.org>
List: tech-kern
Date: 10/02/2006 23:22:04
This is a multi-part message in MIME format.
--Boundary_(ID_fnJwrt/a7Oo+za2Lsm8vwg)
Content-type: text/plain; charset=ISO-8859-1
Content-transfer-encoding: 7BIT
David Laight wrote:
> On Mon, Oct 02, 2006 at 01:02:32PM -0700, Bill Studenmund wrote:
>> [...]
>> Another option would be to add a second flags (flags2) member. Older
>> arches will probably prefer this,
>
> I expect in new ones would prefer not to have 64 bit bitfields....
>
>> and we also don't introduce new alignment issues.
>
> Not problems in the sysctl code/structure used for ps(1) when any
> additional fields have to be added at the end in order to maintain
> binary compatibility.
Attached is a sample that adds 'p_flag2'. Tested and seems to be
working... we can use it until we decide if we want plists in struct
proc. :)
-e.
--
Elad Efrat
--Boundary_(ID_fnJwrt/a7Oo+za2Lsm8vwg)
Content-type: text/plain; name=p_flag2.diff
Content-transfer-encoding: 7BIT
Content-disposition: inline; filename=p_flag2.diff
Index: proc.h
===================================================================
RCS file: /cvsroot/src/sys/sys/proc.h,v
retrieving revision 1.225
diff -u -p -r1.225 proc.h
--- proc.h 30 Jul 2006 21:58:11 -0000 1.225
+++ proc.h 2 Oct 2006 21:07:15 -0000
@@ -185,6 +185,7 @@ struct proc {
int p_exitsig; /* signal to send to parent on exit */
int p_flag; /* P_* flags. */
+ int p_flag2; /* second batch of P_* flags. */
char p_stat; /* S* process status. */
char p_pad1[3];
Index: sysctl.h
===================================================================
RCS file: /cvsroot/src/sys/sys/sysctl.h,v
retrieving revision 1.157
diff -u -p -r1.157 sysctl.h
--- sysctl.h 8 Sep 2006 20:58:58 -0000 1.157
+++ sysctl.h 2 Oct 2006 21:07:17 -0000
@@ -561,6 +561,8 @@ struct kinfo_proc2 {
uint64_t p_realstat; /* LONG: non-LWP process status */
uint32_t p_svuid; /* UID_T: saved user id */
uint32_t p_svgid; /* GID_T: saved group id */
+
+ int32_t p_flag2; /* INT: second batch of P_* flags */
};
/*
--Boundary_(ID_fnJwrt/a7Oo+za2Lsm8vwg)--