summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2019-11-06 13:20:01 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-11-07 22:30:39 +0000
commit4dab6ebbdf5da361c7e1c5ec0b62a5e32f7c6e83 (patch)
tree82283e601d472274031f04b2b629f2a2b567ef5f /meta
parent57ea3e78bd0e4ba68e47001d8b261854749c29fa (diff)
downloadpoky-4dab6ebbdf5da361c7e1c5ec0b62a5e32f7c6e83.tar.gz
pseudo: Add statx support to fix fedora30 issues
Modern distros (e.g. fedora30) are starting to use the new statx() syscall through the newly exposed glibc wrapper function in software like coreutils (e.g. the ls command). Add support to intercept this to pseudo. (From OE-Core rev: 11694eb59bea347085d6e389df0b46826219c0d3) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-devtools/pseudo/files/0001-Add-statx.patch106
-rw-r--r--meta/recipes-devtools/pseudo/pseudo_git.bb1
2 files changed, 107 insertions, 0 deletions
diff --git a/meta/recipes-devtools/pseudo/files/0001-Add-statx.patch b/meta/recipes-devtools/pseudo/files/0001-Add-statx.patch
new file mode 100644
index 0000000000..f01e699de7
--- /dev/null
+++ b/meta/recipes-devtools/pseudo/files/0001-Add-statx.patch
@@ -0,0 +1,106 @@
1From 4e41a05de1f34ba00a68ca4f20fb49c4d1cbd2d0 Mon Sep 17 00:00:00 2001
2From: Richard Purdie <richard.purdie@linuxfoundation.org>
3Date: Wed, 6 Nov 2019 12:17:46 +0000
4Subject: [PATCH] Add statx glibc/syscall support
5
6Modern distros (e.g. fedora30) are starting to use the new statx() syscall through
7the newly exposed glibc wrapper function in software like coreutils (e.g. the ls
8command). Add support to intercept this to pseudo.
9
10Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
11Upstream-Status: Submitted [Emailed to seebs]
12---
13 ports/linux/guts/statx.c | 48 ++++++++++++++++++++++++++++++++++++++++
14 ports/linux/portdefs.h | 1 +
15 ports/linux/wrapfuncs.in | 1 +
16 3 files changed, 50 insertions(+)
17 create mode 100644 ports/linux/guts/statx.c
18
19diff --git a/ports/linux/statx/guts/statx.c b/ports/linux/statx/guts/statx.c
20new file mode 100644
21index 0000000..a3259c4
22--- /dev/null
23+++ b/ports/linux/statx/guts/statx.c
24@@ -0,0 +1,42 @@
25+/*
26+ * Copyright (c) 2019 Linux Foundation
27+ * Author: Richard Purdie
28+ *
29+ * SPDX-License-Identifier: LGPL-2.1-only
30+ *
31+ * int
32+ * statx(int dirfd, const char *pathname, int flags, unsigned int mask, struct statx *statxbuf) {
33+ * int rc = -1;
34+ */
35+ pseudo_msg_t *msg;
36+ PSEUDO_STATBUF buf;
37+ int save_errno;
38+
39+ rc = real_statx(dirfd, pathname, flags, mask, statxbuf);
40+ save_errno = errno;
41+ if (rc == -1) {
42+ return rc;
43+ }
44+
45+ buf.st_uid = statxbuf->stx_uid;
46+ buf.st_gid = statxbuf->stx_gid;
47+ buf.st_dev = makedev(statxbuf->stx_dev_major, statxbuf->stx_dev_minor);
48+ buf.st_ino = statxbuf->stx_ino;
49+ buf.st_mode = statxbuf->stx_mode;
50+ buf.st_rdev = makedev(statxbuf->stx_rdev_major, statxbuf->stx_rdev_minor);
51+ buf.st_nlink = statxbuf->stx_nlink;
52+ msg = pseudo_client_op(OP_STAT, 0, -1, dirfd, pathname, &buf);
53+ if (msg && msg->result == RESULT_SUCCEED) {
54+ pseudo_debug(PDBGF_FILE, "statx(path %s), flags %o, stat rc %d, stat uid %o\n", pathname, flags, rc, statxbuf->stx_uid);
55+ statxbuf->stx_uid = msg->uid;
56+ statxbuf->stx_gid = msg->gid;
57+ statxbuf->stx_mode = msg->mode;
58+ statxbuf->stx_rdev_major = major(msg->rdev);
59+ statxbuf->stx_rdev_minor = minor(msg->rdev);
60+ } else {
61+ pseudo_debug(PDBGF_FILE, "statx(path %s) failed, flags %o, stat rc %d, stat uid %o\n", pathname, flags, rc, statxbuf->stx_uid);
62+ }
63+ errno = save_errno;
64+/* return rc;
65+ * }
66+ */
67diff --git a/ports/linux/statx/portdefs.h b/ports/linux/statx/portdefs.h
68new file mode 100644
69index 0000000..bf934dc
70--- /dev/null
71+++ b/ports/linux/statx/portdefs.h
72@@ -0,0 +1,6 @@
73+/*
74+ * SPDX-License-Identifier: LGPL-2.1-only
75+ *
76+ */
77+#include <sys/stat.h>
78+#include <sys/sysmacros.h>
79diff --git a/ports/linux/statx/wrapfuncs.in b/ports/linux/statx/wrapfuncs.in
80new file mode 100644
81index 0000000..c9cd4c3
82--- /dev/null
83+++ b/ports/linux/statx/wrapfuncs.in
84@@ -0,0 +1 @@
85+int statx(int dirfd, const char *pathname, int flags, unsigned int mask, struct statx *statxbuf);
86diff --git a/ports/linux/subports b/ports/linux/subports
87index a29044a..49081bf 100755
88--- a/ports/linux/subports
89+++ b/ports/linux/subports
90@@ -54,3 +54,13 @@ else
91 fi
92 rm -f dummy.c dummy.o
93
94+cat > dummy.c <<EOF
95+#define _GNU_SOURCE
96+#include <sys/stat.h>
97+struct statx x;
98+EOF
99+if ${CC} -c -o dummy.o dummy.c >/dev/null 2>&1; then
100+ echo "linux/statx"
101+fi
102+rm -f dummy.c dummy.o
103+
104--
1052.17.1
106
diff --git a/meta/recipes-devtools/pseudo/pseudo_git.bb b/meta/recipes-devtools/pseudo/pseudo_git.bb
index 78500e1cc6..1f2df4a427 100644
--- a/meta/recipes-devtools/pseudo/pseudo_git.bb
+++ b/meta/recipes-devtools/pseudo/pseudo_git.bb
@@ -7,6 +7,7 @@ SRC_URI = "git://git.yoctoproject.org/pseudo \
7 file://moreretries.patch \ 7 file://moreretries.patch \
8 file://toomanyfiles.patch \ 8 file://toomanyfiles.patch \
9 file://0001-maketables-wrappers-use-Python-3.patch \ 9 file://0001-maketables-wrappers-use-Python-3.patch \
10 file://0001-Add-statx.patch \
10 " 11 "
11 12
12SRCREV = "060058bb29f70b244e685b3c704eb0641b736f73" 13SRCREV = "060058bb29f70b244e685b3c704eb0641b736f73"