diff options
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c index dea3976f1..c5ec0145e 100644 --- a/src/util.c +++ b/src/util.c @@ -1381,6 +1381,19 @@ rspamd_strtoul (const gchar *s, gsize len, gulong *value) return TRUE; } +gint +rspamd_fallocate (gint fd, off_t offset, off_t len) +{ +#if defined(HAVE_FALLOCATE) && defined(FALLOC_FL_KEEP_SIZE) + return fallocate (fd, FALLOC_FL_KEEP_SIZE, offset, len); +#elif defined(HAVE_POSIX_FALLOCATE) + return posix_fallocate (fd, offset, len); +#else + /* Return 0 as nothing can be done on this system */ + return 0; +#endif +} + /* * vi:ts=4 */ |