Add some dummy service representation
authorKrzysztof Opasiak <k.opasiak@samsung.com>
Mon, 24 Apr 2017 16:48:53 +0000 (18:48 +0200)
committerKrzysztof Opasiak <k.opasiak@samsung.com>
Mon, 24 Apr 2017 16:48:53 +0000 (18:48 +0200)
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
src/service.c [new file with mode: 0644]
src/service.h [new file with mode: 0644]

diff --git a/src/service.c b/src/service.c
new file mode 100644 (file)
index 0000000..abf6364
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+
+#include "service.h"
+
+int system_service_init(pid_t pid, char *name, struct system_service *s)
+{
+
+        /* TODO: Get real pid if < 0 */
+        s->pid = pid;
+        
+        /* TODO: Get real service name if NULL */
+        s->name = name;
+}
+
+void system_service_cleanup(struct system_service *s)
+{
+        if (s)
+                free(s->name);
+}
diff --git a/src/service.h b/src/service.h
new file mode 100644 (file)
index 0000000..f7b0658
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+
+#ifndef FAULTD_SERVICE_H
+#define FAULTD_SERVICE_H
+
+#include <sys/types.h>
+#include <unistd.h>
+
+struct system_service {
+        pid_t pid;
+        char *name;
+};
+
+int system_service_init(pid_t pid, char *name, struct system_service *s);
+
+void system_service_cleanup(struct system_service *s);
+
+#endif /* FAULTD_SERVICE_H */