summaryrefslogtreecommitdiffstats
path: root/XUtils.h
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2020-11-25 12:42:36 +0100
committerBenBE <BenBE@geshi.org>2020-12-02 20:39:36 +0100
commitf7a89529330044f4e2a38e85a88ec90f839ae64e (patch)
tree23b187477ea294d9a0f7d0557c3a51acdd0cbdd0 /XUtils.h
parent1d8192c10b4e149c7f9126f00534f6a8488d10c4 (diff)
Add xReadfile wrapper for reading small to medium size files
Inspired by proposed Linux syscall Avoid file descriptor leaks like 4af8c63f
Diffstat (limited to 'XUtils.h')
-rw-r--r--XUtils.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/XUtils.h b/XUtils.h
index a978a0ed..d004785f 100644
--- a/XUtils.h
+++ b/XUtils.h
@@ -14,6 +14,7 @@ in the source distribution for its full text.
#include <stdlib.h> // IWYU pragma: keep
#include <string.h> // IWYU pragma: keep
+#include "Compat.h"
#include "Macros.h"
@@ -63,4 +64,7 @@ char* xStrdup(const char* str) ATTR_NONNULL;
char* xStrndup(const char* str, size_t len) ATTR_NONNULL;
+ssize_t xReadfile(const char* pathname, void* buffer, size_t count);
+ssize_t xReadfileat(openat_arg_t dirfd, const char* pathname, void* buffer, size_t count);
+
#endif

© 2014-2024 Faster IT GmbH | imprint | privacy policy