From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LvSld-0005S7-0i for qemu-devel@nongnu.org; Sun, 19 Apr 2009 04:52:49 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LvSlc-0005RL-5n for qemu-devel@nongnu.org; Sun, 19 Apr 2009 04:52:48 -0400 Received: from [199.232.76.173] (port=39305 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LvSlb-0005RC-Pi for qemu-devel@nongnu.org; Sun, 19 Apr 2009 04:52:48 -0400 Received: from hall.aurel32.net ([88.191.82.174]:54238) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LvSlb-0004Aa-5r for qemu-devel@nongnu.org; Sun, 19 Apr 2009 04:52:47 -0400 Date: Sun, 19 Apr 2009 10:52:44 +0200 From: Aurelien Jarno Message-ID: <20090419085244.GA5483@volta.aurel32.net> References: <200904181747.n3IHliKN017340@smtp09.dti.ne.jp> <20090418180240.GC16360@hall.aurel32.net> <200904190739.n3J7d2kT023688@smtp09.dti.ne.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <200904190739.n3J7d2kT023688@smtp09.dti.ne.jp> Subject: [Qemu-devel] Re: [PATCH] linux-user: Linux kernel's fchmodat and faccessat have three args (no 4th arg) Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: takasi-y@ops.dti.ne.jp Cc: qemu-devel@nongnu.org On Sun, Apr 19, 2009 at 04:39:02PM +0900, takasi-y@ops.dti.ne.jp wrote: > In Linux kernel, fchmodat() and faccessat() take tree args. > 4th value is only processed by libc. > > Signed-off-by: Takashi YOSHII > --- Thanks, applied. > > Good catch. It seems that it's also the case for faccessat. Could you > > please follow-up with a patch fixing both? Thanks. > Oh, that's right. I have added it. > > I use 0 for the flag value to host libc's faccessat(), > This is because faccessat() in libc attempt to call kernel faccessat() only if > ((flag == 0 || ((flag & ~AT_EACCESS) == 0 && ! __libc_enable_secure)) > , otherwise access() or fstat64 is used. > # Only be checked with sysdeps/unix/sysv/linux/faccessat.c in eglibc-2.8. > > Three cases below have been tested (flag!=0 case is out of scope) > faccessat(AT_FDCWD, "testfile", F_OK|W_OK, 0) > - ENOENT without testfile > - EACCESS with testfile 0400 > - ok with testfile 0600 > on x86_64 host(Debian 5.0.1) + sh4a target(GentooLinux glibc2.8). > > /yoshii > --- > linux-user/syscall.c | 17 ++++++++--------- > 1 files changed, 8 insertions(+), 9 deletions(-) > > diff --git a/linux-user/syscall.c b/linux-user/syscall.c > index ffdbb98..0bc9902 100644 > --- a/linux-user/syscall.c > +++ b/linux-user/syscall.c > @@ -303,15 +303,15 @@ static int sys_getcwd1(char *buf, size_t size) > */ > > #ifdef TARGET_NR_faccessat > -static int sys_faccessat(int dirfd, const char *pathname, int mode, int flags) > +static int sys_faccessat(int dirfd, const char *pathname, int mode) > { > - return (faccessat(dirfd, pathname, mode, flags)); > + return (faccessat(dirfd, pathname, mode, 0)); > } > #endif > #ifdef TARGET_NR_fchmodat > -static int sys_fchmodat(int dirfd, const char *pathname, mode_t mode, int flags) > +static int sys_fchmodat(int dirfd, const char *pathname, mode_t mode) > { > - return (fchmodat(dirfd, pathname, mode, flags)); > + return (fchmodat(dirfd, pathname, mode, 0)); > } > #endif > #if defined(TARGET_NR_fchownat) && defined(USE_UID16) > @@ -425,11 +425,10 @@ static int sys_utimensat(int dirfd, const char *pathname, > * Try direct syscalls instead > */ > #if defined(TARGET_NR_faccessat) && defined(__NR_faccessat) > -_syscall4(int,sys_faccessat,int,dirfd,const char *,pathname,int,mode,int,flags) > +_syscall3(int,sys_faccessat,int,dirfd,const char *,pathname,int,mode) > #endif > #if defined(TARGET_NR_fchmodat) && defined(__NR_fchmodat) > -_syscall4(int,sys_fchmodat,int,dirfd,const char *,pathname, > - mode_t,mode,int,flags) > +_syscall3(int,sys_fchmodat,int,dirfd,const char *,pathname, mode_t,mode) > #endif > #if defined(TARGET_NR_fchownat) && defined(__NR_fchownat) && defined(USE_UID16) > _syscall5(int,sys_fchownat,int,dirfd,const char *,pathname, > @@ -4218,7 +4217,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, > case TARGET_NR_faccessat: > if (!(p = lock_user_string(arg2))) > goto efault; > - ret = get_errno(sys_faccessat(arg1, p, arg3, arg4)); > + ret = get_errno(sys_faccessat(arg1, p, arg3)); > unlock_user(p, arg2, 0); > break; > #endif > @@ -4944,7 +4943,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, > case TARGET_NR_fchmodat: > if (!(p = lock_user_string(arg2))) > goto efault; > - ret = get_errno(sys_fchmodat(arg1, p, arg3, arg4)); > + ret = get_errno(sys_fchmodat(arg1, p, arg3)); > unlock_user(p, arg2, 0); > break; > #endif > -- > 1.5.6.5 > > -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurelien@aurel32.net http://www.aurel32.net