acct.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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, see
  13. <http://www.gnu.org/licenses/>. */
  14. #ifndef _SYS_ACCT_H
  15. #define _SYS_ACCT_H 1
  16. #include <features.h>
  17. #include <endian.h>
  18. #define __need_time_t
  19. #include <time.h>
  20. #include <sys/types.h>
  21. __BEGIN_DECLS
  22. #define ACCT_COMM 16
  23. /*
  24. comp_t is a 16-bit "floating" point number with a 3-bit base 8
  25. exponent and a 13-bit fraction. See linux/kernel/acct.c for the
  26. specific encoding system used.
  27. */
  28. typedef u_int16_t comp_t;
  29. struct acct
  30. {
  31. char ac_flag; /* Flags. */
  32. u_int16_t ac_uid; /* Real user ID. */
  33. u_int16_t ac_gid; /* Real group ID. */
  34. u_int16_t ac_tty; /* Controlling terminal. */
  35. u_int32_t ac_btime; /* Beginning time. */
  36. comp_t ac_utime; /* User time. */
  37. comp_t ac_stime; /* System time. */
  38. comp_t ac_etime; /* Elapsed time. */
  39. comp_t ac_mem; /* Average memory usage. */
  40. comp_t ac_io; /* Chars transferred. */
  41. comp_t ac_rw; /* Blocks read or written. */
  42. comp_t ac_minflt; /* Minor pagefaults. */
  43. comp_t ac_majflt; /* Major pagefaults. */
  44. comp_t ac_swaps; /* Number of swaps. */
  45. u_int32_t ac_exitcode; /* Process exitcode. */
  46. char ac_comm[ACCT_COMM+1]; /* Command name. */
  47. char ac_pad[10]; /* Padding bytes. */
  48. };
  49. #if 0
  50. struct acct_v3
  51. {
  52. char ac_flag; /* Flags */
  53. char ac_version; /* Always set to ACCT_VERSION */
  54. u_int16_t ac_tty; /* Control Terminal */
  55. u_int32_t ac_exitcode; /* Exitcode */
  56. u_int32_t ac_uid; /* Real User ID */
  57. u_int32_t ac_gid; /* Real Group ID */
  58. u_int32_t ac_pid; /* Process ID */
  59. u_int32_t ac_ppid; /* Parent Process ID */
  60. u_int32_t ac_btime; /* Process Creation Time */
  61. float ac_etime; /* Elapsed Time */
  62. comp_t ac_utime; /* User Time */
  63. comp_t ac_stime; /* System Time */
  64. comp_t ac_mem; /* Average Memory Usage */
  65. comp_t ac_io; /* Chars Transferred */
  66. comp_t ac_rw; /* Blocks Read or Written */
  67. comp_t ac_minflt; /* Minor Pagefaults */
  68. comp_t ac_majflt; /* Major Pagefaults */
  69. comp_t ac_swaps; /* Number of Swaps */
  70. char ac_comm[ACCT_COMM]; /* Command Name */
  71. };
  72. #endif
  73. enum
  74. {
  75. AFORK = 0x01, /* Has executed fork, but no exec. */
  76. ASU = 0x02, /* Used super-user privileges. */
  77. ACORE = 0x08, /* Dumped core. */
  78. AXSIG = 0x10 /* Killed by a signal. */
  79. };
  80. #if __BYTE_ORDER == __BIG_ENDIAN
  81. # define ACCT_BYTEORDER 0x80 /* Accounting file is big endian. */
  82. #else
  83. # define ACCT_BYTEORDER 0x00 /* Accounting file is little endian. */
  84. #endif
  85. #define AHZ 100
  86. /* Switch process accounting on and off. */
  87. extern int acct (const char *__filename) __THROW;
  88. __END_DECLS
  89. #endif /* sys/acct.h */