summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlastair Poole <netstar@gmail.com>2021-07-31 09:33:51 +0100
committerAlastair Poole <netstar@gmail.com>2021-07-31 09:33:51 +0100
commitcebd8825994b44d51ae5092c4c90789230cf0022 (patch)
tree08e206a4bd32447c00c09c25ab4ef3d5c5d22177
parent7bcee647fdfb85f1f2a651f1a8ba4b0269b48927 (diff)
enigmatic: running
-rw-r--r--src/bin/Enigmatic.h3
-rw-r--r--src/bin/client/meson.build1
-rw-r--r--src/bin/enigmatic.c22
3 files changed, 26 insertions, 0 deletions
diff --git a/src/bin/Enigmatic.h b/src/bin/Enigmatic.h
index c5b4de1..c1d9063 100644
--- a/src/bin/Enigmatic.h
+++ b/src/bin/Enigmatic.h
@@ -119,4 +119,7 @@ enigmatic_launch(void);
119void 119void
120enigmatic_terminate(void); 120enigmatic_terminate(void);
121 121
122Eina_Bool
123enigmatic_running(void);
124
122#endif 125#endif
diff --git a/src/bin/client/meson.build b/src/bin/client/meson.build
index 8dd14a6..1d11f96 100644
--- a/src/bin/client/meson.build
+++ b/src/bin/client/meson.build
@@ -12,6 +12,7 @@ src_client += files([
12src_client += src_log 12src_client += src_log
13src_client += src_stubby 13src_client += src_stubby
14src_client += src_generic 14src_client += src_generic
15src_client += src_system
15 16
16executable('testme', src_client, 17executable('testme', src_client,
17 include_directories : [ inc, config_dir, inc_lz4 ], 18 include_directories : [ inc, config_dir, inc_lz4 ],
diff --git a/src/bin/enigmatic.c b/src/bin/enigmatic.c
index 8832f32..403e177 100644
--- a/src/bin/enigmatic.c
+++ b/src/bin/enigmatic.c
@@ -87,3 +87,25 @@ enigmatic_launch(void)
87 ecore_exe_run(PACKAGE"_start", NULL); 87 ecore_exe_run(PACKAGE"_start", NULL);
88} 88}
89 89
90Eina_Bool
91enigmatic_running(void)
92{
93 char *path;
94 Proc_Info *proc;
95 Eina_Bool running = 0;
96
97 path = _pidfile_path();
98 if ((path) && (ecore_file_exists(path)))
99 {
100 pid_t pid = enigmatic_pidfile_pid_get(path);
101 proc = proc_info_by_pid(pid);
102 if (proc)
103 {
104 if (!strcmp(proc->command, PACKAGE))
105 running = 1;
106 proc_info_free(proc);
107 }
108 free(path);
109 }
110 return running;
111}