utmp.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /* utmp.h */
  2. #ifndef __UTMP_H
  3. #define __UTMP_H
  4. #include <features.h>
  5. #include <sys/types.h>
  6. #include <paths.h>
  7. #include <time.h>
  8. #define UT_UNKNOWN 0
  9. #define UT_LINESIZE 12
  10. #define UT_NAMESIZE 8
  11. #define UT_HOSTSIZE 16
  12. #define RUN_LVL 1
  13. #define BOOT_TIME 2
  14. #define NEW_TIME 3
  15. #define OLD_TIME 4
  16. #define INIT_PROCESS 5
  17. #define LOGIN_PROCESS 6
  18. #define USER_PROCESS 7
  19. #define DEAD_PROCESS 8
  20. struct utmp
  21. {
  22. short ut_type; /* type of login */
  23. pid_t ut_pid; /* pid of login-process */
  24. char ut_line[UT_LINESIZE]; /* devicename of tty -"/dev/", null-term */
  25. char ut_id[2]; /* abbrev. ttyname, as 01, s1 etc. */
  26. time_t ut_time; /* login time */
  27. #define ut_name ut_user /* Backwards compatibility hack */
  28. char ut_user[UT_NAMESIZE]; /* username, not null-term */
  29. char ut_host[UT_HOSTSIZE]; /* hostname for remote login... */
  30. long ut_addr; /* IP addr of remote host */
  31. };
  32. extern void setutent __P ((void));
  33. extern void utmpname __P ((__const char *));
  34. extern struct utmp * getutent __P ((void));
  35. extern struct utmp * getutid __P ((struct utmp *));
  36. extern struct utmp * getutline __P ((struct utmp *));
  37. extern struct utmp * pututline __P ((struct utmp *));
  38. extern void endutent __P ((void));
  39. extern int login_tty (int __fd);
  40. extern void login (const struct utmp *entry);
  41. extern void logwtmp (const char *line, const char *name, const char *host);
  42. #ifdef _LIBC
  43. struct utmp * __getutent __P ((int));
  44. #endif
  45. #endif /* __UTMP_H */