src/action/system_reboot_to_recovery.c \
src/core/event.c \
src/core/event_processor.c \
- src/core/service.c \
src/core/module.c \
+ src/core/service.c \
src/decision_makers/rv_dm.c \
src/event_types/decision_made_event.c \
src/event_types/resource_violation_event.c \
src/listeners/audit.c \
src/listeners/systemd.c \
src/util/log.c \
+ src/util/common.c \
src/util/notify_queue.c \
src/util/systemd_dbus.c
faultd_LDADD = $(LIBSYSTEMD_LIBS) $(AUDIT_LIBS) $(LIBEJDB_LIBS)
--- /dev/null
+/*
+ * This file is a part of faultd.
+ *
+ * Copyright © 2017 Samsung Electronics
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define _GNU_SOURCE 1
+
+#include <ejdb/bson.h>
+#include <time.h>
+
+#include "common.h"
+
+GENERATE_BSON_APPEND_STRUCT(timespec,
+ bson_append_long(out, "sec", data->tv_sec);
+ bson_append_long(out, "nsec", data->tv_nsec);
+ )
#ifndef FAULTD_COMMON_H
#define FAULTD_COMMON_H
+#include <ejdb/bson.h>
#include <stdlib.h>
+#include <time.h>
#define ARRAY_SIZE(a) (sizeof(a)/sizeof(*a))
}
#define _cleanup_free_ _cleanup_(freep)
+#define DECLARE_BSON_APPEND_STRUCT(type) \
+ void faultd_bson_append_##type(bson* out, const char *key, struct type *data)
+
+/* FIXME: bson_append_XXX can faile, check return codes */
+#define GENERATE_BSON_APPEND_STRUCT(type, code) \
+ DECLARE_BSON_APPEND_STRUCT(type) \
+ { \
+ bson_append_start_object(out, key); \
+ do { code } while(0); \
+ bson_append_finish_object(out); \
+ }
+
+DECLARE_BSON_APPEND_STRUCT(timespec);
+
#endif /* FAULTD_COMMON_H */