summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/utmps/utmps.h35
-rw-r--r--src/include/utmps/utmpx.h75
-rw-r--r--src/include/utmpx.h13
3 files changed, 123 insertions, 0 deletions
diff --git a/src/include/utmps/utmps.h b/src/include/utmps/utmps.h
new file mode 100644
index 0000000..e4760f9
--- /dev/null
+++ b/src/include/utmps/utmps.h
@@ -0,0 +1,35 @@
+/* ISC license. */
+
+#ifndef UTMPS_H
+#define UTMPS_H
+
+#include <skalibs/tai.h>
+#include <utmps/utmpx.h>
+
+typedef struct utmps_s utmps, *utmps_ref ;
+struct utmps_s
+{
+ int fd ;
+} ;
+#define UTMPS_ZERO { .fd = -1 }
+
+extern int utmps_start (utmps *, char const *, tain_t const *, tain_t *) ;
+#define utmps_start_g(a, s, deadline) utmps_start(a, s, (deadline), &STAMP)
+
+extern void utmps_end (utmps *) ;
+
+extern int utmps_rewind (utmps *, tain_t const *, tain_t *) ;
+#define utmps_rewind_g (a, deadline) utmps_rewind(a, (deadline), &STAMP)
+extern int utmps_getent (utmps *, struct utmpx *, tain_t const *, tain_t *) ;
+#define utmps_getent_g (a, b, deadline) utmps_getent(a, b, (deadline), &STAMP)
+extern int utmps_getid (utmps *, unsigned short, char const *, struct utmpx *, tain_t const *, tain_t *) ;
+#define utmps_getid_g(a, type, id, b, deadline) utmps_getid(a, type, id, b, (deadline), &STAMP)
+extern int utmps_getline (utmps *, char const *, struct utmpx *, tain_t const *, tain_t *) ;
+#define utmps_getline_g(a, line, b, deadline) utmps_getline(a, line, b, (deadline), &STAMP)
+extern int utmps_putline (utmps *, struct utmpx const *, tain_t const *, tain_t *) ;
+#define utmps_putline_g(a, entry, deadline) utmps_putline(a, entry, (deadine), &STAMP)
+
+extern int utmps_updwtmpx (char const *, struct utmpx const *, tain_t const *, tain_t *) ;
+#define utmps_updwtmpx_g(file, b, deadline) utmps_updwtmpx(file, b, (deadline), &STAMP)
+
+#endif
diff --git a/src/include/utmps/utmpx.h b/src/include/utmps/utmpx.h
new file mode 100644
index 0000000..4752964
--- /dev/null
+++ b/src/include/utmps/utmpx.h
@@ -0,0 +1,75 @@
+/* ISC license. */
+
+#ifndef UTMPS_UTMPX_H
+#define UTMPS_UTMPX_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <sys/time.h>
+
+#define UTMPS_UT_LINESIZE 32
+#define UTMPS_UT_NAMESIZE 32
+#define UTMPS_UT_HOSTSIZE 256
+#define UTMPS_UT_IDSIZE 4
+
+struct exit_status
+{
+ short e_termination ;
+ short e_exit ;
+} ;
+
+struct utmpx
+{
+ short ut_type ;
+ pid_t ut_pid ;
+ char ut_line[UTMPS_UT_LINESIZE] ;
+ char ut_id[UTMPS_UT_IDSIZE] ;
+ char ut_user[UTMPS_UT_NAMESIZE] ;
+
+ char ut_host[UTMPS_UT_HOSTSIZE] ;
+ struct exit_status ut_exit ;
+ pid_t ut_session ;
+
+ struct timeval ut_tv ;
+
+ uint32_t ut_addr_v6[4] ;
+ char __unused[20] ;
+} ;
+
+#define ut_name ut_user
+
+#define EMPTY 0
+#define BOOT_TIME 2
+#define OLD_TIME 4
+#define NEW_TIME 3
+#define USER_PROCESS 7
+#define INIT_PROCESS 5
+#define LOGIN_PROCESS 6
+#define DEAD_PROCESS 8
+
+#define RUN_LVL 1
+#define ACCOUNTING 9
+
+extern void endutxent (void) ;
+extern void setutxent (void) ;
+extern struct utmpx *getutxent (void) ;
+extern struct utmpx *getutxid (struct utmpx const *) ;
+extern struct utmpx *getutxline (struct utmpx const *) ;
+extern struct utmpx *pututxline (struct utmpx const *) ;
+
+extern void updwtmpx (char const *, struct utmpx const *) ;
+extern void logwtmp (char const *, char const *, char const *) ;
+
+#define UT_LINESIZE UTMPS_UT_LINESIZE
+#define UT_NAMESIZE UTMPS_UT_NAMESIZE
+#define UT_HOSTSIZE UTMPS_UT_HOSTSIZE
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/src/include/utmpx.h b/src/include/utmpx.h
new file mode 100644
index 0000000..fc61b8b
--- /dev/null
+++ b/src/include/utmpx.h
@@ -0,0 +1,13 @@
+/* ISC license. */
+
+/*
+ This file is part of the utmps package.
+ See https://skarnet.org/software/utmps/
+*/
+
+#ifndef UTMPX_H
+#define UTMPX_H
+
+#include <utmps/utmpx.h>
+
+#endif