diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-09-27 13:24:10 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-09-27 16:02:19 -0400 |
commit | 9f535ba4e016f02c6d1bca45d6adfd04a036c9c1 (patch) | |
tree | 2c92cc05d1ef80669f32dc7c5a7769c50d83514b | |
parent | 108242ce16fc7d7d9e81a1a6e9783fd9bda8b60c (diff) | |
download | stasis-9f535ba4e016f02c6d1bca45d6adfd04a036c9c1.tar.gz |
Fix missing COMMAND string in the log header
-rw-r--r-- | src/multiprocessing.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/multiprocessing.c b/src/multiprocessing.c index 5d22901..1320a2a 100644 --- a/src/multiprocessing.c +++ b/src/multiprocessing.c @@ -138,6 +138,11 @@ struct MultiProcessingTask *mp_pool_task(struct MultiProcessingPool *pool, const fflush(tp); fclose(tp); + // Record the command(s) + slot->cmd_len = (strlen(cmd) * sizeof(*cmd)) + 1; + slot->cmd = mmap(NULL, slot->cmd_len, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0); + memset(slot->cmd, 0, slot->cmd_len); + strncpy(slot->cmd, cmd, slot->cmd_len); return slot; } @@ -419,6 +424,11 @@ void mp_pool_free(struct MultiProcessingPool **pool) { } // Unmap all pool tasks if ((*pool)->task) { + if ((*pool)->task->cmd) { + if (munmap((*pool)->task->cmd, (*pool)->task->cmd_len) < 0) { + perror("munmap"); + } + } if (munmap((*pool)->task, sizeof(*(*pool)->task) * (*pool)->num_alloc) < 0) { perror("munmap"); } |