mirror of
https://github.com/systemd/systemd.git
synced 2026-08-04 23:20:32 +00:00
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:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user