utmp.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /* Copyright (C) 1993, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public
  5. License as published by the Free Software Foundation; either
  6. version 2.1 of the 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. Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with the GNU C Library; if not, write to the Free
  13. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  14. 02111-1307 USA. */
  15. #ifndef _UTMP_H
  16. #define _UTMP_H 1
  17. #include <features.h>
  18. #include <sys/types.h>
  19. __BEGIN_DECLS
  20. /* Get system dependent values and data structures. */
  21. #include <bits/utmp.h>
  22. /* Compatibility names for the strings of the canonical file names. */
  23. #define UTMP_FILE _PATH_UTMP
  24. #define UTMP_FILENAME _PATH_UTMP
  25. #define WTMP_FILE _PATH_WTMP
  26. #define WTMP_FILENAME _PATH_WTMP
  27. #ifdef __UCLIBC_HAS_LIBUTIL__
  28. /* Make FD be the controlling terminal, stdin, stdout, and stderr;
  29. then close FD. Returns 0 on success, nonzero on error. */
  30. extern int login_tty (int __fd) __THROW;
  31. /* Write the given entry into utmp and wtmp. */
  32. extern void login (__const struct utmp *__entry) __THROW;
  33. /* Write the utmp entry to say the user on UT_LINE has logged out. */
  34. extern int logout (__const char *__ut_line) __THROW;
  35. /* Append to wtmp an entry for the current time and the given info. */
  36. extern void logwtmp (__const char *__ut_line, __const char *__ut_name,
  37. __const char *__ut_host) __THROW;
  38. #endif
  39. /* Append entry UTMP to the wtmp-like file WTMP_FILE. */
  40. extern void updwtmp (__const char *__wtmp_file, __const struct utmp *__utmp)
  41. __THROW;
  42. libc_hidden_proto(updwtmp)
  43. /* Change name of the utmp file to be examined. */
  44. extern int utmpname (__const char *__file) __THROW;
  45. libc_hidden_proto(utmpname)
  46. /* Read next entry from a utmp-like file. */
  47. extern struct utmp *getutent (void) __THROW;
  48. libc_hidden_proto(getutent)
  49. /* Reset the input stream to the beginning of the file. */
  50. extern void setutent (void) __THROW;
  51. libc_hidden_proto(setutent)
  52. /* Close the current open file. */
  53. extern void endutent (void) __THROW;
  54. libc_hidden_proto(endutent)
  55. /* Search forward from the current point in the utmp file until the
  56. next entry with a ut_type matching ID->ut_type. */
  57. extern struct utmp *getutid (__const struct utmp *__id) __THROW;
  58. libc_hidden_proto(getutid)
  59. /* Search forward from the current point in the utmp file until the
  60. next entry with a ut_line matching LINE->ut_line. */
  61. extern struct utmp *getutline (__const struct utmp *__line) __THROW;
  62. libc_hidden_proto(getutline)
  63. /* Write out entry pointed to by UTMP_PTR into the utmp file. */
  64. extern struct utmp *pututline (__const struct utmp *__utmp_ptr) __THROW;
  65. libc_hidden_proto(pututline)
  66. #if 0 /* def __USE_MISC */
  67. /* Reentrant versions of the file for handling utmp files. */
  68. extern int getutent_r (struct utmp *__buffer, struct utmp **__result) __THROW;
  69. extern int getutid_r (__const struct utmp *__id, struct utmp *__buffer,
  70. struct utmp **__result) __THROW;
  71. extern int getutline_r (__const struct utmp *__line,
  72. struct utmp *__buffer, struct utmp **__result) __THROW;
  73. #endif /* Use misc. */
  74. __END_DECLS
  75. #endif /* utmp.h */