linux.cc revision 11382:654272b82e94
1/*
2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
3 * Copyright (c) 2009 The University of Edinburgh
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: Timothy M. Jones
30 */
31
32#include <fcntl.h>
33
34#include "arch/power/linux/linux.hh"
35
36// open(2) flags translation table
37SyscallFlagTransTable PowerLinux::openFlagTable[] = {
38#ifdef _MSC_VER
39  { PowerLinux::TGT_O_RDONLY,    _O_RDONLY },
40  { PowerLinux::TGT_O_WRONLY,    _O_WRONLY },
41  { PowerLinux::TGT_O_RDWR,      _O_RDWR },
42  { PowerLinux::TGT_O_CREAT,     _O_CREAT },
43  { PowerLinux::TGT_O_EXCL,      _O_EXCL },
44#ifdef _O_NOCTTY
45  { PowerLinux::TGT_O_NOCTTY,    _O_NOCTTY },
46#endif
47  { PowerLinux::TGT_O_TRUNC,     _O_TRUNC },
48  { PowerLinux::TGT_O_APPEND,    _O_APPEND },
49#ifdef _O_NONBLOCK
50  { PowerLinux::TGT_O_NONBLOCK,  _O_NONBLOCK },
51#endif
52#ifdef _O_DSYNC
53  { PowerLinux::TGT_O_DSYNC,     _O_DSYNC },
54#endif
55  { PowerLinux::TGT_FASYNC,      _O_ASYNC },
56  { PowerLinux::TGT_O_DIRECT,    _O_DIRECT },
57#ifdef _O_LARGEFILE
58  { PowerLinux::TGT_O_LARGEFILE, _O_LARGEFILE },
59#endif
60  { PowerLinux::TGT_O_DIRECTORY, _O_DIRECTORY },
61  { PowerLinux::TGT_O_NOFOLLOW,  _O_NOFOLLOW },
62  { PowerLinux::TGT_O_NOATIME,   _O_NOATIME },
63#ifdef _O_CLOEXEC
64  { PowerLinux::TGT_O_CLOEXEC,   _O_CLOEXEC },
65#endif
66#ifdef _O_SYNC
67  { PowerLinux::TGT_O_SYNC,      _O_SYNC },
68#endif
69#ifdef _O_PATH
70  { PowerLinux::TGT_O_PATH,      _O_PATH},
71#endif
72#else /* !_MSC_VER */
73  { PowerLinux::TGT_O_RDONLY,    O_RDONLY },
74  { PowerLinux::TGT_O_WRONLY,    O_WRONLY },
75  { PowerLinux::TGT_O_RDWR,      O_RDWR },
76  { PowerLinux::TGT_O_CREAT,     O_CREAT },
77  { PowerLinux::TGT_O_EXCL,      O_EXCL },
78  { PowerLinux::TGT_O_NOCTTY,    O_NOCTTY },
79  { PowerLinux::TGT_O_TRUNC,     O_TRUNC },
80  { PowerLinux::TGT_O_APPEND,    O_APPEND },
81  { PowerLinux::TGT_O_NONBLOCK,  O_NONBLOCK },
82#ifdef O_DSYNC
83  { PowerLinux::TGT_O_DSYNC,     O_DSYNC },
84#endif
85  { PowerLinux::TGT_FASYNC,      O_ASYNC },
86  { PowerLinux::TGT_O_DIRECT,    O_DIRECT },
87#ifdef O_LARGEFILE
88  { PowerLinux::TGT_O_LARGEFILE, O_LARGEFILE },
89#endif
90  { PowerLinux::TGT_O_DIRECTORY, O_DIRECTORY },
91  { PowerLinux::TGT_O_NOFOLLOW,  O_NOFOLLOW },
92  { PowerLinux::TGT_O_NOATIME,   O_NOATIME },
93#ifdef O_CLOEXEC
94  { PowerLinux::TGT_O_CLOEXEC,   O_CLOEXEC },
95#endif
96#ifdef O_SYNC
97  { PowerLinux::TGT_O_SYNC,      O_SYNC },
98#endif
99#ifdef O_PATH
100  { PowerLinux::TGT_O_PATH,      O_PATH},
101#endif
102#endif /* _MSC_VER */
103};
104
105const int PowerLinux::NUM_OPEN_FLAGS =
106        (sizeof(PowerLinux::openFlagTable)/sizeof(PowerLinux::openFlagTable[0]));
107
108