[systemd-devel] [PATCH 7/7] utmp-wtmp.h: clean up stubbed functions

Emil Renner Berthing systemd at esmil.dk
Wed Sep 24 08:25:06 PDT 2014


Now that there are no more users of utmp-wtmp.h left
when !HAVE_UTMP we can remove the stubbed functions.

Also tell automake that the header is not used
unless we have utmp enabled.
---
 Makefile.am            |  4 ++--
 src/shared/utmp-wtmp.h | 28 ----------------------------
 2 files changed, 2 insertions(+), 30 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 47a1c07..eef093b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -817,7 +817,6 @@ libsystemd_shared_la_SOURCES = \
 	src/shared/cgroup-show.h \
 	src/shared/unit-name.c \
 	src/shared/unit-name.h \
-	src/shared/utmp-wtmp.h \
 	src/shared/watchdog.c \
 	src/shared/watchdog.h \
 	src/shared/spawn-ask-password-agent.c \
@@ -892,7 +891,8 @@ libsystemd_shared_la_SOURCES = \
 
 if HAVE_UTMP
 libsystemd_shared_la_SOURCES += \
-	src/shared/utmp-wtmp.c
+	src/shared/utmp-wtmp.c \
+	src/shared/utmp-wtmp.h
 endif
 
 nodist_libsystemd_shared_la_SOURCES = \
diff --git a/src/shared/utmp-wtmp.h b/src/shared/utmp-wtmp.h
index 87d004e..040a16e 100644
--- a/src/shared/utmp-wtmp.h
+++ b/src/shared/utmp-wtmp.h
@@ -23,7 +23,6 @@
 
 #include "util.h"
 
-#ifdef HAVE_UTMP
 int utmp_get_runlevel(int *runlevel, int *previous);
 
 int utmp_put_shutdown(void);
@@ -34,30 +33,3 @@ int utmp_put_dead_process(const char *id, pid_t pid, int code, int status);
 int utmp_put_init_process(const char *id, pid_t pid, pid_t sid, const char *line);
 
 int utmp_wall(const char *message, const char *username, bool (*match_tty)(const char *tty));
-
-#else /* HAVE_UTMP */
-
-static inline int utmp_get_runlevel(int *runlevel, int *previous) {
-        return -ESRCH;
-}
-static inline int utmp_put_shutdown(void) {
-        return 0;
-}
-static inline int utmp_put_reboot(usec_t timestamp) {
-        return 0;
-}
-static inline int utmp_put_runlevel(int runlevel, int previous) {
-        return 0;
-}
-static inline int utmp_put_dead_process(const char *id, pid_t pid, int code, int status) {
-        return 0;
-}
-static inline int utmp_put_init_process(const char *id, pid_t pid, pid_t sid, const char *line) {
-        return 0;
-}
-static inline int utmp_wall(const char *message, const char *username,
-                bool (*match_tty)(const char *tty)) {
-        return 0;
-}
-
-#endif /* HAVE_UTMP */
-- 
2.1.0



More information about the systemd-devel mailing list