Blob Blame History Raw
From 001fe660b97e1be78622932d5b497f8415e8f7a0 Mon Sep 17 00:00:00 2001
From: Zuzana Svetlikova <zsvetlik@redhat.com>
Date: Wed, 19 Feb 2020 10:32:33 +0000
Subject: [PATCH] deps: Remove statx from libuv

Signed-off-by: rpm-build <rpm-build>
---
 deps/uv/src/unix/fs.c             | 92 -------------------------------
 deps/uv/src/unix/linux-syscalls.c | 29 ----------
 deps/uv/src/unix/linux-syscalls.h | 35 ------------
 3 files changed, 156 deletions(-)

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