diff options
author | Lennart Poettering <lennart@poettering.net> | 2017-10-27 10:56:42 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2017-11-17 11:13:44 +0100 |
commit | a548e14d690133dd8cca2d5ab8082bb23259fd5f (patch) | |
tree | 3de3fab023051eb731b97833290ed5fad7727467 /src/basic/fd-util.h | |
parent | 9bd6a50e90427dd120d0c9495b50fda2f72887b6 (diff) | |
download | systemd-a548e14d690133dd8cca2d5ab8082bb23259fd5f.tar.gz |
fd-util: add new acquire_data_fd() API helper
All this function does is place some data in an in-memory read-only fd,
that may be read back to get the original data back.
Doing this in a way that works everywhere, given the different kernels
we support as well as different privilege levels is surprisingly
complex.
Diffstat (limited to 'src/basic/fd-util.h')
-rw-r--r-- | src/basic/fd-util.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h index 7c527850ed..df5a5fad98 100644 --- a/src/basic/fd-util.h +++ b/src/basic/fd-util.h @@ -77,6 +77,16 @@ int fd_get_path(int fd, char **ret); int move_fd(int from, int to, int cloexec); +enum { + ACQUIRE_NO_DEV_NULL = 1 << 0, + ACQUIRE_NO_MEMFD = 1 << 1, + ACQUIRE_NO_PIPE = 1 << 2, + ACQUIRE_NO_TMPFILE = 1 << 3, + ACQUIRE_NO_REGULAR = 1 << 4, +}; + +int acquire_data_fd(const void *data, size_t size, unsigned flags); + /* Hint: ENETUNREACH happens if we try to connect to "non-existing" special IP addresses, such as ::5 */ #define ERRNO_IS_DISCONNECT(r) \ IN_SET(r, ENOTCONN, ECONNRESET, ECONNREFUSED, ECONNABORTED, EPIPE, ENETUNREACH) |