Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 /*
0003  *  BSD Process Accounting for Linux - Definitions
0004  *
0005  *  Author: Marco van Wieringen (mvw@planets.elm.net)
0006  *
0007  *  This header file contains the definitions needed to implement
0008  *  BSD-style process accounting. The kernel accounting code and all
0009  *  user-level programs that try to do something useful with the
0010  *  process accounting log must include this file.
0011  *
0012  *  Copyright (C) 1995 - 1997 Marco van Wieringen - ELM Consultancy B.V.
0013  *
0014  */
0015 
0016 #ifndef _UAPI_LINUX_ACCT_H
0017 #define _UAPI_LINUX_ACCT_H
0018 
0019 #include <linux/types.h>
0020 
0021 #include <asm/param.h>
0022 #include <asm/byteorder.h>
0023 
0024 /* 
0025  *  comp_t is a 16-bit "floating" point number with a 3-bit base 8
0026  *  exponent and a 13-bit fraction.
0027  *  comp2_t is 24-bit with 5-bit base 2 exponent and 20 bit fraction
0028  *  (leading 1 not stored).
0029  *  See linux/kernel/acct.c for the specific encoding systems used.
0030  */
0031 
0032 typedef __u16   comp_t;
0033 typedef __u32   comp2_t;
0034 
0035 /*
0036  *   accounting file record
0037  *
0038  *   This structure contains all of the information written out to the
0039  *   process accounting file whenever a process exits.
0040  */
0041 
0042 #define ACCT_COMM   16
0043 
0044 struct acct
0045 {
0046     char        ac_flag;        /* Flags */
0047     char        ac_version;     /* Always set to ACCT_VERSION */
0048     /* for binary compatibility back until 2.0 */
0049     __u16       ac_uid16;       /* LSB of Real User ID */
0050     __u16       ac_gid16;       /* LSB of Real Group ID */
0051     __u16       ac_tty;         /* Control Terminal */
0052     /* __u32 range means times from 1970 to 2106 */
0053     __u32       ac_btime;       /* Process Creation Time */
0054     comp_t      ac_utime;       /* User Time */
0055     comp_t      ac_stime;       /* System Time */
0056     comp_t      ac_etime;       /* Elapsed Time */
0057     comp_t      ac_mem;         /* Average Memory Usage */
0058     comp_t      ac_io;          /* Chars Transferred */
0059     comp_t      ac_rw;          /* Blocks Read or Written */
0060     comp_t      ac_minflt;      /* Minor Pagefaults */
0061     comp_t      ac_majflt;      /* Major Pagefaults */
0062     comp_t      ac_swaps;       /* Number of Swaps */
0063 /* m68k had no padding here. */
0064 #if !defined(CONFIG_M68K) || !defined(__KERNEL__)
0065     __u16       ac_ahz;         /* AHZ */
0066 #endif
0067     __u32       ac_exitcode;        /* Exitcode */
0068     char        ac_comm[ACCT_COMM + 1]; /* Command Name */
0069     __u8        ac_etime_hi;        /* Elapsed Time MSB */
0070     __u16       ac_etime_lo;        /* Elapsed Time LSB */
0071     __u32       ac_uid;         /* Real User ID */
0072     __u32       ac_gid;         /* Real Group ID */
0073 };
0074 
0075 struct acct_v3
0076 {
0077     char        ac_flag;        /* Flags */
0078     char        ac_version;     /* Always set to ACCT_VERSION */
0079     __u16       ac_tty;         /* Control Terminal */
0080     __u32       ac_exitcode;        /* Exitcode */
0081     __u32       ac_uid;         /* Real User ID */
0082     __u32       ac_gid;         /* Real Group ID */
0083     __u32       ac_pid;         /* Process ID */
0084     __u32       ac_ppid;        /* Parent Process ID */
0085     /* __u32 range means times from 1970 to 2106 */
0086     __u32       ac_btime;       /* Process Creation Time */
0087 #ifdef __KERNEL__
0088     __u32       ac_etime;       /* Elapsed Time */
0089 #else
0090     float       ac_etime;       /* Elapsed Time */
0091 #endif
0092     comp_t      ac_utime;       /* User Time */
0093     comp_t      ac_stime;       /* System Time */
0094     comp_t      ac_mem;         /* Average Memory Usage */
0095     comp_t      ac_io;          /* Chars Transferred */
0096     comp_t      ac_rw;          /* Blocks Read or Written */
0097     comp_t      ac_minflt;      /* Minor Pagefaults */
0098     comp_t      ac_majflt;      /* Major Pagefaults */
0099     comp_t      ac_swaps;       /* Number of Swaps */
0100     char        ac_comm[ACCT_COMM]; /* Command Name */
0101 };
0102 
0103 /*
0104  *  accounting flags
0105  */
0106                 /* bit set when the process/task ... */
0107 #define AFORK       0x01    /* ... executed fork, but did not exec */
0108 #define ASU     0x02    /* ... used super-user privileges */
0109 #define ACOMPAT     0x04    /* ... used compatibility mode (VAX only not used) */
0110 #define ACORE       0x08    /* ... dumped core */
0111 #define AXSIG       0x10    /* ... was killed by a signal */
0112 #define AGROUP      0x20    /* ... was the last task of the process (task group) */
0113 
0114 #if defined(__BYTE_ORDER) ? __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN)
0115 #define ACCT_BYTEORDER  0x80    /* accounting file is big endian */
0116 #elif defined(__BYTE_ORDER) ? __BYTE_ORDER == __LITTLE_ENDIAN : defined(__LITTLE_ENDIAN)
0117 #define ACCT_BYTEORDER  0x00    /* accounting file is little endian */
0118 #else
0119 #error unspecified endianness
0120 #endif
0121 
0122 #ifndef __KERNEL__
0123 #define ACCT_VERSION    2
0124 #define AHZ     (HZ)
0125 #endif  /* __KERNEL */
0126 
0127 
0128 #endif /* _UAPI_LINUX_ACCT_H */