From patchwork Thu Jun 7 22:24:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 163690 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 37E5BB6FAB for ; Fri, 8 Jun 2012 09:15:36 +1000 (EST) Received: from localhost ([::1]:60215 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Scl9H-0003sj-5c for incoming@patchwork.ozlabs.org; Thu, 07 Jun 2012 18:25:47 -0400 Received: from eggs.gnu.org ([208.118.235.92]:54124) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Scl8H-0001JF-CX for qemu-devel@nongnu.org; Thu, 07 Jun 2012 18:24:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Scl8E-0006EM-Hp for qemu-devel@nongnu.org; Thu, 07 Jun 2012 18:24:44 -0400 Received: from mail-pz0-f45.google.com ([209.85.210.45]:50247) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Scl8E-0006DA-5M for qemu-devel@nongnu.org; Thu, 07 Jun 2012 18:24:42 -0400 Received: by mail-pz0-f45.google.com with SMTP id v2so1641761dad.4 for ; Thu, 07 Jun 2012 15:24:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=DfFOIH1Ormusmki3cUvBdXz9nXFjJvaJcN0U7FM8EAo=; b=ZNK9+Bb/acBnVah6KmgtjYQWtwUUinb20ALq+poZMYOYcR79KbtDrM2jHahBwmverr wFd4L2hsVkWomZIRMevq0mymB7Vyjbez6J+xQdfNDVVAc2pePTIwBjtL/8h4p2M2Bd5r HDlAa4YUILij0NonZAcWTLWXg698c3U8DE7vqr09VQYoN6TtdaPZAcNTMTpsdd8+Nc5H sUE3e9LFSPYRZOL9zySNxTUxAi4tPjts3jBzgLCab2hOla3zd0HGbBMccFIDvbmonhzH x/Z4C0ur1NADnSrOh6bHN5TVtk1vFIntXNHqWsmXfPeVHnhYWPCL1vMy4O/fKbF1FItq OEkQ== Received: by 10.68.236.131 with SMTP id uu3mr11606208pbc.96.1339107881156; Thu, 07 Jun 2012 15:24:41 -0700 (PDT) Received: from anchor.twiddle.home ([173.160.232.49]) by mx.google.com with ESMTPS id u5sm5454817pbu.76.2012.06.07.15.24.40 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 07 Jun 2012 15:24:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 7 Jun 2012 15:24:26 -0700 Message-Id: <1339107871-4487-5-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 1.7.7.6 In-Reply-To: <1339107871-4487-1-git-send-email-rth@twiddle.net> References: <1339107871-4487-1-git-send-email-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.210.45 Cc: Riku Voipio Subject: [Qemu-devel] [PATCH 4/9] linux-user: Handle O_SYNC, O_NOATIME, O_CLOEXEC, O_PATH X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org And tidy up syscall_defs.h a little bit. For each target, only define the bits in arch/target/include/asm/fcntl.h, leaving the others to a new asm-generic section below. Signed-off-by: Richard Henderson --- linux-user/strace.c | 12 +++- linux-user/syscall.c | 15 +++- linux-user/syscall_defs.h | 195 +++++++++++++++++++++----------------------- 3 files changed, 118 insertions(+), 104 deletions(-) diff --git a/linux-user/strace.c b/linux-user/strace.c index 05a0d3e..6ec90e8 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -371,11 +371,21 @@ UNUSED static struct flags open_flags[] = { FLAG_TARGET(O_NOCTTY), FLAG_TARGET(O_NOFOLLOW), FLAG_TARGET(O_NONBLOCK), /* also O_NDELAY */ - FLAG_TARGET(O_SYNC), + FLAG_TARGET(O_DSYNC), + FLAG_TARGET(__O_SYNC), FLAG_TARGET(O_TRUNC), #ifdef O_DIRECT FLAG_TARGET(O_DIRECT), #endif +#ifdef O_NOATIME + FLAG_TARGET(O_NOATIME), +#endif +#ifdef O_CLOEXEC + FLAG_TARGET(O_CLOEXEC), +#endif +#ifdef O_PATH + FLAG_TARGET(O_PATH), +#endif FLAG_END, }; diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 1cbbfbf..8a454cc 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -261,14 +261,27 @@ static bitmask_transtbl fcntl_flags_tbl[] = { { TARGET_O_TRUNC, TARGET_O_TRUNC, O_TRUNC, O_TRUNC, }, { TARGET_O_APPEND, TARGET_O_APPEND, O_APPEND, O_APPEND, }, { TARGET_O_NONBLOCK, TARGET_O_NONBLOCK, O_NONBLOCK, O_NONBLOCK, }, + { TARGET_O_SYNC, TARGET_O_DSYNC, O_SYNC, O_DSYNC, }, { TARGET_O_SYNC, TARGET_O_SYNC, O_SYNC, O_SYNC, }, { TARGET_FASYNC, TARGET_FASYNC, FASYNC, FASYNC, }, { TARGET_O_DIRECTORY, TARGET_O_DIRECTORY, O_DIRECTORY, O_DIRECTORY, }, { TARGET_O_NOFOLLOW, TARGET_O_NOFOLLOW, O_NOFOLLOW, O_NOFOLLOW, }, - { TARGET_O_LARGEFILE, TARGET_O_LARGEFILE, O_LARGEFILE, O_LARGEFILE, }, #if defined(O_DIRECT) { TARGET_O_DIRECT, TARGET_O_DIRECT, O_DIRECT, O_DIRECT, }, #endif +#if defined(O_NOATIME) + { TARGET_O_NOATIME, TARGET_O_NOATIME, O_NOATIME, O_NOATIME }, +#endif +#if defined(O_CLOEXEC) + { TARGET_O_CLOEXEC, TARGET_O_CLOEXEC, O_CLOEXEC, O_CLOEXEC }, +#endif +#if defined(O_PATH) + { TARGET_O_PATH, TARGET_O_PATH, O_PATH, O_PATH }, +#endif + /* Don't terminate the list prematurely on 64-bit host+guest. */ +#if TARGET_O_LARGEFILE != 0 || O_LARGEFILE != 0 + { TARGET_O_LARGEFILE, TARGET_O_LARGEFILE, O_LARGEFILE, O_LARGEFILE, }, +#endif { 0, 0, 0, 0 } }; diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 02fe4f6..974d6f5 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -2012,135 +2012,126 @@ struct target_statfs64 { #define TARGET_F_DUPFD_CLOEXEC (TARGET_F_LINUX_SPECIFIC_BASE + 6) #define TARGET_F_NOTIFY (TARGET_F_LINUX_SPECIFIC_BASE+2) -#if defined (TARGET_ARM) -#define TARGET_O_ACCMODE 0003 -#define TARGET_O_RDONLY 00 -#define TARGET_O_WRONLY 01 -#define TARGET_O_RDWR 02 -#define TARGET_O_CREAT 0100 /* not fcntl */ -#define TARGET_O_EXCL 0200 /* not fcntl */ -#define TARGET_O_NOCTTY 0400 /* not fcntl */ -#define TARGET_O_TRUNC 01000 /* not fcntl */ -#define TARGET_O_APPEND 02000 -#define TARGET_O_NONBLOCK 04000 -#define TARGET_O_NDELAY TARGET_O_NONBLOCK -#define TARGET_O_SYNC 010000 -#define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */ +#if defined(TARGET_ALPHA) +#define TARGET_O_NONBLOCK 04 +#define TARGET_O_APPEND 010 +#define TARGET_O_CREAT 01000 /* not fcntl */ +#define TARGET_O_TRUNC 02000 /* not fcntl */ +#define TARGET_O_EXCL 04000 /* not fcntl */ +#define TARGET_O_NOCTTY 010000 /* not fcntl */ +#define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */ +#define TARGET_O_DSYNC 040000 +#define TARGET_O_LARGEFILE 0 /* not necessary, always 64-bit */ +#define TARGET_O_DIRECTORY 0100000 /* must be a directory */ +#define TARGET_O_NOFOLLOW 0200000 /* don't follow links */ +#define TARGET_O_DIRECT 02000000 /* direct disk access hint */ +#define TARGET_O_NOATIME 04000000 +#define TARGET_O_CLOEXEC 010000000 +#define TARGET___O_SYNC 020000000 +#define TARGET_O_PATH 040000000 +#elif defined (TARGET_ARM) #define TARGET_O_DIRECTORY 040000 /* must be a directory */ #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */ #define TARGET_O_DIRECT 0200000 /* direct disk access hint */ #define TARGET_O_LARGEFILE 0400000 +#elif defined(TARGET_MIPS) +#define TARGET_O_APPEND 0x0008 +#define TARGET_O_DSYNC 0x0010 +#define TARGET_O_NONBLOCK 0x0080 +#define TARGET_O_CREAT 0x0100 /* not fcntl */ +#define TARGET_O_TRUNC 0x0200 /* not fcntl */ +#define TARGET_O_EXCL 0x0400 /* not fcntl */ +#define TARGET_O_NOCTTY 0x0800 /* not fcntl */ +#define TARGET_FASYNC 0x1000 /* fcntl, for BSD compatibility */ +#define TARGET_O_LARGEFILE 0x2000 /* allow large file opens */ +#define TARGET___O_SYNC 0x4000 +#define TARGET_O_DIRECT 0x8000 /* direct disk access hint */ #elif defined (TARGET_PPC) -#define TARGET_O_ACCMODE 0003 -#define TARGET_O_RDONLY 00 -#define TARGET_O_WRONLY 01 -#define TARGET_O_RDWR 02 -#define TARGET_O_CREAT 0100 /* not fcntl */ -#define TARGET_O_EXCL 0200 /* not fcntl */ -#define TARGET_O_NOCTTY 0400 /* not fcntl */ -#define TARGET_O_TRUNC 01000 /* not fcntl */ -#define TARGET_O_APPEND 02000 -#define TARGET_O_NONBLOCK 04000 -#define TARGET_O_NDELAY TARGET_O_NONBLOCK -#define TARGET_O_SYNC 010000 -#define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */ -#define TARGET_O_DIRECTORY 040000 /* must be a directory */ -#define TARGET_O_NOFOLLOW 0100000 /* don't follow links */ -#define TARGET_O_LARGEFILE 0200000 -#define TARGET_O_DIRECT 0400000 /* direct disk access hint */ -#elif defined (TARGET_MICROBLAZE) -#define TARGET_O_ACCMODE 0003 -#define TARGET_O_RDONLY 00 -#define TARGET_O_WRONLY 01 -#define TARGET_O_RDWR 02 -#define TARGET_O_CREAT 0100 /* not fcntl */ -#define TARGET_O_EXCL 0200 /* not fcntl */ -#define TARGET_O_NOCTTY 0400 /* not fcntl */ -#define TARGET_O_TRUNC 01000 /* not fcntl */ -#define TARGET_O_APPEND 02000 -#define TARGET_O_NONBLOCK 04000 -#define TARGET_O_NDELAY TARGET_O_NONBLOCK -#define TARGET_O_SYNC 010000 -#define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */ #define TARGET_O_DIRECTORY 040000 /* must be a directory */ #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */ #define TARGET_O_LARGEFILE 0200000 #define TARGET_O_DIRECT 0400000 /* direct disk access hint */ #elif defined (TARGET_SPARC) -#define TARGET_O_RDONLY 0x0000 -#define TARGET_O_WRONLY 0x0001 -#define TARGET_O_RDWR 0x0002 -#define TARGET_O_ACCMODE 0x0003 -#define TARGET_O_APPEND 0x0008 -#define TARGET_FASYNC 0x0040 /* fcntl, for BSD compatibility */ -#define TARGET_O_CREAT 0x0200 /* not fcntl */ -#define TARGET_O_TRUNC 0x0400 /* not fcntl */ -#define TARGET_O_EXCL 0x0800 /* not fcntl */ -#define TARGET_O_SYNC 0x2000 -#define TARGET_O_NONBLOCK 0x4000 -#define TARGET_O_NDELAY (0x0004 | TARGET_O_NONBLOCK) -#define TARGET_O_NOCTTY 0x8000 /* not fcntl */ -#define TARGET_O_DIRECTORY 0x10000 /* must be a directory */ -#define TARGET_O_NOFOLLOW 0x20000 /* don't follow links */ +#define TARGET_O_APPEND 0x0008 +#define TARGET_FASYNC 0x0040 /* fcntl, for BSD compatibility */ +#define TARGET_O_CREAT 0x0200 /* not fcntl */ +#define TARGET_O_TRUNC 0x0400 /* not fcntl */ +#define TARGET_O_EXCL 0x0800 /* not fcntl */ +#define TARGET_O_DSYNC 0x2000 +#define TARGET_O_NONBLOCK 0x4000 +# ifdef TARGET_SPARC64 +# define TARGET_O_NDELAY 0x0004 +# else +# define TARGET_O_NDELAY (0x0004 | TARGET_O_NONBLOCK) +# endif +#define TARGET_O_NOCTTY 0x8000 /* not fcntl */ #define TARGET_O_LARGEFILE 0x40000 -#define TARGET_O_DIRECT 0x100000 /* direct disk access hint */ -#elif defined(TARGET_MIPS) -#define TARGET_O_ACCMODE 0x0003 -#define TARGET_O_RDONLY 0x0000 -#define TARGET_O_WRONLY 0x0001 -#define TARGET_O_RDWR 0x0002 -#define TARGET_O_APPEND 0x0008 -#define TARGET_O_SYNC 0x0010 -#define TARGET_O_NONBLOCK 0x0080 -#define TARGET_O_CREAT 0x0100 /* not fcntl */ -#define TARGET_O_TRUNC 0x0200 /* not fcntl */ -#define TARGET_O_EXCL 0x0400 /* not fcntl */ -#define TARGET_O_NOCTTY 0x0800 /* not fcntl */ -#define TARGET_FASYNC 0x1000 /* fcntl, for BSD compatibility */ -#define TARGET_O_LARGEFILE 0x2000 /* allow large file opens */ -#define TARGET_O_DIRECT 0x8000 /* direct disk access hint */ -#define TARGET_O_DIRECTORY 0x10000 /* must be a directory */ -#define TARGET_O_NOFOLLOW 0x20000 /* don't follow links */ -#define TARGET_O_NOATIME 0x40000 -#define TARGET_O_NDELAY TARGET_O_NONBLOCK -#elif defined(TARGET_ALPHA) -#define TARGET_O_ACCMODE 0x0003 -#define TARGET_O_RDONLY 0x0000 -#define TARGET_O_WRONLY 0x0001 -#define TARGET_O_RDWR 0x0002 -#define TARGET_O_APPEND 0x0008 -#define TARGET_O_SYNC 0x4000 -#define TARGET_O_NONBLOCK 0x0004 -#define TARGET_O_CREAT 0x0200 /* not fcntl */ -#define TARGET_O_TRUNC 0x0400 /* not fcntl */ -#define TARGET_O_EXCL 0x0800 /* not fcntl */ -#define TARGET_O_NOCTTY 0x1000 /* not fcntl */ -#define TARGET_FASYNC 0x2000 /* fcntl, for BSD compatibility */ -#define TARGET_O_LARGEFILE 0x0000 /* not necessary, always 64-bit */ -#define TARGET_O_DIRECT 0x80000 /* direct disk access hint */ -#define TARGET_O_DIRECTORY 0x8000 /* must be a directory */ -#define TARGET_O_NOFOLLOW 0x10000 /* don't follow links */ -#define TARGET_O_NOATIME 0x100000 -#define TARGET_O_NDELAY TARGET_O_NONBLOCK -#else +#define TARGET_O_DIRECT 0x100000 /* direct disk access hint */ +#define TARGET_O_NOATIME 0x200000 +#define TARGET_O_CLOEXEC 0x400000 +#define TARGET___O_SYNC 0x800000 +#define TARGET_O_PATH 0x1000000 +#endif + +/* values follow. */ #define TARGET_O_ACCMODE 0003 #define TARGET_O_RDONLY 00 #define TARGET_O_WRONLY 01 #define TARGET_O_RDWR 02 +#ifndef TARGET_O_CREAT #define TARGET_O_CREAT 0100 /* not fcntl */ +#endif +#ifndef TARGET_O_EXCL #define TARGET_O_EXCL 0200 /* not fcntl */ +#endif +#ifndef TARGET_O_NOCTTY #define TARGET_O_NOCTTY 0400 /* not fcntl */ +#endif +#ifndef TARGET_O_TRUNC #define TARGET_O_TRUNC 01000 /* not fcntl */ +#endif +#ifndef TARGET_O_APPEND #define TARGET_O_APPEND 02000 +#endif +#ifndef TARGET_O_NONBLOCK #define TARGET_O_NONBLOCK 04000 -#define TARGET_O_NDELAY TARGET_O_NONBLOCK -#define TARGET_O_SYNC 010000 +#endif +#ifndef TARGET_O_DSYNC +#define TARGET_O_DSYNC 010000 +#endif +#ifndef TARGET_FASYNC #define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */ +#endif +#ifndef TARGET_O_DIRECT #define TARGET_O_DIRECT 040000 /* direct disk access hint */ +#endif +#ifndef TARGET_O_LARGEFILE #define TARGET_O_LARGEFILE 0100000 +#endif +#ifndef TARGET_O_DIRECTORY #define TARGET_O_DIRECTORY 0200000 /* must be a directory */ +#endif +#ifndef TARGET_O_NOFOLLOW #define TARGET_O_NOFOLLOW 0400000 /* don't follow links */ #endif +#ifndef TARGET_O_NOATIME +#define TARGET_O_NOATIME 01000000 +#endif +#ifndef TARGET_O_CLOEXEC +#define TARGET_O_CLOEXEC 02000000 +#endif +#ifndef TARGET___O_SYNC +#define TARGET___O_SYNC 04000000 +#endif +#ifndef TARGET_O_PATH +#define TARGET_O_PATH 010000000 +#endif +#ifndef TARGET_O_NDELAY +#define TARGET_O_NDELAY TARGET_O_NONBLOCK +#endif +#ifndef TARGET_O_SYNC +#define TARGET_O_SYNC (TARGET___O_SYNC | TARGET_O_DSYNC) +#endif struct target_flock { short l_type;