gem5 [DEVELOP-FOR-25.1]
Loading...
Searching...
No Matches
flag_tables.hh
Go to the documentation of this file.
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
43#include <fcntl.h>
44#include <sys/mman.h>
45
46#include <map>
47
48/*
49 * @file flag_tables.hh
50 *
51 * This file contains definitions of flag translation tables for the
52 * open() system call. Since the tables are nearly identical
53 * across target platforms (other than the values of the target flags),
54 * we use a template to build the tables which is inherited by each target
55 * platform.
56 */
57
58namespace gem5
59{
60
61template <typename Target>
63{
64 public:
65 // open(2) flags translation table
66 static inline const std::map<int, int> openFlagTable = {
67#ifdef _MSC_VER
68 { Target::TGT_O_RDONLY, _O_RDONLY },
69 { Target::TGT_O_WRONLY, _O_WRONLY },
70 { Target::TGT_O_RDWR, _O_RDWR },
71 { Target::TGT_O_CREAT, _O_CREAT },
72 { Target::TGT_O_EXCL, _O_EXCL },
73 { Target::TGT_O_TRUNC, _O_TRUNC },
74 { Target::TGT_O_APPEND, _O_APPEND },
75#else /* !_MSC_VER */
76 { Target::TGT_O_RDONLY, O_RDONLY },
77 { Target::TGT_O_WRONLY, O_WRONLY },
78 { Target::TGT_O_RDWR, O_RDWR },
79 { Target::TGT_O_CREAT, O_CREAT },
80 { Target::TGT_O_EXCL, O_EXCL },
81 { Target::TGT_O_TRUNC, O_TRUNC },
82 { Target::TGT_O_APPEND, O_APPEND },
83 { Target::TGT_O_NOCTTY, O_NOCTTY },
84 { Target::TGT_O_NONBLOCK, O_NONBLOCK },
85#ifdef O_DSYNC
86 { Target::TGT_O_DSYNC, O_DSYNC },
87#endif
88#ifdef O_ASYNC
89 { Target::TGT_FASYNC, O_ASYNC },
90#endif
91#ifdef O_DIRECT
92 { Target::TGT_O_DIRECT, O_DIRECT },
93#endif
94#ifdef O_LARGEFILE
95 { Target::TGT_O_LARGEFILE, O_LARGEFILE },
96#endif
97#ifdef O_DIRECTORY
98 { Target::TGT_O_DIRECTORY, O_DIRECTORY },
99#endif
100#ifdef O_NOFOLLOW
101 { Target::TGT_O_NOFOLLOW, O_NOFOLLOW },
102#endif
103#ifdef O_NOATIME
104 { Target::TGT_O_NOATIME, O_NOATIME },
105#endif
106#ifdef O_CLOEXEC
107 { Target::TGT_O_CLOEXEC, O_CLOEXEC },
108#endif
109#ifdef O_SYNC
110 { Target::TGT_O_SYNC, O_SYNC },
111#endif
112#ifdef O_PATH
113 { Target::TGT_O_PATH, O_PATH },
114#endif
115#endif /* _MSC_VER */
116 };
117};
118
119} // namespace gem5
static const std::map< int, int > openFlagTable
Copyright (c) 2024 Arm Limited All rights reserved.
Definition binary32.hh:36

Generated on Mon Oct 27 2025 04:13:02 for gem5 by doxygen 1.14.0