utmpx.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /* Structures and definitions for the user accounting database. GNU version.
  2. Copyright (C) 1997, 1998, 2000, 2001 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. #ifdef __USE_GNU
  22. # include <paths.h>
  23. # define _PATH_UTMPX _PATH_UTMP
  24. # define _PATH_WTMPX _PATH_WTMP
  25. #endif
  26. #define __UT_LINESIZE 32
  27. #define __UT_NAMESIZE 32
  28. #define __UT_HOSTSIZE 256
  29. /* The structure describing the status of a terminated process. This
  30. type is used in `struct utmpx' below. */
  31. struct __exit_status
  32. {
  33. #ifdef __USE_GNU
  34. short int e_termination; /* Process termination status. */
  35. short int e_exit; /* Process exit status. */
  36. #else
  37. short int __e_termination; /* Process termination status. */
  38. short int __e_exit; /* Process exit status. */
  39. #endif
  40. };
  41. /* The structure describing an entry in the user accounting database. */
  42. struct utmpx
  43. {
  44. short int ut_type; /* Type of login. */
  45. __pid_t ut_pid; /* Process ID of login process. */
  46. char ut_line[__UT_LINESIZE]; /* Devicename. */
  47. char ut_id[4]; /* Inittab ID. */
  48. char ut_user[__UT_NAMESIZE]; /* Username. */
  49. char ut_host[__UT_HOSTSIZE]; /* Hostname for remote login. */
  50. struct __exit_status ut_exit; /* Exit status of a process marked
  51. as DEAD_PROCESS. */
  52. long int ut_session; /* Session ID, used for windowing. */
  53. struct timeval ut_tv; /* Time entry was made. */
  54. __int32_t ut_addr_v6[4]; /* Internet address of remote host. */
  55. char __unused[20]; /* Reserved for future use. */
  56. };
  57. /* Values for the `ut_type' field of a `struct utmpx'. */
  58. #define EMPTY 0 /* No valid user accounting information. */
  59. #ifdef __USE_GNU
  60. # define RUN_LVL 1 /* The system's runlevel. */
  61. #endif
  62. #define BOOT_TIME 2 /* Time of system boot. */
  63. #define NEW_TIME 3 /* Time after system clock changed. */
  64. #define OLD_TIME 4 /* Time when system clock changed. */
  65. #define INIT_PROCESS 5 /* Process spawned by the init process. */
  66. #define LOGIN_PROCESS 6 /* Session leader of a logged in user. */
  67. #define USER_PROCESS 7 /* Normal process. */
  68. #define DEAD_PROCESS 8 /* Terminated process. */
  69. #ifdef __USE_GNU
  70. # define ACCOUNTING 9 /* System accounting. */
  71. #endif