Messages in this thread Patch in this message | | | Date | Wed, 3 Apr 2002 17:36:34 -0500 (EST) | From | "Mike A. Harris" <> | Subject | [PATCH] Process Accounting 32bit UID/GID support |
| |
(Apologies to anyone getting this as a dupe, my first mail bounced)
After receiving a handful of bug reports about process accounting not working properly with 32bit UID/GID's, and investigating the problem, I discovered the reason was that it just was not implemented yet. After briefly discussing this with Alan and Arjan, I've created support for this feature, while maintaining full binary backward compatibility with existing tools.
I've also hacked the userland acct package (psacct in Red Hat Linux) to support the new feature as well, while also remaining backward compatible with kernels that do not have the new 32bit UID/GID patch.
Marcelo, could you add this to the 2.4.x queue?
TIA
-- Mike A. Harris Shipping/mailing address: OS Systems Engineer 190 Pittsburgh Ave., Sault Ste. Marie, XFree86 maintainer Ontario, Canada, P6C 5B3 Red Hat Inc. http://www.redhat.com ftp://people.redhat.com/mharris --- ./kernel/acct.c.psacct-32bit-uid-gid Mon Apr 1 12:43:33 2002 +++ ./kernel/acct.c Wed Apr 3 10:17:43 2002 @@ -8,6 +8,9 @@ * Some code based on ideas and code from: * Thomas K. Dyas <tdyas@eden.rutgers.edu> * + * April 2, 2002 - Mike A. Harris <mharris@redhat.com> + * - added 32bit UID/GID support + * * This file implements BSD-style process accounting. Whenever any * process exits, an accounting record of type "struct acct" is * written to the file specified with the acct() system call. It is @@ -298,8 +301,10 @@ ac.ac_etime = encode_comp_t(jiffies - current->start_time); ac.ac_utime = encode_comp_t(current->times.tms_utime); ac.ac_stime = encode_comp_t(current->times.tms_stime); - ac.ac_uid = current->uid; - ac.ac_gid = current->gid; + ac.ac_uid = high2lowuid(current->uid); + ac.ac_gid = high2lowgid(current->gid); + ac.ac_uid32 = current->uid; + ac.ac_gid32 = current->gid; ac.ac_tty = (current->tty) ? kdev_t_to_nr(current->tty->device) : 0; ac.ac_flag = 0; --- ./include/linux/acct.h.psacct-32bit-uid-gid Mon Apr 1 12:39:28 2002 +++ ./include/linux/acct.h Wed Apr 3 10:18:40 2002 @@ -3,6 +3,9 @@ * * Author: Marco van Wieringen (mvw@planets.elm.net) * + * + * April 2, 2002 - Mike A. Harris <mharris@redhat.com> + * - added 32bit UID/GID support * This header file contains the definitions needed to implement * BSD-style process accounting. The kernel accounting code and all * user-level programs that try to do something useful with the @@ -56,7 +59,9 @@ comp_t ac_swaps; /* Accounting Number of Swaps */ __u32 ac_exitcode; /* Accounting Exitcode */ char ac_comm[ACCT_COMM + 1]; /* Accounting Command Name */ - char ac_pad[10]; /* Accounting Padding Bytes */ + __u32 ac_uid32; /* Accounting Real 32bit User ID */ + __u32 ac_gid32; /* Accounting Real 32bit Group ID */ + char ac_pad[2]; /* Accounting Padding Bytes */ }; /* | |