diff options
-rw-r--r-- | README | 26 | ||||
-rw-r--r-- | src/libfaketime.c | 4 |
2 files changed, 28 insertions, 2 deletions
@@ -417,6 +417,32 @@ file timestamps. Using FAKETIME_XRESET should be considered experimental at the moment. +Cleaning up shared memory +------------------------- + +libfaketime uses semaphores and shared memory on platforms that support it in +order to sync faketime settings across parent-child processes. It will clean +up when it exits properly. However, when processes are terminated (e.g., by +Ctrl-C on command line), shared memory cannot be cleaned up properly. In such +cases, you should occasionally delete + + /dev/shm/faketime_shm_* and + /dev/shm/sem.faketime_sem_* + +manually (or properly automated). Leftover files there from processes that +already have been terminated are not a problem in general, but result in a +libfaketime error the next time a process is started with a process id for +which such a stale semaphore/shared memory exists. Thus, if you run across +the following error message + + libfaketime: In ft_shm_create(), shm_open failed: File exists + +please cleanup /dev/shm as described above. This is especially relevant +for long-running systems (servers with high uptime) and systems on which +a lot of processes are started (e.g., servers handling many containers +or similar virtualization mechanisms). + + 4f) Faking the date and time system-wide ---------------------------------------- diff --git a/src/libfaketime.c b/src/libfaketime.c index b24a424..5e7ebdf 100644 --- a/src/libfaketime.c +++ b/src/libfaketime.c @@ -354,7 +354,7 @@ static void ft_shm_create(void) { if (-1 == munmap(ft_sharedN, (sizeof(struct ft_shared_s)))) { - perror("libfaktime: In ft_shm_create(), munmap failed"); + perror("libfaketime: In ft_shm_create(), munmap failed"); exit(EXIT_FAILURE); } if (sem_post(semN) == -1) @@ -392,7 +392,7 @@ static void ft_shm_destroy(void) { if (sscanf(ft_shared_env, "%255s %255s", sem_name, shm_name) < 2) { - printf("libfaktime: In ft_shm_destroy(), error parsing semaphore name and shared memory id from string: %s", ft_shared_env); + printf("libfaketime: In ft_shm_destroy(), error parsing semaphore name and shared memory id from string: %s", ft_shared_env); exit(1); } /* |