utmp.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /* The `struct utmp' type, describing entries in the utmp file. GNU version.
  2. Copyright (C) 1993, 1996, 1997, 1998, 1999 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 _UTMP_H
  16. # error "Never include <bits/utmp.h> directly; use <utmp.h> instead."
  17. #endif
  18. #include <paths.h>
  19. #include <sys/time.h>
  20. #include <sys/types.h>
  21. #define UT_LINESIZE 32
  22. #define UT_NAMESIZE 32
  23. #define UT_HOSTSIZE 256
  24. /* The structure describing an entry in the database of
  25. previous logins. */
  26. struct lastlog
  27. {
  28. __time_t ll_time;
  29. char ll_line[UT_LINESIZE];
  30. char ll_host[UT_HOSTSIZE];
  31. };
  32. /* The structure describing the status of a terminated process. This
  33. type is used in `struct utmp' below. */
  34. struct exit_status
  35. {
  36. short int e_termination; /* Process termination status. */
  37. short int e_exit; /* Process exit status. */
  38. };
  39. /* The structure describing an entry in the user accounting database. */
  40. struct utmp
  41. {
  42. short int ut_type; /* Type of login. */
  43. pid_t ut_pid; /* Process ID of login process. */
  44. char ut_line[UT_LINESIZE]; /* Devicename. */
  45. char ut_id[4]; /* Inittab ID. */
  46. char ut_user[UT_NAMESIZE]; /* Username. */
  47. char ut_host[UT_HOSTSIZE]; /* Hostname for remote login. */
  48. struct exit_status ut_exit; /* Exit status of a process marked
  49. as DEAD_PROCESS. */
  50. long int ut_session; /* Session ID, used for windowing. */
  51. struct timeval ut_tv; /* Time entry was made. */
  52. int32_t ut_addr_v6[4]; /* Internet address of remote host. */
  53. char __unused[20]; /* Reserved for future use. */
  54. };
  55. /* Backwards compatibility hacks. */
  56. #define ut_name ut_user
  57. #ifndef _NO_UT_TIME
  58. /* We have a problem here: `ut_time' is also used otherwise. Define
  59. _NO_UT_TIME if the compiler complains. */
  60. # define ut_time ut_tv.tv_sec
  61. #endif
  62. #define ut_xtime ut_tv.tv_sec
  63. #define ut_addr ut_addr_v6[0]
  64. /* Values for the `ut_type' field of a `struct utmp'. */
  65. #define EMPTY 0 /* No valid user accounting information. */
  66. #define RUN_LVL 1 /* The system's runlevel. */
  67. #define BOOT_TIME 2 /* Time of system boot. */
  68. #define NEW_TIME 3 /* Time after system clock changed. */
  69. #define OLD_TIME 4 /* Time when system clock changed. */
  70. #define INIT_PROCESS 5 /* Process spawned by the init process. */
  71. #define LOGIN_PROCESS 6 /* Session leader of a logged in user. */
  72. #define USER_PROCESS 7 /* Normal process. */
  73. #define DEAD_PROCESS 8 /* Terminated process. */
  74. #define ACCOUNTING 9
  75. /* Old Linux name for the EMPTY type. */
  76. #define UT_UNKNOWN EMPTY
  77. /* Tell the user that we have a modern system with UT_HOST, UT_PID,
  78. UT_TYPE, UT_ID and UT_TV fields. */
  79. #define _HAVE_UT_TYPE 1
  80. #define _HAVE_UT_PID 1
  81. #define _HAVE_UT_ID 1
  82. #define _HAVE_UT_TV 1
  83. #define _HAVE_UT_HOST 1