linux.cc revision 7441
1/* 2 * Copyright (c) 2003-2005 The Regents of The University of Michigan 3 * Copyright (c) 2007-2008 The Florida State University 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions are 8 * met: redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer; 10 * redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution; 13 * neither the name of the copyright holders nor the names of its 14 * contributors may be used to endorse or promote products derived from 15 * this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * 29 * Authors: Stephen Hines 30 */ 31 32#include "arch/arm/linux/linux.hh" 33 34#include <fcntl.h> 35 36// open(2) flags translation table 37OpenFlagTransTable ArmLinux::openFlagTable[] = { 38#ifdef _MSC_VER 39 { ArmLinux::TGT_O_RDONLY, _O_RDONLY }, 40 { ArmLinux::TGT_O_WRONLY, _O_WRONLY }, 41 { ArmLinux::TGT_O_RDWR, _O_RDWR }, 42 { ArmLinux::TGT_O_APPEND, _O_APPEND }, 43 { ArmLinux::TGT_O_CREAT, _O_CREAT }, 44 { ArmLinux::TGT_O_TRUNC, _O_TRUNC }, 45 { ArmLinux::TGT_O_EXCL, _O_EXCL }, 46#ifdef _O_NONBLOCK 47 { ArmLinux::TGT_O_NONBLOCK, _O_NONBLOCK }, 48#endif 49#ifdef _O_NOCTTY 50 { ArmLinux::TGT_O_NOCTTY, _O_NOCTTY }, 51#endif 52#ifdef _O_SYNC 53 { ArmLinux::TGT_O_SYNC, _O_SYNC }, 54#endif 55#else /* !_MSC_VER */ 56 { ArmLinux::TGT_O_RDONLY, O_RDONLY }, 57 { ArmLinux::TGT_O_WRONLY, O_WRONLY }, 58 { ArmLinux::TGT_O_RDWR, O_RDWR }, 59 { ArmLinux::TGT_O_CREAT, O_CREAT }, 60 { ArmLinux::TGT_O_EXCL, O_EXCL }, 61 { ArmLinux::TGT_O_NOCTTY, O_NOCTTY }, 62 { ArmLinux::TGT_O_TRUNC, O_TRUNC }, 63 { ArmLinux::TGT_O_APPEND, O_APPEND }, 64 { ArmLinux::TGT_O_NONBLOCK, O_NONBLOCK }, 65#ifdef O_SYNC 66 { ArmLinux::TGT_O_SYNC, O_SYNC }, 67#endif 68#ifdef FASYNC 69 { ArmLinux::TGT_FASYNC, FASYNC }, 70#endif 71#ifdef O_DIRECT 72 { ArmLinux::TGT_O_DIRECT, O_DIRECT }, 73#endif 74#ifdef O_LARGEFILE 75 { ArmLinux::TGT_O_LARGEFILE, O_LARGEFILE }, 76#endif 77#ifdef O_DIRECTORY 78 { ArmLinux::TGT_O_DIRECTORY, O_DIRECTORY }, 79#endif 80#ifdef O_NOFOLLOW 81 { ArmLinux::TGT_O_NOFOLLOW, O_NOFOLLOW }, 82#endif 83#endif /* _MSC_VER */ 84}; 85 86const int ArmLinux::NUM_OPEN_FLAGS = 87 (sizeof(ArmLinux::openFlagTable)/sizeof(ArmLinux::openFlagTable[0])); 88 89