|
|
f0ceb1 |
From 001fe660b97e1be78622932d5b497f8415e8f7a0 Mon Sep 17 00:00:00 2001
|
|
|
3f476a |
From: Zuzana Svetlikova <zsvetlik@redhat.com>
|
|
|
3f476a |
Date: Wed, 19 Feb 2020 10:32:33 +0000
|
|
|
3f476a |
Subject: [PATCH] deps: Remove statx from libuv
|
|
|
3f476a |
|
|
|
3f476a |
Signed-off-by: rpm-build <rpm-build>
|
|
|
3f476a |
---
|
|
|
f0ceb1 |
deps/uv/src/unix/fs.c | 92 -------------------------------
|
|
|
f0ceb1 |
deps/uv/src/unix/linux-syscalls.c | 29 ----------
|
|
|
3f476a |
deps/uv/src/unix/linux-syscalls.h | 35 ------------
|
|
|
f0ceb1 |
3 files changed, 156 deletions(-)
|
|
|
3f476a |
|
|
|
3f476a |
diff --git a/deps/uv/src/unix/fs.c b/deps/uv/src/unix/fs.c
|
|
|
f0ceb1 |
index fd7ae08..04d5f0b 100644
|
|
|
3f476a |
--- a/deps/uv/src/unix/fs.c
|
|
|
3f476a |
+++ b/deps/uv/src/unix/fs.c
|
|
|
f0ceb1 |
@@ -1400,94 +1400,10 @@ static void uv__to_stat(struct stat* src, uv_stat_t* dst) {
|
|
|
3f476a |
}
|
|
|
3f476a |
|
|
|
3f476a |
|
|
|
3f476a |
-static int uv__fs_statx(int fd,
|
|
|
3f476a |
- const char* path,
|
|
|
3f476a |
- int is_fstat,
|
|
|
3f476a |
- int is_lstat,
|
|
|
3f476a |
- uv_stat_t* buf) {
|
|
|
3f476a |
- STATIC_ASSERT(UV_ENOSYS != -1);
|
|
|
3f476a |
-#ifdef __linux__
|
|
|
3f476a |
- static int no_statx;
|
|
|
3f476a |
- struct uv__statx statxbuf;
|
|
|
3f476a |
- int dirfd;
|
|
|
3f476a |
- int flags;
|
|
|
3f476a |
- int mode;
|
|
|
3f476a |
- int rc;
|
|
|
3f476a |
-
|
|
|
3f476a |
- if (uv__load_relaxed(&no_statx))
|
|
|
3f476a |
- return UV_ENOSYS;
|
|
|
3f476a |
-
|
|
|
3f476a |
- dirfd = AT_FDCWD;
|
|
|
3f476a |
- flags = 0; /* AT_STATX_SYNC_AS_STAT */
|
|
|
3f476a |
- mode = 0xFFF; /* STATX_BASIC_STATS + STATX_BTIME */
|
|
|
3f476a |
-
|
|
|
3f476a |
- if (is_fstat) {
|
|
|
3f476a |
- dirfd = fd;
|
|
|
3f476a |
- flags |= 0x1000; /* AT_EMPTY_PATH */
|
|
|
3f476a |
- }
|
|
|
3f476a |
-
|
|
|
3f476a |
- if (is_lstat)
|
|
|
3f476a |
- flags |= AT_SYMLINK_NOFOLLOW;
|
|
|
3f476a |
-
|
|
|
3f476a |
- rc = uv__statx(dirfd, path, flags, mode, &statxbuf);
|
|
|
3f476a |
-
|
|
|
3f476a |
- switch (rc) {
|
|
|
3f476a |
- case 0:
|
|
|
3f476a |
- break;
|
|
|
3f476a |
- case -1:
|
|
|
3f476a |
- /* EPERM happens when a seccomp filter rejects the system call.
|
|
|
3f476a |
- * Has been observed with libseccomp < 2.3.3 and docker < 18.04.
|
|
|
f0ceb1 |
- * EOPNOTSUPP is used on DVS exported filesystems
|
|
|
3f476a |
- */
|
|
|
f0ceb1 |
- if (errno != EINVAL && errno != EPERM && errno != ENOSYS && errno != EOPNOTSUPP)
|
|
|
3f476a |
- return -1;
|
|
|
3f476a |
- /* Fall through. */
|
|
|
3f476a |
- default:
|
|
|
3f476a |
- /* Normally on success, zero is returned and On error, -1 is returned.
|
|
|
3f476a |
- * Observed on S390 RHEL running in a docker container with statx not
|
|
|
3f476a |
- * implemented, rc might return 1 with 0 set as the error code in which
|
|
|
3f476a |
- * case we return ENOSYS.
|
|
|
3f476a |
- */
|
|
|
3f476a |
- uv__store_relaxed(&no_statx, 1);
|
|
|
3f476a |
- return UV_ENOSYS;
|
|
|
3f476a |
- }
|
|
|
3f476a |
-
|
|
|
f0ceb1 |
- buf->st_dev = makedev(statxbuf.stx_dev_major, statxbuf.stx_dev_minor);
|
|
|
3f476a |
- buf->st_mode = statxbuf.stx_mode;
|
|
|
3f476a |
- buf->st_nlink = statxbuf.stx_nlink;
|
|
|
3f476a |
- buf->st_uid = statxbuf.stx_uid;
|
|
|
3f476a |
- buf->st_gid = statxbuf.stx_gid;
|
|
|
f0ceb1 |
- buf->st_rdev = makedev(statxbuf.stx_rdev_major, statxbuf.stx_rdev_minor);
|
|
|
3f476a |
- buf->st_ino = statxbuf.stx_ino;
|
|
|
3f476a |
- buf->st_size = statxbuf.stx_size;
|
|
|
3f476a |
- buf->st_blksize = statxbuf.stx_blksize;
|
|
|
3f476a |
- buf->st_blocks = statxbuf.stx_blocks;
|
|
|
3f476a |
- buf->st_atim.tv_sec = statxbuf.stx_atime.tv_sec;
|
|
|
3f476a |
- buf->st_atim.tv_nsec = statxbuf.stx_atime.tv_nsec;
|
|
|
3f476a |
- buf->st_mtim.tv_sec = statxbuf.stx_mtime.tv_sec;
|
|
|
3f476a |
- buf->st_mtim.tv_nsec = statxbuf.stx_mtime.tv_nsec;
|
|
|
3f476a |
- buf->st_ctim.tv_sec = statxbuf.stx_ctime.tv_sec;
|
|
|
3f476a |
- buf->st_ctim.tv_nsec = statxbuf.stx_ctime.tv_nsec;
|
|
|
3f476a |
- buf->st_birthtim.tv_sec = statxbuf.stx_btime.tv_sec;
|
|
|
3f476a |
- buf->st_birthtim.tv_nsec = statxbuf.stx_btime.tv_nsec;
|
|
|
3f476a |
- buf->st_flags = 0;
|
|
|
3f476a |
- buf->st_gen = 0;
|
|
|
3f476a |
-
|
|
|
3f476a |
- return 0;
|
|
|
3f476a |
-#else
|
|
|
3f476a |
- return UV_ENOSYS;
|
|
|
3f476a |
-#endif /* __linux__ */
|
|
|
3f476a |
-}
|
|
|
3f476a |
-
|
|
|
3f476a |
-
|
|
|
3f476a |
static int uv__fs_stat(const char *path, uv_stat_t *buf) {
|
|
|
3f476a |
struct stat pbuf;
|
|
|
3f476a |
int ret;
|
|
|
3f476a |
|
|
|
3f476a |
- ret = uv__fs_statx(-1, path, /* is_fstat */ 0, /* is_lstat */ 0, buf);
|
|
|
3f476a |
- if (ret != UV_ENOSYS)
|
|
|
3f476a |
- return ret;
|
|
|
3f476a |
-
|
|
|
3f476a |
ret = stat(path, &pbuf);
|
|
|
3f476a |
if (ret == 0)
|
|
|
3f476a |
uv__to_stat(&pbuf, buf);
|
|
|
f0ceb1 |
@@ -1500,10 +1416,6 @@ static int uv__fs_lstat(const char *path, uv_stat_t *buf) {
|
|
|
3f476a |
struct stat pbuf;
|
|
|
3f476a |
int ret;
|
|
|
3f476a |
|
|
|
3f476a |
- ret = uv__fs_statx(-1, path, /* is_fstat */ 0, /* is_lstat */ 1, buf);
|
|
|
3f476a |
- if (ret != UV_ENOSYS)
|
|
|
3f476a |
- return ret;
|
|
|
3f476a |
-
|
|
|
3f476a |
ret = lstat(path, &pbuf);
|
|
|
3f476a |
if (ret == 0)
|
|
|
3f476a |
uv__to_stat(&pbuf, buf);
|
|
|
f0ceb1 |
@@ -1516,10 +1428,6 @@ static int uv__fs_fstat(int fd, uv_stat_t *buf) {
|
|
|
3f476a |
struct stat pbuf;
|
|
|
3f476a |
int ret;
|
|
|
3f476a |
|
|
|
3f476a |
- ret = uv__fs_statx(fd, "", /* is_fstat */ 1, /* is_lstat */ 0, buf);
|
|
|
3f476a |
- if (ret != UV_ENOSYS)
|
|
|
3f476a |
- return ret;
|
|
|
3f476a |
-
|
|
|
3f476a |
ret = fstat(fd, &pbuf);
|
|
|
3f476a |
if (ret == 0)
|
|
|
3f476a |
uv__to_stat(&pbuf, buf);
|
|
|
3f476a |
diff --git a/deps/uv/src/unix/linux-syscalls.c b/deps/uv/src/unix/linux-syscalls.c
|
|
|
f0ceb1 |
index 5071cd5..9bf67e9 100644
|
|
|
3f476a |
--- a/deps/uv/src/unix/linux-syscalls.c
|
|
|
3f476a |
+++ b/deps/uv/src/unix/linux-syscalls.c
|
|
|
f0ceb1 |
@@ -108,22 +108,6 @@
|
|
|
3f476a |
# endif
|
|
|
3f476a |
#endif /* __NR_copy_file_range */
|
|
|
3f476a |
|
|
|
3f476a |
-#ifndef __NR_statx
|
|
|
3f476a |
-# if defined(__x86_64__)
|
|
|
3f476a |
-# define __NR_statx 332
|
|
|
3f476a |
-# elif defined(__i386__)
|
|
|
3f476a |
-# define __NR_statx 383
|
|
|
3f476a |
-# elif defined(__aarch64__)
|
|
|
3f476a |
-# define __NR_statx 397
|
|
|
3f476a |
-# elif defined(__arm__)
|
|
|
3f476a |
-# define __NR_statx (UV_SYSCALL_BASE + 397)
|
|
|
3f476a |
-# elif defined(__ppc__)
|
|
|
3f476a |
-# define __NR_statx 383
|
|
|
3f476a |
-# elif defined(__s390__)
|
|
|
3f476a |
-# define __NR_statx 379
|
|
|
3f476a |
-# endif
|
|
|
3f476a |
-#endif /* __NR_statx */
|
|
|
3f476a |
-
|
|
|
3f476a |
#ifndef __NR_getrandom
|
|
|
3f476a |
# if defined(__x86_64__)
|
|
|
3f476a |
# define __NR_getrandom 318
|
|
|
f0ceb1 |
@@ -242,19 +226,6 @@ uv__fs_copy_file_range(int fd_in,
|
|
|
3f476a |
}
|
|
|
3f476a |
|
|
|
3f476a |
|
|
|
3f476a |
-int uv__statx(int dirfd,
|
|
|
3f476a |
- const char* path,
|
|
|
3f476a |
- int flags,
|
|
|
3f476a |
- unsigned int mask,
|
|
|
3f476a |
- struct uv__statx* statxbuf) {
|
|
|
f0ceb1 |
-#if !defined(__NR_statx) || defined(__ANDROID_API__) && __ANDROID_API__ < 30
|
|
|
3f476a |
- return errno = ENOSYS, -1;
|
|
|
f0ceb1 |
-#else
|
|
|
f0ceb1 |
- return syscall(__NR_statx, dirfd, path, flags, mask, statxbuf);
|
|
|
3f476a |
-#endif
|
|
|
3f476a |
-}
|
|
|
3f476a |
-
|
|
|
3f476a |
-
|
|
|
3f476a |
ssize_t uv__getrandom(void* buf, size_t buflen, unsigned flags) {
|
|
|
f0ceb1 |
#if !defined(__NR_getrandom) || defined(__ANDROID_API__) && __ANDROID_API__ < 28
|
|
|
f0ceb1 |
return errno = ENOSYS, -1;
|
|
|
3f476a |
diff --git a/deps/uv/src/unix/linux-syscalls.h b/deps/uv/src/unix/linux-syscalls.h
|
|
|
f0ceb1 |
index c85231f..a14023d 100644
|
|
|
3f476a |
--- a/deps/uv/src/unix/linux-syscalls.h
|
|
|
3f476a |
+++ b/deps/uv/src/unix/linux-syscalls.h
|
|
|
3f476a |
@@ -31,36 +31,6 @@
|
|
|
3f476a |
#include <sys/time.h>
|
|
|
3f476a |
#include <sys/socket.h>
|
|
|
3f476a |
|
|
|
3f476a |
-struct uv__statx_timestamp {
|
|
|
3f476a |
- int64_t tv_sec;
|
|
|
3f476a |
- uint32_t tv_nsec;
|
|
|
3f476a |
- int32_t unused0;
|
|
|
3f476a |
-};
|
|
|
3f476a |
-
|
|
|
3f476a |
-struct uv__statx {
|
|
|
3f476a |
- uint32_t stx_mask;
|
|
|
3f476a |
- uint32_t stx_blksize;
|
|
|
3f476a |
- uint64_t stx_attributes;
|
|
|
3f476a |
- uint32_t stx_nlink;
|
|
|
3f476a |
- uint32_t stx_uid;
|
|
|
3f476a |
- uint32_t stx_gid;
|
|
|
3f476a |
- uint16_t stx_mode;
|
|
|
3f476a |
- uint16_t unused0;
|
|
|
3f476a |
- uint64_t stx_ino;
|
|
|
3f476a |
- uint64_t stx_size;
|
|
|
3f476a |
- uint64_t stx_blocks;
|
|
|
3f476a |
- uint64_t stx_attributes_mask;
|
|
|
3f476a |
- struct uv__statx_timestamp stx_atime;
|
|
|
3f476a |
- struct uv__statx_timestamp stx_btime;
|
|
|
3f476a |
- struct uv__statx_timestamp stx_ctime;
|
|
|
3f476a |
- struct uv__statx_timestamp stx_mtime;
|
|
|
3f476a |
- uint32_t stx_rdev_major;
|
|
|
3f476a |
- uint32_t stx_rdev_minor;
|
|
|
3f476a |
- uint32_t stx_dev_major;
|
|
|
3f476a |
- uint32_t stx_dev_minor;
|
|
|
3f476a |
- uint64_t unused1[14];
|
|
|
3f476a |
-};
|
|
|
3f476a |
-
|
|
|
3f476a |
ssize_t uv__preadv(int fd, const struct iovec *iov, int iovcnt, int64_t offset);
|
|
|
3f476a |
ssize_t uv__pwritev(int fd, const struct iovec *iov, int iovcnt, int64_t offset);
|
|
|
3f476a |
int uv__dup3(int oldfd, int newfd, int flags);
|
|
|
3f476a |
@@ -71,11 +41,6 @@ uv__fs_copy_file_range(int fd_in,
|
|
|
f0ceb1 |
off_t* off_out,
|
|
|
3f476a |
size_t len,
|
|
|
3f476a |
unsigned int flags);
|
|
|
3f476a |
-int uv__statx(int dirfd,
|
|
|
3f476a |
- const char* path,
|
|
|
3f476a |
- int flags,
|
|
|
3f476a |
- unsigned int mask,
|
|
|
3f476a |
- struct uv__statx* statxbuf);
|
|
|
3f476a |
ssize_t uv__getrandom(void* buf, size_t buflen, unsigned flags);
|
|
|
3f476a |
|
|
|
3f476a |
#endif /* UV_LINUX_SYSCALL_H_ */
|
|
|
3f476a |
--
|
|
|
f0ceb1 |
2.31.1
|
|
|
3f476a |
|