]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/shared/utmp-wtmp.h
build-sys: use #if Y instead of #ifdef Y everywhere
[thirdparty/systemd.git] / src / shared / utmp-wtmp.h
CommitLineData
c2f1db8f 1#pragma once
e537352b
LP
2
3/***
4 This file is part of systemd.
5
6 Copyright 2010 Lennart Poettering
7
8 systemd is free software; you can redistribute it and/or modify it
5430f7f2
LP
9 under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 2.1 of the License, or
e537352b
LP
11 (at your option) any later version.
12
13 systemd is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5430f7f2 16 Lesser General Public License for more details.
e537352b 17
5430f7f2 18 You should have received a copy of the GNU Lesser General Public License
e537352b
LP
19 along with systemd; If not, see <http://www.gnu.org/licenses/>.
20***/
21
a8fbdf54
TA
22#include <stdbool.h>
23#include <sys/types.h>
24
25#include "time-util.h"
e537352b
LP
26#include "util.h"
27
349cc4a5 28#if HAVE_UTMP
e537352b
LP
29int utmp_get_runlevel(int *runlevel, int *previous);
30
0ad26e09 31int utmp_put_shutdown(void);
e537352b 32int utmp_put_reboot(usec_t timestamp);
0ad26e09 33int utmp_put_runlevel(int runlevel, int previous);
e537352b 34
169c1bda 35int utmp_put_dead_process(const char *id, pid_t pid, int code, int status);
023a4f67 36int utmp_put_init_process(const char *id, pid_t pid, pid_t sid, const char *line, int ut_type, const char *user);
169c1bda 37
99f710dd
DM
38int utmp_wall(
39 const char *message,
40 const char *username,
41 const char *origin_tty,
42 bool (*match_tty)(const char *tty, void *userdata),
43 void *userdata);
37161c51
ERB
44
45#else /* HAVE_UTMP */
46
47static inline int utmp_get_runlevel(int *runlevel, int *previous) {
48 return -ESRCH;
49}
50static inline int utmp_put_shutdown(void) {
51 return 0;
52}
53static inline int utmp_put_reboot(usec_t timestamp) {
54 return 0;
55}
56static inline int utmp_put_runlevel(int runlevel, int previous) {
57 return 0;
58}
59static inline int utmp_put_dead_process(const char *id, pid_t pid, int code, int status) {
60 return 0;
61}
023a4f67 62static 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
63 return 0;
64}
99f710dd
DM
65static inline int utmp_wall(
66 const char *message,
67 const char *username,
68 const char *origin_tty,
69 bool (*match_tty)(const char *tty, void *userdata),
3e7f33ad 70 void *userdata) {
37161c51
ERB
71 return 0;
72}
73
74#endif /* HAVE_UTMP */