1/* 2 * Copyright (c) 2011 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software 9 * licensed hereunder. You may use the software subject to the license 10 * terms below provided that you ensure that this notice is replicated 11 * unmodified and in its entirety in all distributions of the software, 12 * modified or unmodified, in source code or in binary form. 13 * 14 * Copyright (c) 2003-2005, 2006 The Regents of The University of Michigan 15 * Copyright (c) 2007-2008 The Florida State University 16 * Copyright (c) 2009 The University of Edinburgh 17 * All rights reserved. 18 * 19 * Redistribution and use in source and binary forms, with or without 20 * modification, are permitted provided that the following conditions are 21 * met: redistributions of source code must retain the above copyright 22 * notice, this list of conditions and the following disclaimer; 23 * redistributions in binary form must reproduce the above copyright 24 * notice, this list of conditions and the following disclaimer in the 25 * documentation and/or other materials provided with the distribution; 26 * neither the name of the copyright holders nor the names of its 27 * contributors may be used to endorse or promote products derived from 28 * this software without specific prior written permission. 29 * 30 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 31 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 32 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 33 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 34 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 35 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 36 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 37 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 38 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 39 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 40 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 41 * 42 * Authors: Korey Sewell 43 */ 44 45/* 46 * @file flag_tables.hh 47 * 48 * This file contains definitions of flag translation tables for the 49 * open() system call. Since the tables are nearly identical 50 * across target platforms (other than the values of the target flags), 51 * we use a single copy of the tables but include it separately for 52 * each target platform. The TARGET macro must be #defined before including 53 * to indicate the class for which the table is being defined. 54 * 55 * See src/arch/<*>/linux/linux.cc. 56 */ 57 58// open(2) flags translation table 59SyscallFlagTransTable TARGET::openFlagTable[] = { 60#ifdef _MSC_VER 61 { TARGET::TGT_O_RDONLY, _O_RDONLY }, 62 { TARGET::TGT_O_WRONLY, _O_WRONLY }, 63 { TARGET::TGT_O_RDWR, _O_RDWR }, 64 { TARGET::TGT_O_CREAT, _O_CREAT }, 65 { TARGET::TGT_O_EXCL, _O_EXCL }, 66 { TARGET::TGT_O_TRUNC, _O_TRUNC }, 67 { TARGET::TGT_O_APPEND, _O_APPEND }, 68#else /* !_MSC_VER */ 69 { TARGET::TGT_O_RDONLY, O_RDONLY }, 70 { TARGET::TGT_O_WRONLY, O_WRONLY }, 71 { TARGET::TGT_O_RDWR, O_RDWR }, 72 { TARGET::TGT_O_CREAT, O_CREAT }, 73 { TARGET::TGT_O_EXCL, O_EXCL }, 74 { TARGET::TGT_O_TRUNC, O_TRUNC }, 75 { TARGET::TGT_O_APPEND, O_APPEND }, 76 { TARGET::TGT_O_NOCTTY, O_NOCTTY }, 77 { TARGET::TGT_O_NONBLOCK, O_NONBLOCK }, 78#ifdef O_DSYNC 79 { TARGET::TGT_O_DSYNC, O_DSYNC }, 80#endif 81#ifdef O_ASYNC 82 { TARGET::TGT_FASYNC, O_ASYNC }, 83#endif 84#ifdef O_DIRECT 85 { TARGET::TGT_O_DIRECT, O_DIRECT }, 86#endif 87#ifdef O_LARGEFILE 88 { TARGET::TGT_O_LARGEFILE, O_LARGEFILE }, 89#endif 90#ifdef O_DIRECTORY 91 { TARGET::TGT_O_DIRECTORY, O_DIRECTORY }, 92#endif 93#ifdef O_NOFOLLOW 94 { TARGET::TGT_O_NOFOLLOW, O_NOFOLLOW }, 95#endif 96#ifdef O_NOATIME 97 { TARGET::TGT_O_NOATIME, O_NOATIME }, 98#endif 99#ifdef O_CLOEXEC 100 { TARGET::TGT_O_CLOEXEC, O_CLOEXEC }, 101#endif 102#ifdef O_SYNC 103 { TARGET::TGT_O_SYNC, O_SYNC }, 104#endif 105#ifdef O_PATH 106 { TARGET::TGT_O_PATH, O_PATH }, 107#endif 108#endif /* _MSC_VER */ 109}; 110 111const int TARGET::NUM_OPEN_FLAGS = 112 sizeof(TARGET::openFlagTable) / sizeof(TARGET::openFlagTable[0]); 113