Blame SOURCES/deps-Remove-statx-from-libuv.patch

3f476a
From ba78c957478bdd5de98c6ad5d16eff9771275360 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
---
3f476a
 deps/uv/src/unix/fs.c             | 91 -------------------------------
3f476a
 deps/uv/src/unix/linux-syscalls.c | 32 -----------
3f476a
 deps/uv/src/unix/linux-syscalls.h | 35 ------------
3f476a
 3 files changed, 158 deletions(-)
3f476a
3f476a
diff --git a/deps/uv/src/unix/fs.c b/deps/uv/src/unix/fs.c
3f476a
index 87cb8b8..0a85307 100644
3f476a
--- a/deps/uv/src/unix/fs.c
3f476a
+++ b/deps/uv/src/unix/fs.c
3f476a
@@ -1370,93 +1370,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.
3f476a
-     */
3f476a
-    if (errno != EINVAL && errno != EPERM && errno != ENOSYS)
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
-
3f476a
-  buf->st_dev = 256 * 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;
3f476a
-  buf->st_rdev = statxbuf.stx_rdev_major;
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);
3f476a
@@ -1469,10 +1386,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);
3f476a
@@ -1485,10 +1398,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
3f476a
index 160056b..e41f8c9 100644
3f476a
--- a/deps/uv/src/unix/linux-syscalls.c
3f476a
+++ b/deps/uv/src/unix/linux-syscalls.c
3f476a
@@ -112,22 +112,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
3f476a
@@ -220,22 +204,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) {
3f476a
-  /* __NR_statx make Android box killed by SIGSYS.
3f476a
-   * That looks like a seccomp2 sandbox filter rejecting the system call.
3f476a
-   */
3f476a
-#if defined(__NR_statx) && !defined(__ANDROID__)
3f476a
-  return syscall(__NR_statx, dirfd, path, flags, mask, statxbuf);
3f476a
-#else
3f476a
-  return errno = ENOSYS, -1;
3f476a
-#endif
3f476a
-}
3f476a
-
3f476a
-
3f476a
 ssize_t uv__getrandom(void* buf, size_t buflen, unsigned flags) {
3f476a
 #if defined(__NR_getrandom)
3f476a
   return syscall(__NR_getrandom, buf, buflen, flags);
3f476a
diff --git a/deps/uv/src/unix/linux-syscalls.h b/deps/uv/src/unix/linux-syscalls.h
3f476a
index 761ff32..5dcf3a3 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,
3f476a
                        ssize_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
-- 
3f476a
2.26.2
3f476a