tree-wide: drop acquire_data_fd_full() helper

Let's drop support systems lacking memfds, i.e. pre kernel 3.17 systems.
This allows us to drastically simplify the "data fd" concept, so far
that we can remove it entirely.

This replaces acquire_data_fd() with a specialized call to
memfd_new_and_seal(), not that memfds can be the only implementation of
the concept.
This commit is contained in:
Lennart Poettering
2024-12-13 18:51:34 +01:00
parent 8d08f18b52
commit a87a9625f8
14 changed files with 65 additions and 289 deletions

View File

@@ -177,6 +177,9 @@ int memfd_new_and_seal(const char *name, const void *data, size_t sz) {
assert(data || sz == 0);
if (sz == SIZE_MAX)
sz = strlen(data);
fd = memfd_new(name);
if (fd < 0)
return fd;

View File

@@ -11,6 +11,9 @@ int memfd_create_wrapper(const char *name, unsigned mode);
int memfd_new(const char *name);
int memfd_new_and_map(const char *name, size_t sz, void **p);
int memfd_new_and_seal(const char *name, const void *data, size_t sz);
static inline int memfd_new_and_seal_string(const char *name, const char *s) {
return memfd_new_and_seal(name, s, SIZE_MAX);
}
int memfd_add_seals(int fd, unsigned int seals);
int memfd_get_seals(int fd, unsigned int *ret_seals);