Merge branch 'development' into fix/all_the_things

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2020-12-21 20:52:20 +01:00
2 changed files with 10 additions and 56 deletions
+1 -1
View File
@@ -123,7 +123,7 @@ unsigned int getOverTimeID(time_t timestamp)
void moveOverTimeMemory(const time_t mintime)
{
const time_t oldestOverTimeIS = overTime[0].timestamp;
// Shift SHOULD timestemp into the future by the amount GC is running earlier
// Shift SHOULD timestamp into the future by the amount GC is running earlier
time_t oldestOverTimeSHOULD = mintime;
// Center in interval
+9 -55
View File
@@ -512,35 +512,12 @@ SharedMemory create_shm(const char *name, const size_t size, bool create_new)
// Using f[tl]allocate() will ensure that there's actually space for
// this file. Otherwise we end up with a sparse file that can give
// SIGBUS if we run out of space while writing to it.
int ret = ftlallocate(fd, 0U, size);
const int fallocate_errno = errno;
const int ret = ftlallocate(fd, 0U, size);
if(ret != 0)
{
// Try again with ftruncate() if fallocate() failed with
// "Operation not supported"
if(errno == ENOTSUP)
{
ret = ftruncate(fd, size);
// Report info that space has only been reserved, not
// really allocated
if(ret == 0)
{
logg("INFO: create_shm(): Failed to allocate %zu bytes for \"%s\" (%s, %i), "\
"space has only been reserved.",
size, sharedMemory.name, strerror(errno), errno);
}
}
if(ret != 0)
{
logg("FATAL: create_shm(): Failed to resize \"%s\" (%i) to %zu:",
sharedMemory.name, fd, size);
logg(" fallocate returned: %s (%i)",
strerror(fallocate_errno), fallocate_errno);
logg(" ftruncate returned: %s (%i)",
strerror(errno), errno);
exit(EXIT_FAILURE);
}
logg("FATAL: create_shm(): Failed to resize \"%s\" (%i) to %zu: %s (%i)",
sharedMemory.name, fd, size, strerror(errno), ret);
exit(EXIT_FAILURE);
}
// Create shared memory mapping
@@ -659,35 +636,12 @@ bool realloc_shm(SharedMemory *sharedMemory, const size_t size1, const size_t si
// Using f[tl]allocate() will ensure that there's actually space for
// this file. Otherwise we end up with a sparse file that can give
// SIGBUS if we run out of space while writing to it.
int ret = ftlallocate(fd, 0U, size);
const int fallocate_errno = errno;
if(ret == -1)
const int ret = ftlallocate(fd, 0U, size);
if(ret != 0)
{
// Try again with ftruncate() if fallocate() failed with
// "Operation not supported"
if(errno == ENOTSUP)
{
ret = ftruncate(fd, size);
// Report info that space has only been reserved, not
// really allocated
if(ret == 0)
{
logg("INFO: realloc_shm(): Failed to allocate %zu bytes for \"%s\" (%s), "\
"space has only been reserved.",
size, sharedMemory->name, strerror(errno));
}
}
if(ret == -1)
{
logg("FATAL: realloc_shm(): Failed to resize \"%s\" (%i) to %zu:",
sharedMemory->name, fd, size);
logg(" fallocate returned: %s (%i)",
strerror(fallocate_errno), fallocate_errno);
logg(" ftruncate returned: %s (%i)",
strerror(errno), errno);
exit(EXIT_FAILURE);
}
logg("FATAL: realloc_shm(): Failed to resize \"%s\" (%i) to %zu: %s (%i)",
sharedMemory->name, fd, size, strerror(errno), ret);
exit(EXIT_FAILURE);
}
// Close shared memory object file descriptor as it is no longer