summaryrefslogtreecommitdiff
path: root/src/bin/evas/evas_cserve2_shm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/evas/evas_cserve2_shm.c')
-rw-r--r--src/bin/evas/evas_cserve2_shm.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/bin/evas/evas_cserve2_shm.c b/src/bin/evas/evas_cserve2_shm.c
index 99b7f25066..0c31e17e34 100644
--- a/src/bin/evas/evas_cserve2_shm.c
+++ b/src/bin/evas/evas_cserve2_shm.c
@@ -193,3 +193,41 @@ cserve2_shm_unmap(Shm_Handle *shm)
193 munmap(shm->data, shm->image_size); 193 munmap(shm->data, shm->image_size);
194 shm->data = NULL; 194 shm->data = NULL;
195} 195}
196
197static void
198_cserve2_shm_cleanup()
199{
200 Eina_Iterator *iter;
201 const Eina_File_Direct_Info *f_info;
202 char pattern[NAME_MAX];
203
204 sprintf(pattern, "evas-shm-img-%x-", (int) getuid());
205 iter = eina_file_direct_ls("/dev/shm");
206 EINA_ITERATOR_FOREACH(iter, f_info)
207 {
208 if (strstr(f_info->path, pattern))
209 {
210 const char *shmname = strrchr(f_info->path, '/');
211 if (!shmname) continue;
212
213 if (shm_unlink(shmname) == -1)
214 ERR("Failed to remove shm entry at %s: %d %s", shmname, errno, strerror(errno));
215 else
216 DBG("cserve2 cleanup: removed %s", shmname);
217 }
218 else
219 DBG("cserve2 cleanup: ignoring %s", f_info->path);
220 }
221}
222
223void
224cserve2_shm_init()
225{
226 _cserve2_shm_cleanup();
227}
228
229void
230cserve2_shm_shutdown()
231{
232 _cserve2_shm_cleanup();
233}