aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/afb-fdev.c12
-rw-r--r--src/jobs.c19
-rw-r--r--src/jobs.h12
3 files changed, 21 insertions, 22 deletions
diff --git a/src/afb-fdev.c b/src/afb-fdev.c
index 2c96ef52..8e3358d7 100644
--- a/src/afb-fdev.c
+++ b/src/afb-fdev.c
@@ -18,14 +18,6 @@
#include "fdev.h"
#if !defined(REMOVE_SYSTEMD_EVENT)
-# define USE_SYSTEMD 1
-# define USE_EPOLL 0
-#else
-# define USE_SYSTEMD 0
-# define USE_EPOLL 1
-#endif
-
-#if USE_SYSTEMD
#include "afb-systemd.h"
#include "fdev-systemd.h"
@@ -35,9 +27,7 @@ struct fdev *afb_fdev_create(int fd)
return fdev_systemd_create(afb_systemd_get_event_loop(), fd);
}
-#endif
-
-#if USE_EPOLL
+#else
#include "jobs.h"
#include "fdev-epoll.h"
diff --git a/src/jobs.c b/src/jobs.c
index 26fc0157..16434d4f 100644
--- a/src/jobs.c
+++ b/src/jobs.c
@@ -44,7 +44,11 @@
#include "jobs.h"
#include "sig-monitor.h"
#include "verbose.h"
+
+#if defined(REMOVE_SYSTEMD_EVENT)
#include "fdev-epoll.h"
+#endif
+
#if 0
#define _alert_ "do you really want to remove signal monitoring?"
#define sig_monitor_init_timeouts() ((void)0)
@@ -131,11 +135,11 @@ static struct job *free_jobs;
/* event loop */
static struct evloop evloop[1];
+
+#if defined(REMOVE_SYSTEMD_EVENT)
static struct fdev_epoll *fdevepoll;
-#if !defined(REMOVE_SYSTEMD_EVENT)
-__attribute__((unused))
-#endif
static int waitevt;
+#endif
/**
* Create a new job with the given parameters
@@ -269,6 +273,7 @@ static void job_cancel(int signum, void *arg)
job->callback(SIGABRT, job->arg);
}
+#if defined(REMOVE_SYSTEMD_EVENT)
/**
* Gets a fdev_epoll item.
* @return a fdev_epoll or NULL in case of error
@@ -283,6 +288,7 @@ static struct fdev_epoll *get_fdevepoll()
return result;
}
+#endif
/**
* Monitored normal callback for events.
@@ -331,6 +337,7 @@ static void evloop_run(int signum, void *arg)
}
+#if defined(REMOVE_SYSTEMD_EVENT)
/**
* Monitored normal loop for waiting events.
* @param signum 0 on normal flow or the number
@@ -338,9 +345,6 @@ static void evloop_run(int signum, void *arg)
* flow
* @param arg the events to run
*/
-#if !defined(REMOVE_SYSTEMD_EVENT)
-__attribute__((unused))
-#endif
static void monitored_wait_and_dispatch(int signum, void *arg)
{
struct fdev_epoll *fdev_epoll = arg;
@@ -348,6 +352,7 @@ static void monitored_wait_and_dispatch(int signum, void *arg)
fdev_epoll_wait_and_dispatch(fdev_epoll, -1);
}
}
+#endif
/**
* Main processing loop of threads processing jobs.
@@ -823,6 +828,7 @@ struct sd_event *jobs_get_sd_event()
return result;
}
+#if defined(REMOVE_SYSTEMD_EVENT)
/**
* Gets the fdev_epoll item.
* @return a fdev_epoll or NULL in case of error
@@ -837,6 +843,7 @@ struct fdev_epoll *jobs_get_fdev_epoll()
return result;
}
+#endif
/**
* Enter the jobs processing loop.
diff --git a/src/jobs.h b/src/jobs.h
index 8ad6efc1..58adc1c7 100644
--- a/src/jobs.h
+++ b/src/jobs.h
@@ -17,8 +17,6 @@
#pragma once
-struct fdev_epoll;
-struct sd_event;
struct jobloop;
extern int jobs_queue(
@@ -41,9 +39,6 @@ extern int jobs_call(
void (*callback)(int, void*),
void *arg);
-extern struct sd_event *jobs_get_sd_event();
-extern struct fdev_epoll *jobs_get_fdev_epoll();
-
extern void jobs_terminate();
extern int jobs_start(
@@ -53,3 +48,10 @@ extern int jobs_start(
void (*start)(int signum, void* arg),
void *arg);
+#if !defined(REMOVE_SYSTEMD_EVENT)
+struct sd_event;
+extern struct sd_event *jobs_get_sd_event();
+#else
+struct fdev_epoll;
+extern struct fdev_epoll *jobs_get_fdev_epoll();
+#endif