]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/utmp-wtmp.h
build-sys: use #if Y instead of #ifdef Y everywhere
[thirdparty/systemd.git] / src / shared / utmp-wtmp.h
1 #pragma once
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
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
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
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public License
19 along with systemd; If not, see <http://www.gnu.org/licenses/>.
20 ***/
21
22 #include <stdbool.h>
23 #include <sys/types.h>
24
25 #include "time-util.h"
26 #include "util.h"
27
28 #if HAVE_UTMP
29 int utmp_get_runlevel(int *runlevel, int *previous);
30
31 int utmp_put_shutdown(void);
32 int utmp_put_reboot(usec_t timestamp);
33 int utmp_put_runlevel(int runlevel, int previous);
34
35 int utmp_put_dead_process(const char *id, pid_t pid, int code, int status);
36 int utmp_put_init_process(const char *id, pid_t pid, pid_t sid, const char *line, int ut_type, const char *user);
37
38 int 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);
44
45 #else /* HAVE_UTMP */
46
47 static inline int utmp_get_runlevel(int *runlevel, int *previous) {
48 return -ESRCH;
49 }
50 static inline int utmp_put_shutdown(void) {
51 return 0;
52 }
53 static inline int utmp_put_reboot(usec_t timestamp) {
54 return 0;
55 }
56 static inline int utmp_put_runlevel(int runlevel, int previous) {
57 return 0;
58 }
59 static inline int utmp_put_dead_process(const char *id, pid_t pid, int code, int status) {
60 return 0;
61 }
62 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) {
63 return 0;
64 }
65 static 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),
70 void *userdata) {
71 return 0;
72 }
73
74 #endif /* HAVE_UTMP */