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