_utmpx.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * Copyright (c) 2004 Gunnar Ritter
  3. *
  4. * This software is provided 'as-is', without any express or implied
  5. * warranty. In no event will the authors be held liable for any damages
  6. * arising from the use of this software.
  7. *
  8. * Permission is granted to anyone to use this software for any purpose,
  9. * including commercial applications, and to alter it and redistribute
  10. * it freely, subject to the following restrictions:
  11. *
  12. * 1. The origin of this software must not be misrepresented; you must not
  13. * claim that you wrote the original software. If you use this software
  14. * in a product, an acknowledgment in the product documentation would be
  15. * appreciated but is not required.
  16. *
  17. * 2. Altered source versions must be plainly marked as such, and must not be
  18. * misrepresented as being the original software.
  19. *
  20. * 3. This notice may not be removed or altered from any source distribution.
  21. */
  22. /* Sccsid @(#)_utmpx.h 1.9 (gritter) 1/22/06 */
  23. #if defined (__FreeBSD__) || defined (__dietlibc__) || defined (__NetBSD__) || \
  24. defined (__UCLIBC__) || defined (__OpenBSD__) || \
  25. defined (__DragonFly__) || defined (__APPLE__)
  26. #include <sys/types.h>
  27. #include <sys/time.h>
  28. #include <utmp.h>
  29. #ifndef __dietlibc__
  30. struct utmpx {
  31. char ut_user[UT_NAMESIZE];
  32. char ut_id[UT_LINESIZE];
  33. char ut_line[UT_LINESIZE];
  34. char ut_host[UT_HOSTSIZE];
  35. pid_t ut_pid;
  36. short ut_type;
  37. struct timeval ut_tv;
  38. struct {
  39. int e_termination;
  40. int e_exit;
  41. } ut_exit;
  42. };
  43. #ifndef EMPTY
  44. #define EMPTY 0
  45. #endif
  46. #ifndef BOOT_TIME
  47. #define BOOT_TIME 1
  48. #endif
  49. #ifndef OLD_TIME
  50. #define OLD_TIME 2
  51. #endif
  52. #ifndef NEW_TIME
  53. #define NEW_TIME 3
  54. #endif
  55. #ifndef USER_PROCESS
  56. #define USER_PROCESS 4
  57. #endif
  58. #ifndef INIT_PROCESS
  59. #define INIT_PROCESS 5
  60. #endif
  61. #ifndef LOGIN_PROCESS
  62. #define LOGIN_PROCESS 6
  63. #endif
  64. #ifndef DEAD_PROCESS
  65. #define DEAD_PROCESS 7
  66. #endif
  67. #ifndef RUN_LVL
  68. #define RUN_LVL 8
  69. #endif
  70. #ifndef ACCOUNTING
  71. #define ACCOUNTING 9
  72. #endif
  73. #else /* __dietlibc__ */
  74. #define utmpx utmp
  75. #endif /* __dietlibc__ */
  76. extern void endutxent(void);
  77. extern struct utmpx *getutxent(void);
  78. extern struct utmpx *getutxid(const struct utmpx *);
  79. extern struct utmpx *getutxline(const struct utmpx *);
  80. extern struct utmpx *pututxline(const struct utmpx *);
  81. extern void setutxent(void);
  82. extern int utmpxname(const char *);
  83. extern void updwtmpx(const char *, const struct utmpx *);
  84. #endif /* __FreeBSD__ || __dietlibc__ || __NetBSD__ || __UCLIBC__ ||
  85. __OpenBSD__ || __DragonFly__ || __APPLE__ */