summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfgang Hommel <wolfgang.hommel@unibw.de>2019-08-23 14:46:06 +0200
committerWolfgang Hommel <wolfgang.hommel@unibw.de>2019-08-23 14:46:06 +0200
commitd79ed053d70b6e73d76207f04cba56848d35f129 (patch)
tree795c164903a7a74b8bbfb51d56f64473f3079ca5
parent416c5f4708f9217a6f0d6d71bd5af730f34a4d5a (diff)
downloadlibfaketime-d79ed053d70b6e73d76207f04cba56848d35f129.tar.gz
Updated documentation regarding shared memory, fixed spelling
-rw-r--r--README26
-rw-r--r--src/libfaketime.c4
2 files changed, 28 insertions, 2 deletions
diff --git a/README b/README
index 892484d..b644a9f 100644
--- a/README
+++ b/README
@@ -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);
}
/*