mirror of
https://github.com/morgan9e/systemd
synced 2026-04-15 08:56:15 +09:00
Merge pull request #3093 from poettering/nspawn-userns-magic
nspawn automatic user namespaces
This commit is contained in:
@@ -102,7 +102,7 @@ int copy_bytes(int fdf, int fdt, uint64_t max_bytes, bool try_reflink) {
|
||||
if (try_cfr) {
|
||||
n = try_copy_file_range(fdf, NULL, fdt, NULL, m, 0u);
|
||||
if (n < 0) {
|
||||
if (!IN_SET(n, -EINVAL, -ENOSYS, -EXDEV))
|
||||
if (!IN_SET(n, -EINVAL, -ENOSYS, -EXDEV, -EBADF))
|
||||
return n;
|
||||
|
||||
try_cfr = false;
|
||||
|
||||
@@ -25,11 +25,13 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "fd-util.h"
|
||||
#include "fs-util.h"
|
||||
#include "macro.h"
|
||||
#include "missing.h"
|
||||
#include "parse-util.h"
|
||||
#include "path-util.h"
|
||||
#include "socket-util.h"
|
||||
#include "stdio-util.h"
|
||||
#include "util.h"
|
||||
|
||||
int close_nointr(int fd) {
|
||||
@@ -356,3 +358,11 @@ bool fdname_is_valid(const char *s) {
|
||||
|
||||
return p - s < 256;
|
||||
}
|
||||
|
||||
int fd_get_path(int fd, char **ret) {
|
||||
char procfs_path[strlen("/proc/self/fd/") + DECIMAL_STR_MAX(int)];
|
||||
|
||||
xsprintf(procfs_path, "/proc/self/fd/%i", fd);
|
||||
|
||||
return readlink_malloc(procfs_path, ret);
|
||||
}
|
||||
|
||||
@@ -72,6 +72,8 @@ void cmsg_close_all(struct msghdr *mh);
|
||||
|
||||
bool fdname_is_valid(const char *s);
|
||||
|
||||
int fd_get_path(int fd, char **ret);
|
||||
|
||||
/* 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)
|
||||
|
||||
@@ -445,6 +445,10 @@ struct btrfs_ioctl_quota_ctl_args {
|
||||
#define TMPFS_MAGIC 0x01021994
|
||||
#endif
|
||||
|
||||
#ifndef MQUEUE_MAGIC
|
||||
#define MQUEUE_MAGIC 0x19800202
|
||||
#endif
|
||||
|
||||
#ifndef MS_MOVE
|
||||
#define MS_MOVE 8192
|
||||
#endif
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
bool uid_is_valid(uid_t uid);
|
||||
|
||||
@@ -63,3 +64,7 @@ int take_etc_passwd_lock(const char *root);
|
||||
|
||||
#define PTR_TO_GID(p) ((gid_t) (((uintptr_t) (p))-1))
|
||||
#define GID_TO_PTR(u) ((void*) (((uintptr_t) (u))+1))
|
||||
|
||||
static inline bool userns_supported(void) {
|
||||
return access("/proc/self/uid_map", F_OK) >= 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user