wip: remove dead code
authorŁukasz Stelmach <l.stelmach@samsung.com>
Mon, 10 Apr 2017 07:05:01 +0000 (09:05 +0200)
committerŁukasz Stelmach <l.stelmach@samsung.com>
Mon, 10 Apr 2017 07:05:01 +0000 (09:05 +0200)
src/faultd.c

index de69d42a3dcdae3e9a416f329f2d00d78495fb43..5ed966eb0bfc66ca12278fdbc08f70893c868a38 100644 (file)
 #include <signal.h>
 #include "audit.h"
 
-
-#if 0
-#include <stdbool.h>
-typedef uint64_t usec_t;
-/* The pointers in the linked list's items. Use this in the item structure */
-#define LIST_FIELDS(t,name)                                             \
-        t *name##_next, *name##_prev
-
-typedef enum WakeupType {
-        WAKEUP_NONE,
-        WAKEUP_EVENT_SOURCE,
-        WAKEUP_CLOCK_DATA,
-        WAKEUP_SIGNAL_DATA,
-        _WAKEUP_TYPE_MAX,
-        _WAKEUP_TYPE_INVALID = -1,
-} WakeupType;
-
-typedef enum EventSourceType {
-        SOURCE_IO,
-        SOURCE_TIME_REALTIME,
-        SOURCE_TIME_BOOTTIME,
-        SOURCE_TIME_MONOTONIC,
-        SOURCE_TIME_REALTIME_ALARM,
-        SOURCE_TIME_BOOTTIME_ALARM,
-        SOURCE_SIGNAL,
-        SOURCE_CHILD,
-        SOURCE_DEFER,
-        SOURCE_POST,
-        SOURCE_EXIT,
-        SOURCE_WATCHDOG,
-        _SOURCE_EVENT_SOURCE_TYPE_MAX,
-        _SOURCE_EVENT_SOURCE_TYPE_INVALID = -1
-} EventSourceType;
-
-struct sd_event_source {
-        WakeupType wakeup;
-
-        unsigned n_ref;
-
-        sd_event *event;
-        void *userdata;
-        sd_event_handler_t prepare;
-
-        char *description;
-
-        EventSourceType type:5;
-        int enabled:3;
-        bool pending:1;
-        bool dispatching:1;
-        bool floating:1;
-
-        int64_t priority;
-        unsigned pending_index;
-        unsigned prepare_index;
-        uint64_t pending_iteration;
-        uint64_t prepare_iteration;
-
-        LIST_FIELDS(sd_event_source, sources);
-
-        union {
-                struct {
-                        sd_event_io_handler_t callback;
-                        int fd;
-                        uint32_t events;
-                        uint32_t revents;
-                        bool registered:1;
-                } io;
-                struct {
-                        sd_event_time_handler_t callback;
-                        usec_t next, accuracy;
-                        unsigned earliest_index;
-                        unsigned latest_index;
-                } time;
-                struct {
-                        sd_event_signal_handler_t callback;
-                        struct signalfd_siginfo siginfo;
-                        int sig;
-                } signal;
-                struct {
-                        sd_event_child_handler_t callback;
-                        siginfo_t siginfo;
-                        pid_t pid;
-                        int options;
-                } child;
-                struct {
-                        sd_event_handler_t callback;
-                } defer;
-                struct {
-                        sd_event_handler_t callback;
-                } post;
-                struct {
-                        sd_event_handler_t callback;
-                        unsigned prioq_index;
-                } exit;
-        };
-};
-#endif
 static int terminate = 0;
 
 int on_unit_properties_changed(sd_bus_message *m, void *userdata, sd_bus_error *ret_error);
@@ -232,31 +135,12 @@ int main(int ac, char* av[])
   int aufd;
   sigset_t ss;
 
-#if 1
   rc = sd_bus_default_system(&bus);
   if (rc < 0) {
     fprintf(stderr, "Failed to acquire the defult system bus connection.\n");
     return 1;
   }
-#else
-  rc = sd_bus_new(&bus);
-  if (rc < 0) {
-    fprintf(stderr, "Failed to create a new bus.\n");
-    return -1;
-  }
-
-  rc = sd_bus_set_address(bus, "unix:path=/run/systemd/private");
-  if (rc < 0) {
-    fprintf(stderr, "Failed to set bus address.\n");
-    return -1;
-  }
 
-  rc = sd_bus_start(bus);
-  if (rc < 0) {
-    fprintf(stderr, "Failed to connect to the bus.\n");
-    return -1;
-  }
-#endif
   rc = sd_bus_add_match(bus,
                         NULL,
                         "type='signal',sender='org.freedesktop.systemd1',"
@@ -288,19 +172,8 @@ int main(int ac, char* av[])
     return -1;
   }
 
-#if 0
-  rc = sd_event_add_io(loop,
-                       &source,
-                       sd_bus_get_fd(bus),
-                       POLLIN,
-                       dbus_handler, (void*)bus);
-  if (rc < 0) {
-    fprintf(stderr, "Cannot add bus event source.\n");
-  }
-#else
   /* If there is way to register a catch-all handler */
   sd_bus_attach_event(bus, loop, SD_EVENT_PRIORITY_NORMAL);
-#endif
   sigemptyset(&ss);
   sigaddset(&ss, SIGINT);
   rc = sigprocmask(SIG_BLOCK, &ss, NULL);