mirror of
https://github.com/systemd/systemd.git
synced 2024-12-31 21:18:09 +03:00
sd-journal: drop memfd fallback
This commit is contained in:
parent
52cd287933
commit
ce66a2f2bb
@ -233,7 +233,6 @@ _public_ int sd_journal_sendv(const struct iovec *iov, int n) {
|
||||
};
|
||||
ssize_t k;
|
||||
bool have_syslog_identifier = false;
|
||||
bool seal = true;
|
||||
|
||||
assert_return(iov, -EINVAL);
|
||||
assert_return(n > 0, -EINVAL);
|
||||
@ -312,35 +311,19 @@ _public_ int sd_journal_sendv(const struct iovec *iov, int n) {
|
||||
if (!IN_SET(errno, EMSGSIZE, ENOBUFS, EAGAIN))
|
||||
return -errno;
|
||||
|
||||
/* Message doesn't fit... Let's dump the data in a memfd or
|
||||
* temporary file and just pass a file descriptor of it to the
|
||||
* other side.
|
||||
*
|
||||
* For the temporary files we use /dev/shm instead of /tmp
|
||||
* here, since we want this to be a tmpfs, and one that is
|
||||
* available from early boot on and where unprivileged users
|
||||
* can create files. */
|
||||
buffer_fd = memfd_new(NULL);
|
||||
if (buffer_fd < 0) {
|
||||
if (buffer_fd == -ENOSYS) {
|
||||
buffer_fd = open_tmpfile_unlinkable("/dev/shm", O_RDWR | O_CLOEXEC);
|
||||
if (buffer_fd < 0)
|
||||
return buffer_fd;
|
||||
|
||||
seal = false;
|
||||
} else
|
||||
return buffer_fd;
|
||||
}
|
||||
/* Message doesn't fit... Let's dump the data in a memfd or temporary file and just pass a file
|
||||
* descriptor of it to the other side. */
|
||||
buffer_fd = memfd_new("journal-data");
|
||||
if (buffer_fd < 0)
|
||||
return buffer_fd;
|
||||
|
||||
n = writev(buffer_fd, w, j);
|
||||
if (n < 0)
|
||||
return -errno;
|
||||
|
||||
if (seal) {
|
||||
r = memfd_set_sealed(buffer_fd);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
r = memfd_set_sealed(buffer_fd);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = send_one_fd_sa(fd, buffer_fd, mh.msg_name, mh.msg_namelen, 0);
|
||||
if (r == -ENOENT)
|
||||
|
Loading…
Reference in New Issue
Block a user