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

0a424e
From aa084bccf16e52dbc549f5f11788d374b49b130d Mon Sep 17 00:00:00 2001
0a424e
From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= <jstanek@redhat.com>
0a424e
Date: Thu, 16 Jan 2020 09:10:40 +0100
0a424e
Subject: [PATCH 3/4] deps: Remove statx from libuv
0a424e
MIME-Version: 1.0
0a424e
Content-Type: text/plain; charset=UTF-8
0a424e
Content-Transfer-Encoding: 8bit
0a424e
0a424e
Related: rhbz#1760184
0a424e
Signed-off-by: Jan Staněk <jstanek@redhat.com>
0a424e
---
0a424e
 deps/uv/src/unix/fs.c             | 82 -------------------------------
0a424e
 deps/uv/src/unix/linux-syscalls.c | 32 ------------
0a424e
 deps/uv/src/unix/linux-syscalls.h | 35 -------------
0a424e
 3 files changed, 149 deletions(-)
0a424e
0a424e
diff --git a/deps/uv/src/unix/fs.c b/deps/uv/src/unix/fs.c
0a424e
index b37cfbb..ab2365f 100644
0a424e
--- a/deps/uv/src/unix/fs.c
0a424e
+++ b/deps/uv/src/unix/fs.c
0a424e
@@ -1203,84 +1203,10 @@ static void uv__to_stat(struct stat* src, uv_stat_t* dst) {
13eaef
 }
0a424e
0a424e
13eaef
-static int uv__fs_statx(int fd,
13eaef
-                        const char* path,
13eaef
-                        int is_fstat,
13eaef
-                        int is_lstat,
13eaef
-                        uv_stat_t* buf) {
13eaef
-  STATIC_ASSERT(UV_ENOSYS != -1);
13eaef
-#ifdef __linux__
13eaef
-  static int no_statx;
13eaef
-  struct uv__statx statxbuf;
13eaef
-  int dirfd;
13eaef
-  int flags;
13eaef
-  int mode;
13eaef
-  int rc;
13eaef
-
13eaef
-  if (no_statx)
13eaef
-    return UV_ENOSYS;
13eaef
-
13eaef
-  dirfd = AT_FDCWD;
13eaef
-  flags = 0; /* AT_STATX_SYNC_AS_STAT */
13eaef
-  mode = 0xFFF; /* STATX_BASIC_STATS + STATX_BTIME */
13eaef
-
13eaef
-  if (is_fstat) {
13eaef
-    dirfd = fd;
13eaef
-    flags |= 0x1000; /* AT_EMPTY_PATH */
13eaef
-  }
13eaef
-
13eaef
-  if (is_lstat)
13eaef
-    flags |= AT_SYMLINK_NOFOLLOW;
13eaef
-
13eaef
-  rc = uv__statx(dirfd, path, flags, mode, &statxbuf);
13eaef
-
13eaef
-  if (rc == -1) {
13eaef
-    /* EPERM happens when a seccomp filter rejects the system call.
13eaef
-     * Has been observed with libseccomp < 2.3.3 and docker < 18.04.
13eaef
-     */
13eaef
-    if (errno != EINVAL && errno != EPERM && errno != ENOSYS)
13eaef
-      return -1;
13eaef
-
13eaef
-    no_statx = 1;
13eaef
-    return UV_ENOSYS;
13eaef
-  }
13eaef
-
13eaef
-  buf->st_dev = 256 * statxbuf.stx_dev_major + statxbuf.stx_dev_minor;
13eaef
-  buf->st_mode = statxbuf.stx_mode;
13eaef
-  buf->st_nlink = statxbuf.stx_nlink;
13eaef
-  buf->st_uid = statxbuf.stx_uid;
13eaef
-  buf->st_gid = statxbuf.stx_gid;
13eaef
-  buf->st_rdev = statxbuf.stx_rdev_major;
13eaef
-  buf->st_ino = statxbuf.stx_ino;
13eaef
-  buf->st_size = statxbuf.stx_size;
13eaef
-  buf->st_blksize = statxbuf.stx_blksize;
13eaef
-  buf->st_blocks = statxbuf.stx_blocks;
13eaef
-  buf->st_atim.tv_sec = statxbuf.stx_atime.tv_sec;
13eaef
-  buf->st_atim.tv_nsec = statxbuf.stx_atime.tv_nsec;
13eaef
-  buf->st_mtim.tv_sec = statxbuf.stx_mtime.tv_sec;
13eaef
-  buf->st_mtim.tv_nsec = statxbuf.stx_mtime.tv_nsec;
13eaef
-  buf->st_ctim.tv_sec = statxbuf.stx_ctime.tv_sec;
13eaef
-  buf->st_ctim.tv_nsec = statxbuf.stx_ctime.tv_nsec;
13eaef
-  buf->st_birthtim.tv_sec = statxbuf.stx_btime.tv_sec;
13eaef
-  buf->st_birthtim.tv_nsec = statxbuf.stx_btime.tv_nsec;
13eaef
-  buf->st_flags = 0;
13eaef
-  buf->st_gen = 0;
13eaef
-
13eaef
-  return 0;
13eaef
-#else
13eaef
-  return UV_ENOSYS;
13eaef
-#endif /* __linux__ */
13eaef
-}
13eaef
-
13eaef
-
13eaef
 static int uv__fs_stat(const char *path, uv_stat_t *buf) {
13eaef
   struct stat pbuf;
13eaef
   int ret;
0a424e
13eaef
-  ret = uv__fs_statx(-1, path, /* is_fstat */ 0, /* is_lstat */ 0, buf);
13eaef
-  if (ret != UV_ENOSYS)
13eaef
-    return ret;
13eaef
-
13eaef
   ret = stat(path, &pbuf);
13eaef
   if (ret == 0)
13eaef
     uv__to_stat(&pbuf, buf);
0a424e
@@ -1293,10 +1219,6 @@ static int uv__fs_lstat(const char *path, uv_stat_t *buf) {
13eaef
   struct stat pbuf;
13eaef
   int ret;
0a424e
13eaef
-  ret = uv__fs_statx(-1, path, /* is_fstat */ 0, /* is_lstat */ 1, buf);
13eaef
-  if (ret != UV_ENOSYS)
13eaef
-    return ret;
13eaef
-
13eaef
   ret = lstat(path, &pbuf);
13eaef
   if (ret == 0)
13eaef
     uv__to_stat(&pbuf, buf);
0a424e
@@ -1309,10 +1231,6 @@ static int uv__fs_fstat(int fd, uv_stat_t *buf) {
13eaef
   struct stat pbuf;
13eaef
   int ret;
0a424e
13eaef
-  ret = uv__fs_statx(fd, "", /* is_fstat */ 1, /* is_lstat */ 0, buf);
13eaef
-  if (ret != UV_ENOSYS)
13eaef
-    return ret;
13eaef
-
13eaef
   ret = fstat(fd, &pbuf);
13eaef
   if (ret == 0)
13eaef
     uv__to_stat(&pbuf, buf);
0a424e
diff --git a/deps/uv/src/unix/linux-syscalls.c b/deps/uv/src/unix/linux-syscalls.c
0a424e
index 9503878..9560fe6 100644
0a424e
--- a/deps/uv/src/unix/linux-syscalls.c
0a424e
+++ b/deps/uv/src/unix/linux-syscalls.c
0a424e
@@ -187,22 +187,6 @@
13eaef
 # endif
13eaef
 #endif /* __NR_pwritev */
0a424e
13eaef
-#ifndef __NR_statx
13eaef
-# if defined(__x86_64__)
13eaef
-#  define __NR_statx 332
13eaef
-# elif defined(__i386__)
13eaef
-#  define __NR_statx 383
13eaef
-# elif defined(__aarch64__)
13eaef
-#  define __NR_statx 397
13eaef
-# elif defined(__arm__)
13eaef
-#  define __NR_statx (UV_SYSCALL_BASE + 397)
13eaef
-# elif defined(__ppc__)
13eaef
-#  define __NR_statx 383
13eaef
-# elif defined(__s390__)
13eaef
-#  define __NR_statx 379
13eaef
-# endif
13eaef
-#endif /* __NR_statx */
13eaef
-
0a424e
 #ifndef __NR_getrandom
0a424e
 # if defined(__x86_64__)
0a424e
 #  define __NR_getrandom 318
0a424e
@@ -369,22 +353,6 @@ int uv__dup3(int oldfd, int newfd, int flags) {
0a424e
 }
0a424e
0a424e
13eaef
-int uv__statx(int dirfd,
13eaef
-              const char* path,
13eaef
-              int flags,
13eaef
-              unsigned int mask,
13eaef
-              struct uv__statx* statxbuf) {
13eaef
-  /* __NR_statx make Android box killed by SIGSYS.
13eaef
-   * That looks like a seccomp2 sandbox filter rejecting the system call.
13eaef
-   */
13eaef
-#if defined(__NR_statx) && !defined(__ANDROID__)
13eaef
-  return syscall(__NR_statx, dirfd, path, flags, mask, statxbuf);
13eaef
-#else
13eaef
-  return errno = ENOSYS, -1;
13eaef
-#endif
0a424e
-}
0a424e
-
0a424e
-
0a424e
 ssize_t uv__getrandom(void* buf, size_t buflen, unsigned flags) {
0a424e
 #if defined(__NR_getrandom)
0a424e
   return syscall(__NR_getrandom, buf, buflen, flags);
0a424e
diff --git a/deps/uv/src/unix/linux-syscalls.h b/deps/uv/src/unix/linux-syscalls.h
0a424e
index b7729b8..7312b0c 100644
0a424e
--- a/deps/uv/src/unix/linux-syscalls.h
0a424e
+++ b/deps/uv/src/unix/linux-syscalls.h
13eaef
@@ -80,36 +80,6 @@
13eaef
 #define UV__IN_DELETE_SELF    0x400
13eaef
 #define UV__IN_MOVE_SELF      0x800
0a424e
13eaef
-struct uv__statx_timestamp {
13eaef
-  int64_t tv_sec;
13eaef
-  uint32_t tv_nsec;
13eaef
-  int32_t unused0;
13eaef
-};
13eaef
-
13eaef
-struct uv__statx {
13eaef
-  uint32_t stx_mask;
13eaef
-  uint32_t stx_blksize;
13eaef
-  uint64_t stx_attributes;
13eaef
-  uint32_t stx_nlink;
13eaef
-  uint32_t stx_uid;
13eaef
-  uint32_t stx_gid;
13eaef
-  uint16_t stx_mode;
13eaef
-  uint16_t unused0;
13eaef
-  uint64_t stx_ino;
13eaef
-  uint64_t stx_size;
13eaef
-  uint64_t stx_blocks;
13eaef
-  uint64_t stx_attributes_mask;
13eaef
-  struct uv__statx_timestamp stx_atime;
13eaef
-  struct uv__statx_timestamp stx_btime;
13eaef
-  struct uv__statx_timestamp stx_ctime;
13eaef
-  struct uv__statx_timestamp stx_mtime;
13eaef
-  uint32_t stx_rdev_major;
13eaef
-  uint32_t stx_rdev_minor;
13eaef
-  uint32_t stx_dev_major;
13eaef
-  uint32_t stx_dev_minor;
13eaef
-  uint64_t unused1[14];
13eaef
-};
13eaef
-
13eaef
 struct uv__inotify_event {
13eaef
   int32_t wd;
13eaef
   uint32_t mask;
0a424e
@@ -143,11 +113,6 @@ int uv__sendmmsg(int fd,
13eaef
 ssize_t uv__preadv(int fd, const struct iovec *iov, int iovcnt, int64_t offset);
13eaef
 ssize_t uv__pwritev(int fd, const struct iovec *iov, int iovcnt, int64_t offset);
13eaef
 int uv__dup3(int oldfd, int newfd, int flags);
13eaef
-int uv__statx(int dirfd,
13eaef
-              const char* path,
13eaef
-              int flags,
13eaef
-              unsigned int mask,
13eaef
-              struct uv__statx* statxbuf);
0a424e
 ssize_t uv__getrandom(void* buf, size_t buflen, unsigned flags);
0a424e
13eaef
 #endif /* UV_LINUX_SYSCALL_H_ */
0a424e
--
0a424e
2.24.1
0a424e