mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-12 12:14:36 +03:00
Add xReadfile wrapper for reading small to medium size files
Inspired by proposed Linux syscall
Avoid file descriptor leaks like 4af8c63f
This commit is contained in:

committed by
BenBE

parent
1d8192c10b
commit
f7a8952933
4
XUtils.h
4
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
|
||||
|
Reference in New Issue
Block a user