utmp.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <sys/cdefs.h>
  8. #include <sys/time.h>
  9. __BEGIN_DECLS
  10. struct exit_status { /* Type for ut_exit, below */
  11. short int e_termination; /* Process termination status */
  12. short int e_exit; /* Process exit status */
  13. };
  14. #define USER_PROCESS 7
  15. #define DEAD_PROCESS 8
  16. #define UT_NAMESIZE 32
  17. #define UT_LINESIZE 32
  18. #define UT_HOSTSIZE 256
  19. struct utmp {
  20. short ut_type; /* Type of record */
  21. pid_t ut_pid; /* PID of login process */
  22. char ut_line[UT_LINESIZE]; /* Device name of tty - "/dev/" */
  23. char ut_id[4]; /* Terminal name suffix,
  24. or inittab(5) ID */
  25. char ut_user[UT_NAMESIZE]; /* Username */
  26. char ut_host[UT_HOSTSIZE]; /* Hostname for remote login, or
  27. kernel version for run-level
  28. messages */
  29. struct exit_status ut_exit; /* Exit status of a process
  30. marked as DEAD_PROCESS; not
  31. used by Linux init (1 */
  32. long ut_session; /* Session ID */
  33. struct timeval ut_tv; /* Time entry was made */
  34. int32_t ut_addr_v6[4]; /* Internet address of remote
  35. host; IPv4 address uses
  36. just ut_addr_v6[0] */
  37. char __unused[20]; /* Reserved for future use */
  38. };
  39. /* Backward compatibility hacks */
  40. #define ut_name ut_user
  41. #ifndef _NO_UT_TIME
  42. # define ut_time ut_tv.tv_sec
  43. #endif
  44. #define ut_xtime ut_tv.tv_sec
  45. #define ut_addr ut_addr_v6[0]
  46. __END_DECLS