qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v8 81/87] linux-user: Add support for statx() sy


From: Timothy Baldwin
Subject: Re: [Qemu-devel] [PATCH v8 81/87] linux-user: Add support for statx() syscall for all platforms
Date: Mon, 20 Aug 2018 08:48:20 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

On 13/08/18 18:53, Aleksandar Markovic wrote:
From: Aleksandar Rikalo <address@hidden>

Implement support for translation of system call statx(). The
implementation includes invoking other (more mature) syscalls
(from the same 'stat' family) on the host side. This way,
problems of availability of statx() on the host side are
avoided.

Signed-off-by: Aleksandar Markovic <address@hidden>
Signed-off-by: Stefan Markovic <address@hidden>
---
  linux-user/syscall.c      | 121 +++++++++++++++++++++++++++++++++++++++++++++-
  linux-user/syscall_defs.h |  38 +++++++++++++++
  2 files changed, 158 insertions(+), 1 deletion(-)



+            if ((p == NULL) || (*((char *)p) == 0)) {
+                /* By file descriptor */
+                ret = get_errno(fstat(dirfd, &st));
+                unlock_user(p, arg2, 0);
+            } else if (*((char *)p) == '/') {
+                /* Absolute pathname */
+                ret = get_errno(stat(path(p), &st));
+                unlock_user(p, arg2, 0);
+            } else {
+                if (dirfd == AT_FDCWD) {
+                    /* Pathname relative to the current working directory */
+                    ret = get_errno(stat(path(p), &st));
+                    unlock_user(p, arg2, 0);
+                } else {
+                    /*
+                     * Pathname relative to the directory referred to by the
+                     * file descriptor dirfd
+                     */
+                    ret = get_errno(fstatat(dirfd, path(p), &st, flags));
+                    unlock_user(p, arg2, 0);
+                }
+            }

This doesn't correctly handle the flags argument, it is ignored unless a relative path and directory file descriptor is provided. As such an implementation of lstat that uses statx will be broken.

Since fstatat exists since 2.6.16 this can be reduced to a call to fstatat.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]