utmpx.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /* Structures and defenitions for the user accounting database. GNU version.
  2. Copyright (C) 1997, 1998 Free Software Foundation, Inc.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Library General Public License as
  5. published by the Free Software Foundation; either version 2 of the
  6. 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. Library General Public License for more details.
  11. You should have received a copy of the GNU Library General Public
  12. License along with the GNU C Library; see the file COPYING.LIB. If not,
  13. write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  14. Boston, MA 02111-1307, USA. */
  15. #ifndef _UTMPX_H
  16. # error "Never include <bits/utmpx.h> directly; use <utmpx.h> instead."
  17. #endif
  18. #include <bits/types.h>
  19. #include <sys/time.h>
  20. #ifdef __USE_GNU
  21. # include <paths.h>
  22. # define _PATH_UTMPX _PATH_UTMP
  23. # define _PATH_WTMPX _PATH_WTMP
  24. #endif
  25. #define __UT_LINESIZE 32
  26. #define __UT_NAMESIZE 32
  27. #define __UT_HOSTSIZE 256
  28. /* The structure describing the status of a terminated process. This
  29. type is used in `struct utmpx' below. */
  30. struct __exit_status
  31. {
  32. #ifdef __USE_GNU
  33. short int e_termination; /* Process termination status. */
  34. short int e_exit; /* Process exit status. */
  35. #else
  36. short int __e_termination; /* Process termination status. */
  37. short int __e_exit; /* Process exit status. */
  38. #endif
  39. };
  40. /* The structure describing an entry in the user accounting database. */
  41. struct utmpx
  42. {
  43. short int ut_type; /* Type of login. */
  44. __pid_t ut_pid; /* Process ID of login process. */
  45. char ut_line[__UT_LINESIZE]; /* Devicename. */
  46. char ut_id[4]; /* Inittab ID. */
  47. char ut_user[__UT_NAMESIZE]; /* Username. */
  48. char ut_host[__UT_HOSTSIZE]; /* Hostname for remote login. */
  49. struct __exit_status ut_exit; /* Exit status of a process marked
  50. as DEAD_PROCESS. */
  51. long int ut_session; /* Session ID, used for windowing. */
  52. struct timeval ut_tv; /* Time entry was made. */
  53. __int32_t ut_addr_v6[4]; /* Internet address of remote host. */
  54. char __unused[20]; /* Reserved for future use. */
  55. };
  56. /* Values for the `ut_type' field of a `struct utmpx'. */
  57. #define EMPTY 0 /* No valid user accounting information. */
  58. #define RUN_LVL 1 /* The system's runlevel. */
  59. #define BOOT_TIME 2 /* Time of system boot. */
  60. #define NEW_TIME 3 /* Time after system clock changed. */
  61. #define OLD_TIME 4 /* Time when system clock changed. */
  62. #define INIT_PROCESS 5 /* Process spawned by the init process. */
  63. #define LOGIN_PROCESS 6 /* Session leader of a logged in user. */
  64. #define USER_PROCESS 7 /* Normal process. */
  65. #define DEAD_PROCESS 8 /* Terminated process. */
  66. #ifdef __USE_GNU
  67. # define ACCOUNTING 9 /* System accounting. */
  68. #endif