utmpx.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /* Structures and definitions for the user accounting database. GNU version.
  2. Copyright (C) 1997, 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, write to the Free
  14. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  15. 02111-1307 USA. */
  16. #ifndef _UTMPX_H
  17. # error "Never include <bits/utmpx.h> directly; use <utmpx.h> instead."
  18. #endif
  19. #include <bits/types.h>
  20. #include <sys/time.h>
  21. #include <bits/wordsize.h>
  22. #ifdef __USE_GNU
  23. # include <paths.h>
  24. # define _PATH_UTMPX _PATH_UTMP
  25. # define _PATH_WTMPX _PATH_WTMP
  26. #endif
  27. #define __UT_LINESIZE 32
  28. #define __UT_NAMESIZE 32
  29. #define __UT_HOSTSIZE 256
  30. /* The structure describing the status of a terminated process. This
  31. type is used in `struct utmpx' below. */
  32. struct __exit_status
  33. {
  34. #ifdef __USE_GNU
  35. short int e_termination; /* Process termination status. */
  36. short int e_exit; /* Process exit status. */
  37. #else
  38. short int __e_termination; /* Process termination status. */
  39. short int __e_exit; /* Process exit status. */
  40. #endif
  41. };
  42. /* The structure describing an entry in the user accounting database. */
  43. struct utmpx
  44. {
  45. short int ut_type; /* Type of login. */
  46. __pid_t ut_pid; /* Process ID of login process. */
  47. char ut_line[__UT_LINESIZE]; /* Devicename. */
  48. char ut_id[4]; /* Inittab ID. */
  49. char ut_user[__UT_NAMESIZE]; /* Username. */
  50. char ut_host[__UT_HOSTSIZE]; /* Hostname for remote login. */
  51. struct __exit_status ut_exit; /* Exit status of a process marked
  52. as DEAD_PROCESS. */
  53. /* The fields ut_session and ut_tv must be the same size when compiled
  54. 32- and 64-bit. This allows files and shared memory to be shared
  55. between 32- and 64-bit applications. */
  56. #if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32
  57. __int32_t ut_session; /* Session ID, used for windowing. */
  58. struct
  59. {
  60. __int32_t tv_sec; /* Seconds. */
  61. __int32_t tv_usec; /* Microseconds. */
  62. } ut_tv; /* Time entry was made. */
  63. #else
  64. long int ut_session; /* Session ID, used for windowing. */
  65. struct timeval ut_tv; /* Time entry was made. */
  66. #endif
  67. __int32_t ut_addr_v6[4]; /* Internet address of remote host. */
  68. char __unused[20]; /* Reserved for future use. */
  69. };
  70. /* Values for the `ut_type' field of a `struct utmpx'. */
  71. #define EMPTY 0 /* No valid user accounting information. */
  72. #ifdef __USE_GNU
  73. # define RUN_LVL 1 /* The system's runlevel. */
  74. #endif
  75. #define BOOT_TIME 2 /* Time of system boot. */
  76. #define NEW_TIME 3 /* Time after system clock changed. */
  77. #define OLD_TIME 4 /* Time when system clock changed. */
  78. #define INIT_PROCESS 5 /* Process spawned by the init process. */
  79. #define LOGIN_PROCESS 6 /* Session leader of a logged in user. */
  80. #define USER_PROCESS 7 /* Normal process. */
  81. #define DEAD_PROCESS 8 /* Terminated process. */
  82. #ifdef __USE_GNU
  83. # define ACCOUNTING 9 /* System accounting. */
  84. #endif