chiark / gitweb /
1b7e7eace95b0b4ebae3f02523794822d7aa35e7
[elogind.git] / src / shared / utmp-wtmp.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 /***
5   Copyright 2010 Lennart Poettering
6 ***/
7
8 #include <stdbool.h>
9 #include <sys/types.h>
10
11 #include "time-util.h"
12 #include "util.h"
13
14 #if ENABLE_UTMP
15 int utmp_get_runlevel(int *runlevel, int *previous);
16
17 int utmp_put_shutdown(void);
18 int utmp_put_reboot(usec_t timestamp);
19 int utmp_put_runlevel(int runlevel, int previous);
20
21 int utmp_put_dead_process(const char *id, pid_t pid, int code, int status);
22 int utmp_put_init_process(const char *id, pid_t pid, pid_t sid, const char *line, int ut_type, const char *user);
23
24 int utmp_wall(
25         const char *message,
26         const char *username,
27         const char *origin_tty,
28         bool (*match_tty)(const char *tty, void *userdata),
29         void *userdata);
30
31 #else /* ENABLE_UTMP */
32
33 static inline int utmp_get_runlevel(int *runlevel, int *previous) {
34         return -ESRCH;
35 }
36 static inline int utmp_put_shutdown(void) {
37         return 0;
38 }
39 static inline int utmp_put_reboot(usec_t timestamp) {
40         return 0;
41 }
42 static inline int utmp_put_runlevel(int runlevel, int previous) {
43         return 0;
44 }
45 static inline int utmp_put_dead_process(const char *id, pid_t pid, int code, int status) {
46         return 0;
47 }
48 static inline int utmp_put_init_process(const char *id, pid_t pid, pid_t sid, const char *line, int ut_type, const char *user) {
49         return 0;
50 }
51 static inline int utmp_wall(
52                 const char *message,
53                 const char *username,
54                 const char *origin_tty,
55                 bool (*match_tty)(const char *tty, void *userdata),
56                 void *userdata) {
57         return 0;
58 }
59
60 #endif /* ENABLE_UTMP */