From: Thayne Harbaugh <thayne@c2.net>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH] linux-user fstatat syscall
Date: Wed, 19 Sep 2007 07:11:15 -0600 [thread overview]
Message-ID: <1190207475.9564.122.camel@phantasm.home.enterpriseandprosperity.com> (raw)
In-Reply-To: <1190207348.9564.119.camel@phantasm.home.enterpriseandprosperity.com>
[-- Attachment #1: Type: text/plain, Size: 102 bytes --]
This patch adds the fstatat syscall to linux-user. To depends on the
previous stat64_put_user patch.
[-- Attachment #2: 35_fstatat64.patch --]
[-- Type: text/x-patch, Size: 3648 bytes --]
Index: qemu/linux-user/syscall.c
===================================================================
--- qemu.orig/linux-user/syscall.c 2007-09-19 06:28:34.000000000 -0600
+++ qemu/linux-user/syscall.c 2007-09-19 06:31:35.000000000 -0600
@@ -149,11 +149,26 @@
return syscall(__NR_##name, arg1, arg2, arg3, arg4, arg5, arg6); \
}
+#if defined(__NR_fstatat64)
+#define HOST_NR_FSTATAT __NR_fstatat64
+typedef struct stat64 host_statbuf_t;
+#elif defined(__NR_newfstatat)
+#define HOST_NR_FSTATAT __NR_newfstatat
+typedef struct stat host_statbuf_t;
+#endif
+#if defined(TARGET_NR_fstatat64)
+#define TARGET_NR_FSTATAT (TARGET_NR_fstatat64)
+typedef struct target_stat64 target_statbuf_t;
+#elif defined(TARGET_NR_newfstatat)
+#define TARGET_NR_FSTATAT (TARGET_NR_newfstatat)
+typedef struct target_stat target_statbuf_t;
+#endif
#define __NR_sys_uname __NR_uname
#define __NR_sys_faccessat __NR_faccessat
#define __NR_sys_fchmodat __NR_fchmodat
#define __NR_sys_fchownat __NR_fchownat
+#define __NR_sys_fstatat HOST_NR_FSTATAT
#define __NR_sys_futimesat __NR_futimesat
#define __NR_sys_getcwd1 __NR_getcwd
#define __NR_sys_getdents __NR_getdents
@@ -170,6 +185,9 @@
#define __NR_sys_tgkill __NR_tgkill
#define __NR_sys_tkill __NR_tkill
#define __NR_sys_unlinkat __NR_unlinkat
+#if !defined(__NR_utimensat) && defined(__x86_64__)
+#define __NR_utimensat 280
+#endif
#define __NR_sys_utimensat __NR_utimensat
#if defined(__alpha__) || defined (__ia64__) || defined(__x86_64__)
@@ -199,6 +217,10 @@
_syscall3(int,sys_futimesat,int,dirfd,const char *,pathname,
const struct timeval *,times)
#endif
+#if defined(TARGET_NR_FSTATAT) && (HOST_NR_FSTATAT)
+_syscall4(int,sys_fstatat,int,dirfd,const char *,pathname,
+ host_statbuf_t *,buf,int,flags)
+#endif
_syscall2(int,sys_getcwd1,char *,buf,size_t,size)
_syscall3(int, sys_getdents, uint, fd, struct dirent *, dirp, uint, count);
#if defined(TARGET_NR_getdents64) && defined(__NR_getdents64)
@@ -533,7 +555,7 @@
: copy_to_user_statbuf64((tsb),(hsb)))
#else
#define copy_to_user_statbuf64_wrapper(tsb,hsb) \
- copy_to_user_eabi_statbuf64((tsb),(hsb))
+ copy_to_user_statbuf64((tsb),(hsb))
#endif
#ifdef TARGET_ARM
@@ -4731,6 +4753,28 @@
unlock_user(p, arg2, 0);
break;
#endif
+#if defined(TARGET_NR_FSTATAT) && defined(HOST_NR_FSTATAT)
+ case TARGET_NR_FSTATAT:
+ if (!arg2) {
+ ret = -EFAULT;
+ goto fail;
+ }
+ {
+ host_statbuf_t statbuf;
+ p = lock_user_string(arg2);
+ if (!access_ok(VERIFY_READ, p, 1))
+ ret = -EFAULT;
+ else {
+ ret = get_errno(sys_fstatat(arg1, path(p), &statbuf, arg4));
+ if (!is_error(ret)
+ && copy_to_user_statbuf64_wrapper((struct target_stat64 *)arg3, &statbuf))
+ ret = -EFAULT;
+ }
+ if (p)
+ unlock_user(p, arg2, 0);
+ }
+ break;
+#endif
#ifdef TARGET_NR_setresuid
case TARGET_NR_setresuid:
ret = get_errno(setresuid(low2highuid(arg1),
Index: qemu/linux-user/arm/syscall_nr.h
===================================================================
--- qemu.orig/linux-user/arm/syscall_nr.h 2007-09-19 06:28:08.000000000 -0600
+++ qemu/linux-user/arm/syscall_nr.h 2007-09-19 06:29:54.000000000 -0600
@@ -330,6 +330,7 @@
#define TARGET_NR_mknodat 324
#define TARGET_NR_fchownat 325
#define TARGET_NR_futimesat 326
+#define TARGET_NR_fstatat64 327
#define TARGET_NR_unlinkat 328
#define TARGET_NR_renameat 329
#define TARGET_NR_linkat 330
next prev parent reply other threads:[~2007-09-19 13:17 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-19 12:46 [Qemu-devel] [PATCH] linux-user *at() syscalls Thayne Harbaugh
2007-09-19 12:51 ` [Qemu-devel] Re: [PATCH] linux-user utimensat() syscall Thayne Harbaugh
2007-09-19 12:53 ` [Qemu-devel] Re: [PATCH] linux-user futimesat() syscall Thayne Harbaugh
2007-09-19 12:54 ` [Qemu-devel] Re: [PATCH] linux-user openat() syscall Thayne Harbaugh
2007-09-19 12:57 ` [Qemu-devel] Re: [PATCH] linux-user mkdirat() syscall Thayne Harbaugh
2007-09-19 12:58 ` [Qemu-devel] Re: [PATCH] linux-user mknodat() syscall Thayne Harbaugh
2007-09-19 12:59 ` [Qemu-devel] Re: [PATCH] linux-user fchownat() syscall Thayne Harbaugh
2007-09-19 13:00 ` [Qemu-devel] Re: [PATCH] linux-user unlinkat() syscall Thayne Harbaugh
2007-09-19 13:01 ` [Qemu-devel] Re: [PATCH] linux-user renameat() syscall Thayne Harbaugh
2007-09-19 13:02 ` [Qemu-devel] Re: [PATCH] linux-user linkat() syscall Thayne Harbaugh
2007-09-19 13:03 ` [Qemu-devel] Re: [PATCH] linux-user symlinkat() syscall Thayne Harbaugh
2007-09-19 13:04 ` [Qemu-devel] Re: [PATCH] linux-user readlinkat() syscall Thayne Harbaugh
2007-09-19 13:05 ` [Qemu-devel] Re: [PATCH] linux-user fchmodat() syscall Thayne Harbaugh
2007-09-19 13:06 ` [Qemu-devel] Re: [PATCH] linux-user faccessat() syscall Thayne Harbaugh
2007-09-19 13:09 ` [Qemu-devel] Re: [PATCH] linux-user stat64_put_user function Thayne Harbaugh
2007-09-19 13:11 ` Thayne Harbaugh [this message]
2007-10-02 20:50 ` [Qemu-devel] Re: [PATCH] linux-user futimesat() syscall Thayne Harbaugh
2007-09-23 15:42 ` [Qemu-devel] Re: [PATCH] linux-user utimensat() syscall Thiemo Seufer
2007-09-23 16:58 ` Stuart Anderson
2007-09-24 19:45 ` Thayne Harbaugh
2007-09-25 4:25 ` Thayne Harbaugh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1190207475.9564.122.camel@phantasm.home.enterpriseandprosperity.com \
--to=thayne@c2.net \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).