acct.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /* Copyright (C) 1996, 1997, 1998, 1999, 2007 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public
  5. License as published by the Free Software Foundation; either
  6. version 2.1 of the License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with the GNU C Library; if not, write to the Free
  13. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  14. 02111-1307 USA. */
  15. #ifndef _SYS_ACCT_H
  16. #define _SYS_ACCT_H 1
  17. #include <features.h>
  18. #include <endian.h>
  19. #define __need_time_t
  20. #include <time.h>
  21. #include <sys/types.h>
  22. __BEGIN_DECLS
  23. #define ACCT_COMM 16
  24. /*
  25. comp_t is a 16-bit "floating" point number with a 3-bit base 8
  26. exponent and a 13-bit fraction. See linux/kernel/acct.c for the
  27. specific encoding system used.
  28. */
  29. typedef u_int16_t comp_t;
  30. struct acct
  31. {
  32. char ac_flag; /* Flags. */
  33. u_int16_t ac_uid; /* Real user ID. */
  34. u_int16_t ac_gid; /* Real group ID. */
  35. u_int16_t ac_tty; /* Controlling terminal. */
  36. u_int32_t ac_btime; /* Beginning time. */
  37. comp_t ac_utime; /* User time. */
  38. comp_t ac_stime; /* System time. */
  39. comp_t ac_etime; /* Elapsed time. */
  40. comp_t ac_mem; /* Average memory usage. */
  41. comp_t ac_io; /* Chars transferred. */
  42. comp_t ac_rw; /* Blocks read or written. */
  43. comp_t ac_minflt; /* Minor pagefaults. */
  44. comp_t ac_majflt; /* Major pagefaults. */
  45. comp_t ac_swaps; /* Number of swaps. */
  46. u_int32_t ac_exitcode; /* Process exitcode. */
  47. char ac_comm[ACCT_COMM+1]; /* Command name. */
  48. char ac_pad[10]; /* Padding bytes. */
  49. };
  50. #if 0
  51. struct acct_v3
  52. {
  53. char ac_flag; /* Flags */
  54. char ac_version; /* Always set to ACCT_VERSION */
  55. u_int16_t ac_tty; /* Control Terminal */
  56. u_int32_t ac_exitcode; /* Exitcode */
  57. u_int32_t ac_uid; /* Real User ID */
  58. u_int32_t ac_gid; /* Real Group ID */
  59. u_int32_t ac_pid; /* Process ID */
  60. u_int32_t ac_ppid; /* Parent Process ID */
  61. u_int32_t ac_btime; /* Process Creation Time */
  62. float ac_etime; /* Elapsed Time */
  63. comp_t ac_utime; /* User Time */
  64. comp_t ac_stime; /* System Time */
  65. comp_t ac_mem; /* Average Memory Usage */
  66. comp_t ac_io; /* Chars Transferred */
  67. comp_t ac_rw; /* Blocks Read or Written */
  68. comp_t ac_minflt; /* Minor Pagefaults */
  69. comp_t ac_majflt; /* Major Pagefaults */
  70. comp_t ac_swaps; /* Number of Swaps */
  71. char ac_comm[ACCT_COMM]; /* Command Name */
  72. };
  73. #endif
  74. enum
  75. {
  76. AFORK = 0x01, /* Has executed fork, but no exec. */
  77. ASU = 0x02, /* Used super-user privileges. */
  78. ACORE = 0x08, /* Dumped core. */
  79. AXSIG = 0x10 /* Killed by a signal. */
  80. };
  81. #if __BYTE_ORDER == __BIG_ENDIAN
  82. # define ACCT_BYTEORDER 0x80 /* Accounting file is big endian. */
  83. #else
  84. # define ACCT_BYTEORDER 0x00 /* Accounting file is little endian. */
  85. #endif
  86. #define AHZ 100
  87. /* Switch process accounting on and off. */
  88. extern int acct (__const char *__filename) __THROW;
  89. __END_DECLS
  90. #endif /* sys/acct.h */