Debian Codegraph @

src/shared/utmp-wtmp.h

raw
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3
4 #include "shared-forward.h"
5
6 #if ENABLE_UTMP
7 #include <utmpx.h>
8
9 int utmp_put_shutdown(void);
10 int utmp_put_reboot(usec_t timestamp);
11
12 int utmp_put_dead_process(const char *id, pid_t pid, int code, int status);
13 int utmp_put_init_process(const char *id, pid_t pid, pid_t sid, const char *line, int ut_type, const char *user);
14
15 static inline bool utxent_start(void) {
16 setutxent();
17 return true;
18 }
19 static inline void utxent_cleanup(bool *initialized) {
20 assert(initialized);
21 if (*initialized)
22 endutxent();
23 }
24
25 #else /* ENABLE_UTMP */
26
27 static inline int utmp_put_shutdown(void) {
28 return 0;
29 }
30 static inline int utmp_put_reboot(usec_t timestamp) {
31 return 0;
32 }
33 static inline int utmp_put_dead_process(const char *id, pid_t pid, int code, int status) {
34 return 0;
35 }
36 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) {
37 return 0;
38 }
39
40 #endif /* ENABLE_UTMP */