utmp.h 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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, see
  13. <http://www.gnu.org/licenses/>. */
  14. #ifndef _UTMP_H
  15. #define _UTMP_H 1
  16. #include <features.h>
  17. #include <sys/types.h>
  18. __BEGIN_DECLS
  19. /* Get system dependent values and data structures. */
  20. #include <bits/utmp.h>
  21. /* Compatibility names for the strings of the canonical file names. */
  22. #define UTMP_FILE _PATH_UTMP
  23. #define UTMP_FILENAME _PATH_UTMP
  24. #define WTMP_FILE _PATH_WTMP
  25. #define WTMP_FILENAME _PATH_WTMP
  26. #ifdef __UCLIBC_HAS_LIBUTIL__
  27. /* Make FD be the controlling terminal, stdin, stdout, and stderr;
  28. then close FD. Returns 0 on success, nonzero on error. */
  29. extern int login_tty (int __fd) __THROW;
  30. libutil_hidden_proto(login_tty)
  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. /* Change name of the utmp file to be examined. */
  43. extern int utmpname (const char *__file) __THROW;
  44. /* Read next entry from a utmp-like file. */
  45. extern struct utmp *getutent (void) __THROW;
  46. /* Reset the input stream to the beginning of the file. */
  47. extern void setutent (void) __THROW;
  48. /* Close the current open file. */
  49. extern void endutent (void) __THROW;
  50. /* Search forward from the current point in the utmp file until the
  51. next entry with a ut_type matching ID->ut_type. */
  52. extern struct utmp *getutid (const struct utmp *__id) __THROW;
  53. /* Search forward from the current point in the utmp file until the
  54. next entry with a ut_line matching LINE->ut_line. */
  55. extern struct utmp *getutline (const struct utmp *__line) __THROW;
  56. /* Write out entry pointed to by UTMP_PTR into the utmp file. */
  57. extern struct utmp *pututline (const struct utmp *__utmp_ptr) __THROW;
  58. #if 0 /* def __USE_MISC */
  59. /* Reentrant versions of the file for handling utmp files. */
  60. extern int getutent_r (struct utmp *__buffer, struct utmp **__result) __THROW;
  61. extern int getutid_r (const struct utmp *__id, struct utmp *__buffer,
  62. struct utmp **__result) __THROW;
  63. extern int getutline_r (const struct utmp *__line,
  64. struct utmp *__buffer, struct utmp **__result) __THROW;
  65. #endif /* Use misc. */
  66. __END_DECLS
  67. #endif /* utmp.h */