]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/shared/utmp-wtmp.h
man: Remove OSConfig project mentioning for systemd-confext
[thirdparty/systemd.git] / src / shared / utmp-wtmp.h
CommitLineData
db9ecf05 1/* SPDX-License-Identifier: LGPL-2.1-or-later */
c2f1db8f 2#pragma once
e537352b 3
a8fbdf54
TA
4#include <stdbool.h>
5#include <sys/types.h>
6
7#include "time-util.h"
e537352b 8
3211da4b 9#if ENABLE_UTMP
c2a99093
ZJS
10#include <utmpx.h>
11
e537352b
LP
12int utmp_get_runlevel(int *runlevel, int *previous);
13
0ad26e09 14int utmp_put_shutdown(void);
e537352b 15int utmp_put_reboot(usec_t timestamp);
0ad26e09 16int utmp_put_runlevel(int runlevel, int previous);
e537352b 17
169c1bda 18int utmp_put_dead_process(const char *id, pid_t pid, int code, int status);
023a4f67 19int utmp_put_init_process(const char *id, pid_t pid, pid_t sid, const char *line, int ut_type, const char *user);
169c1bda 20
c2a99093
ZJS
21static inline bool utxent_start(void) {
22 setutxent();
23 return true;
24}
25static inline void utxent_cleanup(bool *initialized) {
22a8f002
MY
26 assert(initialized);
27 if (*initialized)
c2a99093
ZJS
28 endutxent();
29}
30
3211da4b 31#else /* ENABLE_UTMP */
37161c51
ERB
32
33static inline int utmp_get_runlevel(int *runlevel, int *previous) {
34 return -ESRCH;
35}
36static inline int utmp_put_shutdown(void) {
37 return 0;
38}
39static inline int utmp_put_reboot(usec_t timestamp) {
40 return 0;
41}
42static inline int utmp_put_runlevel(int runlevel, int previous) {
43 return 0;
44}
45static inline int utmp_put_dead_process(const char *id, pid_t pid, int code, int status) {
46 return 0;
47}
023a4f67 48static inline int utmp_put_init_process(const char *id, pid_t pid, pid_t sid, const char *line, int ut_type, const char *user) {
37161c51
ERB
49 return 0;
50}
37161c51 51
3211da4b 52#endif /* ENABLE_UTMP */