[oe-commits] [openembedded-core] 01/05: pseudo: Add statx support to fix fedora30 issues
git at git.openembedded.org
git at git.openembedded.org
Wed Nov 6 14:13:53 UTC 2019
This is an automated email from the git hooks/post-receive script.
rpurdie pushed a commit to branch master-next
in repository openembedded-core.
commit a4a327669106a0b6b249e5b4ada3ef58f189768c
Author: Richard Purdie <richard.purdie at linuxfoundation.org>
AuthorDate: Wed Nov 6 13:20:01 2019 +0000
pseudo: Add statx support to fix fedora30 issues
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
.../pseudo/files/0001-Add-statx.patch | 127 +++++++++++++++++++++
meta/recipes-devtools/pseudo/pseudo_git.bb | 1 +
2 files changed, 128 insertions(+)
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 0000000..3386198
--- /dev/null
+++ b/meta/recipes-devtools/pseudo/files/0001-Add-statx.patch
@@ -0,0 +1,127 @@
+From 4e41a05de1f34ba00a68ca4f20fb49c4d1cbd2d0 Mon Sep 17 00:00:00 2001
+From: Richard Purdie <richard.purdie at linuxfoundation.org>
+Date: Wed, 6 Nov 2019 12:17:46 +0000
+Subject: [PATCH] Add statx
+
+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.
+
+Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
+Upstream-Status: Pending
+---
+ ports/linux/guts/statx.c | 48 ++++++++++++++++++++++++++++++++++++++++
+ ports/linux/portdefs.h | 1 +
+ ports/linux/wrapfuncs.in | 1 +
+ 3 files changed, 50 insertions(+)
+ create mode 100644 ports/linux/guts/statx.c
+
+Index: git/ports/linux/guts/statx.c
+===================================================================
+--- /dev/null
++++ git/ports/linux/guts/statx.c
+@@ -0,0 +1,43 @@
++/*
++ * Copyright (c) 2019 Linux Foundation
++ * Author: Richard Purdie
++ *
++ * SPDX-License-Identifier: LGPL-2.1-only
++ *
++ * int
++ * statx(int dirfd, const char *pathname, int flags, unsigned int mask, struct statx *statxbuf) {
++ * wrap___fxstat64(int ver, int fd, struct stat64 *buf) {
++ * int rc = -1;
++ */
++ pseudo_msg_t *msg;
++ PSEUDO_STATBUF buf;
++ int save_errno;
++
++ rc = real_statx(dirfd, pathname, flags, mask, statxbuf);
++ save_errno = errno;
++ if (rc == -1) {
++ return rc;
++ }
++
++ buf.st_uid = statxbuf->stx_uid;
++ buf.st_gid = statxbuf->stx_gid;
++ buf.st_dev = makedev(statxbuf->stx_dev_major, statxbuf->stx_dev_minor);
++ buf.st_ino = statxbuf->stx_ino;
++ buf.st_mode = statxbuf->stx_mode;
++ buf.st_rdev = makedev(statxbuf->stx_rdev_major, statxbuf->stx_rdev_minor);
++ buf.st_nlink = statxbuf->stx_nlink;
++ msg = pseudo_client_op(OP_STAT, 0, -1, dirfd, pathname, &buf);
++ if (msg && msg->result == RESULT_SUCCEED) {
++ pseudo_debug(PDBGF_FILE, "statx(path %s), flags %o, stat rc %d, stat uid %o\n", pathname, flags, rc, statxbuf->stx_uid);
++ statxbuf->stx_uid = msg->uid;
++ statxbuf->stx_gid = msg->gid;
++ statxbuf->stx_mode = msg->mode;
++ statxbuf->stx_rdev_major = major(msg->rdev);
++ statxbuf->stx_rdev_minor = minor(msg->rdev);
++ } else {
++ pseudo_debug(PDBGF_FILE, "statx(path %s) failed, flags %o, stat rc %d, stat uid %o\n", pathname, flags, rc, statxbuf->stx_uid);
++ }
++ errno = save_errno;
++/* return rc;
++ * }
++ */
+Index: git/ports/linux/portdefs.h
+===================================================================
+--- git.orig/ports/linux/portdefs.h
++++ git/ports/linux/portdefs.h
+@@ -32,3 +32,44 @@ GLIBC_COMPAT_SYMBOL(memcpy,2.0);
+
+ #include <linux/capability.h>
+ #include <sys/syscall.h>
++#include <sys/sysmacros.h>
++
++#ifndef statx
++struct statx_timestamp {
++ __s64 tv_sec; /* Seconds since the Epoch (UNIX time) */
++ __u32 tv_nsec; /* Nanoseconds since tv_sec */
++};
++
++struct statx {
++ __u32 stx_mask; /* Mask of bits indicating
++ filled fields */
++ __u32 stx_blksize; /* Block size for filesystem I/O */
++ __u64 stx_attributes; /* Extra file attribute indicators */
++ __u32 stx_nlink; /* Number of hard links */
++ __u32 stx_uid; /* User ID of owner */
++ __u32 stx_gid; /* Group ID of owner */
++ __u16 stx_mode; /* File type and mode */
++ __u64 stx_ino; /* Inode number */
++ __u64 stx_size; /* Total size in bytes */
++ __u64 stx_blocks; /* Number of 512B blocks allocated */
++ __u64 stx_attributes_mask;
++ /* Mask to show what's supported
++ in stx_attributes */
++
++ /* The following fields are file timestamps */
++ struct statx_timestamp stx_atime; /* Last access */
++ struct statx_timestamp stx_btime; /* Creation */
++ struct statx_timestamp stx_ctime; /* Last status change */
++ struct statx_timestamp stx_mtime; /* Last modification */
++
++ /* If this file represents a device, then the next two
++ fields contain the ID of the device */
++ __u32 stx_rdev_major; /* Major ID */
++ __u32 stx_rdev_minor; /* Minor ID */
++
++ /* The next two fields contain the ID of the device
++ containing the filesystem where the file resides */
++ __u32 stx_dev_major; /* Major ID */
++ __u32 stx_dev_minor; /* Minor ID */
++};
++#endif
+Index: git/ports/linux/wrapfuncs.in
+===================================================================
+--- git.orig/ports/linux/wrapfuncs.in
++++ git/ports/linux/wrapfuncs.in
+@@ -5,6 +5,7 @@ int __lxstat(int ver, const char *path,
+ int __fxstat(int ver, int fd, struct stat *buf);
+ int lchown(const char *path, uid_t owner, gid_t group); /* flags=AT_SYMLINK_NOFOLLOW */
+ int __fxstatat(int ver, int dirfd, const char *path, struct stat *buf, int flags);
++int statx(int dirfd, const char *pathname, int flags, unsigned int mask, struct statx *statxbuf);
+ int openat(int dirfd, const char *path, int flags, ...{mode_t mode}); /* flags=flags&O_NOFOLLOW */
+ int __openat_2(int dirfd, const char *path, int flags); /* flags=flags&O_NOFOLLOW */
+ int mknod(const char *path, mode_t mode, dev_t dev); /* real_func=pseudo_mknod */
diff --git a/meta/recipes-devtools/pseudo/pseudo_git.bb b/meta/recipes-devtools/pseudo/pseudo_git.bb
index 78500e1..1f2df4a 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 \
file://moreretries.patch \
file://toomanyfiles.patch \
file://0001-maketables-wrappers-use-Python-3.patch \
+ file://0001-Add-statx.patch \
"
SRCREV = "060058bb29f70b244e685b3c704eb0641b736f73"
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list