utmp.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. __BEGIN_DECLS
  21. struct utmp
  22. {
  23. short ut_type; /* type of login */
  24. pid_t ut_pid; /* pid of login-process */
  25. char ut_line[UT_LINESIZE]; /* devicename of tty -"/dev/", null-term */
  26. char ut_id[2]; /* abbrev. ttyname, as 01, s1 etc. */
  27. time_t ut_time; /* login time */
  28. #define ut_name ut_user /* Backwards compatibility hack */
  29. char ut_user[UT_NAMESIZE]; /* username, not null-term */
  30. char ut_host[UT_HOSTSIZE]; /* hostname for remote login... */
  31. long ut_addr; /* IP addr of remote host */
  32. };
  33. extern void setutent __P ((void));
  34. extern void utmpname __P ((__const char *));
  35. extern struct utmp * getutent __P ((void));
  36. extern struct utmp * getutid __P ((struct utmp *));
  37. extern struct utmp * getutline __P ((struct utmp *));
  38. extern struct utmp * pututline __P ((struct utmp *));
  39. extern void endutent __P ((void));
  40. extern int login_tty (int __fd);
  41. extern void login (const struct utmp *entry);
  42. extern void logwtmp (const char *line, const char *name, const char *host);
  43. #ifdef _LIBC
  44. struct utmp * __getutent __P ((int));
  45. #endif
  46. __END_DECLS
  47. #endif /* __UTMP_H */