summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Eden <yamakuzure@gmx.net>2018-06-18 17:33:08 +0200
committerSven Eden <yamakuzure@gmx.net>2018-06-29 07:12:51 +0200
commitd2c90687368fb1b6b46e1d776845d6ad3c59c4a2 (patch)
treef4f950828bf1c695c9543490715119d092329474
parent9e89768d6cfef494067b82871b4d9b1d2bac2d8e (diff)
Fix elogind debug mode:
When switched from autotools to meson, config.h changed fundamentally. Although enabled values are still #define HAVE_FOO 1 the disabled values are nolonger undef, but now #define HAVE_FOO 0 Therefore all instances of #ifdef ENABLE_DEBUG_ELOGIND have been changed to #if ENABLE_DEBUG_ELOGIND
-rw-r--r--src/basic/log.h2
-rw-r--r--src/login/eloginctl.c2
-rw-r--r--src/login/elogind.c14
-rw-r--r--src/login/logind.c2
4 files changed, 10 insertions, 10 deletions
diff --git a/src/basic/log.h b/src/basic/log.h
index 3a3c43e..8094a85 100644
--- a/src/basic/log.h
+++ b/src/basic/log.h
@@ -257,7 +257,7 @@ int log_emergency_level(void);
# define log_trace(...) do {} while (0)
#endif
-#ifdef ENABLE_DEBUG_ELOGIND
+#if ENABLE_DEBUG_ELOGIND
# define log_debug_elogind(...) log_debug(__VA_ARGS__);usleep(25*USEC_PER_MSEC)
#else
# define log_debug_elogind(...) do {} while (0)
diff --git a/src/login/eloginctl.c b/src/login/eloginctl.c
index 2b2bcde..111c770 100644
--- a/src/login/eloginctl.c
+++ b/src/login/eloginctl.c
@@ -218,7 +218,7 @@ void elogind_cleanup(void) {
/* Little debug log helper, helps debugging systemctl comands we mimic. */
static void elogind_log_special(enum elogind_action a) {
-#ifdef ENABLE_DEBUG_ELOGIND
+#if ENABLE_DEBUG_ELOGIND
switch (a) {
case ACTION_HALT:
log_struct(LOG_INFO,
diff --git a/src/login/elogind.c b/src/login/elogind.c
index 2fae0f1..90ae3d7 100644
--- a/src/login/elogind.c
+++ b/src/login/elogind.c
@@ -97,7 +97,7 @@ static int elogind_daemonize(void) {
pid_t SID;
int r;
-#ifdef ENABLE_DEBUG_ELOGIND
+#if ENABLE_DEBUG_ELOGIND
log_notice("Double forking elogind");
log_notice("Parent PID : %5d", getpid_cached());
log_notice("Parent SID : %5d", getsid(getpid_cached()));
@@ -115,7 +115,7 @@ static int elogind_daemonize(void) {
if (r)
return child;
-#ifdef ENABLE_DEBUG_ELOGIND
+#if ENABLE_DEBUG_ELOGIND
log_notice("Child PID : %5d", getpid_cached());
log_notice("Child SID : %5d", getsid(getpid_cached()));
#endif // ENABLE_DEBUG_ELOGIND
@@ -124,7 +124,7 @@ static int elogind_daemonize(void) {
if ((pid_t)-1 == SID)
return log_error_errno(errno, "Failed to create new SID: %m");
-#ifdef ENABLE_DEBUG_ELOGIND
+#if ENABLE_DEBUG_ELOGIND
log_notice("Child new SID : %5d", getsid(getpid_cached()));
#endif // ENABLE_DEBUG_ELOGIND
@@ -142,7 +142,7 @@ static int elogind_daemonize(void) {
umask(0022);
-#ifdef ENABLE_DEBUG_ELOGIND
+#if ENABLE_DEBUG_ELOGIND
log_notice("Grand child PID: %5d", getpid_cached());
log_notice("Grand child SID: %5d", getsid(getpid_cached()));
#endif // ENABLE_DEBUG_ELOGIND
@@ -319,7 +319,7 @@ int elogind_startup(int argc, char *argv[]) {
/* Note: At this point, the logging is not initialized, so we can not
use log_debug_elogind(). */
-#ifdef ENABLE_DEBUG_ELOGIND
+#if ENABLE_DEBUG_ELOGIND
log_notice("elogind startup: Daemonize: %s, Show Help: %s, Wrong arg: %s",
daemonize ? "True" : "False",
show_help ? "True" : "False",
@@ -404,7 +404,7 @@ int elogind_manager_new(Manager* m) {
/// Add-On for manager_reset_config()
void elogind_manager_reset_config(Manager* m) {
-#ifdef ENABLE_DEBUG_ELOGIND
+#if ENABLE_DEBUG_ELOGIND
int dbg_cnt;
#endif // ENABLE_DEBUG_ELOGIND
@@ -420,7 +420,7 @@ void elogind_manager_reset_config(Manager* m) {
if (!m->hybrid_sleep_state)
m->hybrid_sleep_state = strv_new("disk", NULL);
-#ifdef ENABLE_DEBUG_ELOGIND
+#if ENABLE_DEBUG_ELOGIND
dbg_cnt = -1;
while (m->suspend_mode && m->suspend_mode[++dbg_cnt])
log_debug_elogind("suspend_mode[%d] = %s",
diff --git a/src/login/logind.c b/src/login/logind.c
index ec40785..1251eb0 100644
--- a/src/login/logind.c
+++ b/src/login/logind.c
@@ -1284,7 +1284,7 @@ int main(int argc, char *argv[]) {
log_set_target(LOG_TARGET_AUTO);
log_set_facility(LOG_AUTH);
log_parse_environment();
-#ifdef ENABLE_DEBUG_ELOGIND
+#if ENABLE_DEBUG_ELOGIND
log_set_max_level(LOG_DEBUG);
log_set_target(LOG_TARGET_SYSLOG_OR_KMSG);
#endif // ENABLE_DEBUG_ELOGIND