Back to index

glibc  2.9
acct.h
Go to the documentation of this file.
00001 /* Copyright (C) 1996, 1997, 1998, 1999, 2007 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003 
00004    The GNU C Library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Lesser General Public
00006    License as published by the Free Software Foundation; either
00007    version 2.1 of the License, or (at your option) any later version.
00008 
00009    The GNU C Library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Lesser General Public License for more details.
00013 
00014    You should have received a copy of the GNU Lesser General Public
00015    License along with the GNU C Library; if not, write to the Free
00016    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00017    02111-1307 USA.  */
00018 
00019 #ifndef _SYS_ACCT_H
00020 #define _SYS_ACCT_H  1
00021 
00022 #include <features.h>
00023 
00024 #include <endian.h>
00025 #define       __need_time_t
00026 #include <time.h>
00027 #include <sys/types.h>
00028 
00029 __BEGIN_DECLS
00030 
00031 #define ACCT_COMM 16
00032 
00033 /*
00034   comp_t is a 16-bit "floating" point number with a 3-bit base 8
00035   exponent and a 13-bit fraction. See linux/kernel/acct.c for the
00036   specific encoding system used.
00037 */
00038 
00039 typedef u_int16_t comp_t;
00040 
00041 struct acct
00042 {
00043   char ac_flag;                    /* Flags.  */
00044   u_int16_t ac_uid;         /* Real user ID.  */
00045   u_int16_t ac_gid;         /* Real group ID.  */
00046   u_int16_t ac_tty;         /* Controlling terminal.  */
00047   u_int32_t ac_btime;              /* Beginning time.  */
00048   comp_t ac_utime;          /* User time.  */
00049   comp_t ac_stime;          /* System time.  */
00050   comp_t ac_etime;          /* Elapsed time.  */
00051   comp_t ac_mem;            /* Average memory usage.  */
00052   comp_t ac_io;                    /* Chars transferred.  */
00053   comp_t ac_rw;                    /* Blocks read or written.  */
00054   comp_t ac_minflt;         /* Minor pagefaults.  */
00055   comp_t ac_majflt;         /* Major pagefaults.  */
00056   comp_t ac_swaps;          /* Number of swaps.  */
00057   u_int32_t ac_exitcode;    /* Process exitcode.  */
00058   char ac_comm[ACCT_COMM+1];       /* Command name.  */
00059   char ac_pad[10];          /* Padding bytes.  */
00060 };
00061 
00062 
00063 struct acct_v3
00064 {
00065   char ac_flag;                    /* Flags */
00066   char ac_version;          /* Always set to ACCT_VERSION */
00067   u_int16_t ac_tty;         /* Control Terminal */
00068   u_int32_t ac_exitcode;    /* Exitcode */
00069   u_int32_t ac_uid;         /* Real User ID */
00070   u_int32_t ac_gid;         /* Real Group ID */
00071   u_int32_t ac_pid;         /* Process ID */
00072   u_int32_t ac_ppid;        /* Parent Process ID */
00073   u_int32_t ac_btime;              /* Process Creation Time */
00074   float ac_etime;           /* Elapsed Time */
00075   comp_t ac_utime;          /* User Time */
00076   comp_t ac_stime;          /* System Time */
00077   comp_t ac_mem;            /* Average Memory Usage */
00078   comp_t ac_io;                    /* Chars Transferred */
00079   comp_t ac_rw;                    /* Blocks Read or Written */
00080   comp_t ac_minflt;         /* Minor Pagefaults */
00081   comp_t ac_majflt;         /* Major Pagefaults */
00082   comp_t ac_swaps;          /* Number of Swaps */
00083   char ac_comm[ACCT_COMM];  /* Command Name */
00084 };
00085 
00086 
00087 enum
00088   {
00089     AFORK = 0x01,           /* Has executed fork, but no exec.  */
00090     ASU = 0x02,                    /* Used super-user privileges.  */
00091     ACORE = 0x08,           /* Dumped core.  */
00092     AXSIG = 0x10            /* Killed by a signal.  */
00093   };
00094 
00095 #if __BYTE_ORDER == __BIG_ENDIAN
00096 # define ACCT_BYTEORDER 0x80       /* Accounting file is big endian.  */
00097 #else
00098 # define ACCT_BYTEORDER 0x00       /* Accounting file is little endian.  */
00099 #endif
00100 
00101 #define AHZ     100
00102 
00103 
00104 /* Switch process accounting on and off.  */
00105 extern int acct (__const char *__filename) __THROW;
00106 
00107 __END_DECLS
00108 
00109 #endif /* sys/acct.h */