1/* 2 * Copyright (c) 2010, 2011-2012, 2015 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 The Regents of The University of Michigan 15 * Copyright (c) 2007-2008 The Florida State University 16 * All rights reserved. 17 * 18 * Redistribution and use in source and binary forms, with or without 19 * modification, are permitted provided that the following conditions are 20 * met: redistributions of source code must retain the above copyright 21 * notice, this list of conditions and the following disclaimer; 22 * redistributions in binary form must reproduce the above copyright 23 * notice, this list of conditions and the following disclaimer in the 24 * documentation and/or other materials provided with the distribution; 25 * neither the name of the copyright holders nor the names of its 26 * contributors may be used to endorse or promote products derived from 27 * this software without specific prior written permission. 28 * 29 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 30 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 31 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 32 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 33 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 34 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 35 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 36 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 37 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 38 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 39 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 40 * 41 * Authors: Ali Saidi 42 * Stephen Hines 43 */ 44 45#ifndef __ARCH_ARM_LINUX_LINUX_HH__ 46#define __ARCH_ARM_LINUX_LINUX_HH__ 47 48#include "kern/linux/linux.hh" 49 50class ArmLinux32 : public Linux 51{ 52 public: 53
| 1/* 2 * Copyright (c) 2010, 2011-2012, 2015 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 The Regents of The University of Michigan 15 * Copyright (c) 2007-2008 The Florida State University 16 * All rights reserved. 17 * 18 * Redistribution and use in source and binary forms, with or without 19 * modification, are permitted provided that the following conditions are 20 * met: redistributions of source code must retain the above copyright 21 * notice, this list of conditions and the following disclaimer; 22 * redistributions in binary form must reproduce the above copyright 23 * notice, this list of conditions and the following disclaimer in the 24 * documentation and/or other materials provided with the distribution; 25 * neither the name of the copyright holders nor the names of its 26 * contributors may be used to endorse or promote products derived from 27 * this software without specific prior written permission. 28 * 29 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 30 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 31 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 32 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 33 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 34 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 35 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 36 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 37 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 38 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 39 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 40 * 41 * Authors: Ali Saidi 42 * Stephen Hines 43 */ 44 45#ifndef __ARCH_ARM_LINUX_LINUX_HH__ 46#define __ARCH_ARM_LINUX_LINUX_HH__ 47 48#include "kern/linux/linux.hh" 49 50class ArmLinux32 : public Linux 51{ 52 public: 53
|
| 54 static const int TGT_SIGHUP = 0x000001; 55 static const int TGT_SIGINT = 0x000002; 56 static const int TGT_SIGQUIT = 0x000003; 57 static const int TGT_SIGILL = 0x000004; 58 static const int TGT_SIGTRAP = 0x000005; 59 static const int TGT_SIGABRT = 0x000006; 60 static const int TGT_SIGIOT = 0x000006; 61 static const int TGT_SIGBUS = 0x000007; 62 static const int TGT_SIGFPE = 0x000008; 63 static const int TGT_SIGKILL = 0x000009; 64 static const int TGT_SIGUSR1 = 0x00000a; 65 static const int TGT_SIGSEGV = 0x00000b; 66 static const int TGT_SIGUSR2 = 0x00000c; 67 static const int TGT_SIGPIPE = 0x00000d; 68 static const int TGT_SIGALRM = 0x00000e; 69 static const int TGT_SIGTERM = 0x00000f; 70 static const int TGT_SIGSTKFLT = 0x000010; 71 static const int TGT_SIGCHLD = 0x000011; 72 static const int TGT_SIGCONT = 0x000012; 73 static const int TGT_SIGSTOP = 0x000013; 74 static const int TGT_SIGTSTP = 0x000014; 75 static const int TGT_SIGTTIN = 0x000015; 76 static const int TGT_SIGTTOU = 0x000016; 77 static const int TGT_SIGURG = 0x000017; 78 static const int TGT_SIGXCPU = 0x000018; 79 static const int TGT_SIGXFSZ = 0x000019; 80 static const int TGT_SIGVTALRM = 0x00001a; 81 static const int TGT_SIGPROF = 0x00001b; 82 static const int TGT_SIGWINCH = 0x00001c; 83 static const int TGT_SIGIO = 0x00001d; 84 static const int TGT_SIGPOLL = 0x00001d; 85 static const int TGT_SIGPWR = 0x00001e; 86 static const int TGT_SIGSYS = 0x00001f; 87 static const int TGT_SIGUNUSED = 0x00001f; 88
|
54 /// This table maps the target open() flags to the corresponding 55 /// host open() flags. 56 static SyscallFlagTransTable openFlagTable[]; 57 58 /// Number of entries in openFlagTable[]. 59 static const int NUM_OPEN_FLAGS; 60 61 //@{ 62 /// Basic ARM Linux types 63 typedef uint32_t size_t; 64 typedef uint32_t off_t; 65 typedef int32_t time_t; 66 typedef int32_t clock_t; 67 //@} 68 69 //@{ 70 /// open(2) flag values.
| 89 /// This table maps the target open() flags to the corresponding 90 /// host open() flags. 91 static SyscallFlagTransTable openFlagTable[]; 92 93 /// Number of entries in openFlagTable[]. 94 static const int NUM_OPEN_FLAGS; 95 96 //@{ 97 /// Basic ARM Linux types 98 typedef uint32_t size_t; 99 typedef uint32_t off_t; 100 typedef int32_t time_t; 101 typedef int32_t clock_t; 102 //@} 103 104 //@{ 105 /// open(2) flag values.
|
71 static const int TGT_O_RDONLY = 00000000; //!< O_RDONLY 72 static const int TGT_O_WRONLY = 00000001; //!< O_WRONLY 73 static const int TGT_O_RDWR = 00000002; //!< O_RDWR 74 static const int TGT_O_CREAT = 00000100; //!< O_CREAT 75 static const int TGT_O_EXCL = 00000200; //!< O_EXCL 76 static const int TGT_O_NOCTTY = 00000400; //!< O_NOCTTY 77 static const int TGT_O_TRUNC = 00001000; //!< O_TRUNC 78 static const int TGT_O_APPEND = 00002000; //!< O_APPEND 79 static const int TGT_O_NONBLOCK = 00004000; //!< O_NONBLOCK 80 static const int TGT_O_SYNC = 00010000; //!< O_SYNC 81 static const int TGT_FASYNC = 00020000; //!< FASYNC 82 static const int TGT_O_DIRECT = 00040000; //!< O_DIRECT 83 static const int TGT_O_LARGEFILE = 00100000; //!< O_LARGEFILE 84 static const int TGT_O_DIRECTORY = 00200000; //!< O_DIRECTORY 85 static const int TGT_O_NOFOLLOW = 00400000; //!< O_NOFOLLOW 86 static const int TGT_O_NOATIME = 01000000; //!< O_NOATIME 87 static const int TGT_O_CLOEXEC = 02000000; //!< O_NOATIME 88 89
| 106 static const int TGT_O_RDONLY = 000000000; //!< O_RDONLY 107 static const int TGT_O_WRONLY = 000000001; //!< O_WRONLY 108 static const int TGT_O_RDWR = 000000002; //!< O_RDWR 109 static const int TGT_O_CREAT = 000000100; //!< O_CREAT 110 static const int TGT_O_EXCL = 000000200; //!< O_EXCL 111 static const int TGT_O_NOCTTY = 000000400; //!< O_NOCTTY 112 static const int TGT_O_TRUNC = 000001000; //!< O_TRUNC 113 static const int TGT_O_APPEND = 000002000; //!< O_APPEND 114 static const int TGT_O_NONBLOCK = 000004000; //!< O_NONBLOCK 115 static const int TGT_O_DSYNC = 000010000; //!< O_DSYNC 116 static const int TGT_FASYNC = 000020000; //!< FASYNC 117 static const int TGT_O_DIRECT = 000200000; //!< O_DIRECT 118 static const int TGT_O_LARGEFILE = 000400000; //!< O_LARGEFILE 119 static const int TGT_O_DIRECTORY = 000040000; //!< O_DIRECTORY 120 static const int TGT_O_NOFOLLOW = 000100000; //!< O_NOFOLLOW 121 static const int TGT_O_NOATIME = 001000000; //!< O_NOATIME 122 static const int TGT_O_CLOEXEC = 002000000; //!< O_NOATIME 123 static const int TGT_O_SYNC = 004010000; //!< O_SYNC 124 static const int TGT_O_PATH = 010000000; //!< O_PATH
|
90 //@} 91 92 /// For mmap(). 93 static const unsigned TGT_MAP_ANONYMOUS = 0x20; 94 static const unsigned TGT_MAP_FIXED = 0x10; 95 96 /// For table(). 97 static const int TBL_SYSINFO = 12; 98 99 /// Limit struct for getrlimit/setrlimit. 100 struct rlimit { 101 uint32_t rlim_cur; //!< soft limit 102 uint32_t rlim_max; //!< hard limit 103 }; 104 105 /// For gettimeofday(). 106 struct timeval { 107 int32_t tv_sec; //!< seconds 108 int32_t tv_usec; //!< microseconds 109 }; 110 111 struct timespec { 112 int32_t tv_sec; //!< seconds 113 int32_t tv_nsec; //!< nanoseconds 114 }; 115 116 // For writev/readv 117 struct tgt_iovec { 118 uint32_t iov_base; // void * 119 uint32_t iov_len; 120 }; 121 122 123 typedef struct { 124 uint32_t st_dev; 125 uint32_t st_ino; 126 uint16_t st_mode; 127 uint16_t st_nlink; 128 uint16_t st_uid; 129 uint16_t st_gid; 130 uint32_t st_rdev; 131 uint32_t __pad1; 132 uint32_t st_size; 133 uint32_t st_blksize; 134 uint32_t __pad2; 135 uint32_t st_blocks; 136 uint32_t st_atimeX; 137 uint32_t st_atime_nsec; 138 uint32_t st_mtimeX; 139 uint32_t st_mtime_nsec; 140 uint32_t st_ctimeX; 141 uint32_t st_ctime_nsec; 142 } tgt_stat; 143 144 typedef struct { 145 uint64_t st_dev; 146 uint8_t __pad0[4]; 147 uint32_t __st_ino; 148 uint32_t st_mode; 149 uint32_t st_nlink; 150 uint32_t st_uid; 151 uint32_t st_gid; 152 uint64_t st_rdev; 153 uint8_t __pad3[4]; 154 int64_t __attribute__ ((aligned (8))) st_size; 155 uint32_t st_blksize; 156 uint64_t __attribute__ ((aligned (8))) st_blocks; 157 uint32_t st_atimeX; 158 uint32_t st_atime_nsec; 159 uint32_t st_mtimeX; 160 uint32_t st_mtime_nsec; 161 uint32_t st_ctimeX; 162 uint32_t st_ctime_nsec; 163 uint64_t st_ino; 164 } tgt_stat64; 165 166 typedef struct { 167 int32_t uptime; /* Seconds since boot */ 168 uint32_t loads[3]; /* 1, 5, and 15 minute load averages */ 169 uint32_t totalram; /* Total usable main memory size */ 170 uint32_t freeram; /* Available memory size */ 171 uint32_t sharedram; /* Amount of shared memory */ 172 uint32_t bufferram; /* Memory used by buffers */ 173 uint32_t totalswap; /* Total swap space size */ 174 uint32_t freeswap; /* swap space still available */ 175 uint16_t procs; /* Number of current processes */ 176 uint32_t totalhigh; /* Total high memory size */ 177 uint32_t freehigh; /* Available high memory size */ 178 uint32_t mem_unit; /* Memory unit size in bytes */ 179 } tgt_sysinfo; 180 181 /// For getrusage(). 182 struct rusage { 183 struct timeval ru_utime; //!< user time used 184 struct timeval ru_stime; //!< system time used 185 int32_t ru_maxrss; //!< max rss 186 int32_t ru_ixrss; //!< integral shared memory size 187 int32_t ru_idrss; //!< integral unshared data " 188 int32_t ru_isrss; //!< integral unshared stack " 189 int32_t ru_minflt; //!< page reclaims - total vmfaults 190 int32_t ru_majflt; //!< page faults 191 int32_t ru_nswap; //!< swaps 192 int32_t ru_inblock; //!< block input operations 193 int32_t ru_oublock; //!< block output operations 194 int32_t ru_msgsnd; //!< messages sent 195 int32_t ru_msgrcv; //!< messages received 196 int32_t ru_nsignals; //!< signals received 197 int32_t ru_nvcsw; //!< voluntary context switches 198 int32_t ru_nivcsw; //!< involuntary " 199 }; 200 201 /// For times(). 202 struct tms { 203 int32_t tms_utime; //!< user time 204 int32_t tms_stime; //!< system time 205 int32_t tms_cutime; //!< user time of children 206 int32_t tms_cstime; //!< system time of children 207 }; 208}; 209 210class ArmLinux64 : public Linux 211{ 212 public: 213
| 125 //@} 126 127 /// For mmap(). 128 static const unsigned TGT_MAP_ANONYMOUS = 0x20; 129 static const unsigned TGT_MAP_FIXED = 0x10; 130 131 /// For table(). 132 static const int TBL_SYSINFO = 12; 133 134 /// Limit struct for getrlimit/setrlimit. 135 struct rlimit { 136 uint32_t rlim_cur; //!< soft limit 137 uint32_t rlim_max; //!< hard limit 138 }; 139 140 /// For gettimeofday(). 141 struct timeval { 142 int32_t tv_sec; //!< seconds 143 int32_t tv_usec; //!< microseconds 144 }; 145 146 struct timespec { 147 int32_t tv_sec; //!< seconds 148 int32_t tv_nsec; //!< nanoseconds 149 }; 150 151 // For writev/readv 152 struct tgt_iovec { 153 uint32_t iov_base; // void * 154 uint32_t iov_len; 155 }; 156 157 158 typedef struct { 159 uint32_t st_dev; 160 uint32_t st_ino; 161 uint16_t st_mode; 162 uint16_t st_nlink; 163 uint16_t st_uid; 164 uint16_t st_gid; 165 uint32_t st_rdev; 166 uint32_t __pad1; 167 uint32_t st_size; 168 uint32_t st_blksize; 169 uint32_t __pad2; 170 uint32_t st_blocks; 171 uint32_t st_atimeX; 172 uint32_t st_atime_nsec; 173 uint32_t st_mtimeX; 174 uint32_t st_mtime_nsec; 175 uint32_t st_ctimeX; 176 uint32_t st_ctime_nsec; 177 } tgt_stat; 178 179 typedef struct { 180 uint64_t st_dev; 181 uint8_t __pad0[4]; 182 uint32_t __st_ino; 183 uint32_t st_mode; 184 uint32_t st_nlink; 185 uint32_t st_uid; 186 uint32_t st_gid; 187 uint64_t st_rdev; 188 uint8_t __pad3[4]; 189 int64_t __attribute__ ((aligned (8))) st_size; 190 uint32_t st_blksize; 191 uint64_t __attribute__ ((aligned (8))) st_blocks; 192 uint32_t st_atimeX; 193 uint32_t st_atime_nsec; 194 uint32_t st_mtimeX; 195 uint32_t st_mtime_nsec; 196 uint32_t st_ctimeX; 197 uint32_t st_ctime_nsec; 198 uint64_t st_ino; 199 } tgt_stat64; 200 201 typedef struct { 202 int32_t uptime; /* Seconds since boot */ 203 uint32_t loads[3]; /* 1, 5, and 15 minute load averages */ 204 uint32_t totalram; /* Total usable main memory size */ 205 uint32_t freeram; /* Available memory size */ 206 uint32_t sharedram; /* Amount of shared memory */ 207 uint32_t bufferram; /* Memory used by buffers */ 208 uint32_t totalswap; /* Total swap space size */ 209 uint32_t freeswap; /* swap space still available */ 210 uint16_t procs; /* Number of current processes */ 211 uint32_t totalhigh; /* Total high memory size */ 212 uint32_t freehigh; /* Available high memory size */ 213 uint32_t mem_unit; /* Memory unit size in bytes */ 214 } tgt_sysinfo; 215 216 /// For getrusage(). 217 struct rusage { 218 struct timeval ru_utime; //!< user time used 219 struct timeval ru_stime; //!< system time used 220 int32_t ru_maxrss; //!< max rss 221 int32_t ru_ixrss; //!< integral shared memory size 222 int32_t ru_idrss; //!< integral unshared data " 223 int32_t ru_isrss; //!< integral unshared stack " 224 int32_t ru_minflt; //!< page reclaims - total vmfaults 225 int32_t ru_majflt; //!< page faults 226 int32_t ru_nswap; //!< swaps 227 int32_t ru_inblock; //!< block input operations 228 int32_t ru_oublock; //!< block output operations 229 int32_t ru_msgsnd; //!< messages sent 230 int32_t ru_msgrcv; //!< messages received 231 int32_t ru_nsignals; //!< signals received 232 int32_t ru_nvcsw; //!< voluntary context switches 233 int32_t ru_nivcsw; //!< involuntary " 234 }; 235 236 /// For times(). 237 struct tms { 238 int32_t tms_utime; //!< user time 239 int32_t tms_stime; //!< system time 240 int32_t tms_cutime; //!< user time of children 241 int32_t tms_cstime; //!< system time of children 242 }; 243}; 244 245class ArmLinux64 : public Linux 246{ 247 public: 248
|
| 249 static const int TGT_SIGHUP = 0x000001; 250 static const int TGT_SIGINT = 0x000002; 251 static const int TGT_SIGQUIT = 0x000003; 252 static const int TGT_SIGILL = 0x000004; 253 static const int TGT_SIGTRAP = 0x000005; 254 static const int TGT_SIGABRT = 0x000006; 255 static const int TGT_SIGIOT = 0x000006; 256 static const int TGT_SIGBUS = 0x000007; 257 static const int TGT_SIGFPE = 0x000008; 258 static const int TGT_SIGKILL = 0x000009; 259 static const int TGT_SIGUSR1 = 0x00000a; 260 static const int TGT_SIGSEGV = 0x00000b; 261 static const int TGT_SIGUSR2 = 0x00000c; 262 static const int TGT_SIGPIPE = 0x00000d; 263 static const int TGT_SIGALRM = 0x00000e; 264 static const int TGT_SIGTERM = 0x00000f; 265 static const int TGT_SIGSTKFLT = 0x000010; 266 static const int TGT_SIGCHLD = 0x000011; 267 static const int TGT_SIGCONT = 0x000012; 268 static const int TGT_SIGSTOP = 0x000013; 269 static const int TGT_SIGTSTP = 0x000014; 270 static const int TGT_SIGTTIN = 0x000015; 271 static const int TGT_SIGTTOU = 0x000016; 272 static const int TGT_SIGURG = 0x000017; 273 static const int TGT_SIGXCPU = 0x000018; 274 static const int TGT_SIGXFSZ = 0x000019; 275 static const int TGT_SIGVTALRM = 0x00001a; 276 static const int TGT_SIGPROF = 0x00001b; 277 static const int TGT_SIGWINCH = 0x00001c; 278 static const int TGT_SIGIO = 0x00001d; 279 static const int TGT_SIGPOLL = 0x00001d; 280 static const int TGT_SIGPWR = 0x00001e; 281 static const int TGT_SIGSYS = 0x00001f; 282 static const int TGT_SIGUNUSED = 0x00001f; 283
|
214 /// This table maps the target open() flags to the corresponding 215 /// host open() flags. 216 static SyscallFlagTransTable openFlagTable[]; 217 218 /// Number of entries in openFlagTable[]. 219 static const int NUM_OPEN_FLAGS; 220 221 //@{ 222 /// Basic ARM Linux types 223 typedef uint64_t size_t; 224 typedef uint64_t off_t; 225 typedef int64_t time_t; 226 typedef int64_t clock_t; 227 //@} 228 229 //@{ 230 /// open(2) flag values.
| 284 /// This table maps the target open() flags to the corresponding 285 /// host open() flags. 286 static SyscallFlagTransTable openFlagTable[]; 287 288 /// Number of entries in openFlagTable[]. 289 static const int NUM_OPEN_FLAGS; 290 291 //@{ 292 /// Basic ARM Linux types 293 typedef uint64_t size_t; 294 typedef uint64_t off_t; 295 typedef int64_t time_t; 296 typedef int64_t clock_t; 297 //@} 298 299 //@{ 300 /// open(2) flag values.
|
231 static const int TGT_O_RDONLY = 00000000; //!< O_RDONLY 232 static const int TGT_O_WRONLY = 00000001; //!< O_WRONLY 233 static const int TGT_O_RDWR = 00000002; //!< O_RDWR 234 static const int TGT_O_CREAT = 00000100; //!< O_CREAT 235 static const int TGT_O_EXCL = 00000200; //!< O_EXCL 236 static const int TGT_O_NOCTTY = 00000400; //!< O_NOCTTY 237 static const int TGT_O_TRUNC = 00001000; //!< O_TRUNC 238 static const int TGT_O_APPEND = 00002000; //!< O_APPEND 239 static const int TGT_O_NONBLOCK = 00004000; //!< O_NONBLOCK 240 static const int TGT_O_SYNC = 00010000; //!< O_SYNC 241 static const int TGT_FASYNC = 00020000; //!< FASYNC 242 static const int TGT_O_DIRECT = 00040000; //!< O_DIRECT 243 static const int TGT_O_LARGEFILE = 00100000; //!< O_LARGEFILE 244 static const int TGT_O_DIRECTORY = 00200000; //!< O_DIRECTORY 245 static const int TGT_O_NOFOLLOW = 00400000; //!< O_NOFOLLOW 246 static const int TGT_O_NOATIME = 01000000; //!< O_NOATIME 247 static const int TGT_O_CLOEXEC = 02000000; //!< O_NOATIME
| 301 static const int TGT_O_RDONLY = 000000000; //!< O_RDONLY 302 static const int TGT_O_WRONLY = 000000001; //!< O_WRONLY 303 static const int TGT_O_RDWR = 000000002; //!< O_RDWR 304 static const int TGT_O_CREAT = 000000100; //!< O_CREAT 305 static const int TGT_O_EXCL = 000000200; //!< O_EXCL 306 static const int TGT_O_NOCTTY = 000000400; //!< O_NOCTTY 307 static const int TGT_O_TRUNC = 000001000; //!< O_TRUNC 308 static const int TGT_O_APPEND = 000002000; //!< O_APPEND 309 static const int TGT_O_NONBLOCK = 000004000; //!< O_NONBLOCK 310 static const int TGT_O_DSYNC = 000010000; //!< O_DSYNC 311 static const int TGT_FASYNC = 000020000; //!< FASYNC 312 static const int TGT_O_DIRECT = 000200000; //!< O_DIRECT 313 static const int TGT_O_LARGEFILE = 000400000; //!< O_LARGEFILE 314 static const int TGT_O_DIRECTORY = 000040000; //!< O_DIRECTORY 315 static const int TGT_O_NOFOLLOW = 000100000; //!< O_NOFOLLOW 316 static const int TGT_O_NOATIME = 001000000; //!< O_NOATIME 317 static const int TGT_O_CLOEXEC = 002000000; //!< O_NOATIME 318 static const int TGT_O_SYNC = 004010000; //!< O_SYNC 319 static const int TGT_O_PATH = 010000000; //!< O_PATH
|
248 //@} 249 250 /// For mmap(). 251 static const unsigned TGT_MAP_ANONYMOUS = 0x20; 252 static const unsigned TGT_MAP_FIXED = 0x10; 253 254 //@{ 255 /// For getrusage(). 256 static const int TGT_RUSAGE_SELF = 0; 257 static const int TGT_RUSAGE_CHILDREN = -1; 258 static const int TGT_RUSAGE_BOTH = -2; 259 //@} 260 261 //@{ 262 /// ioctl() command codes. 263 static const unsigned TIOCGETP_ = 0x5401; 264 static const unsigned TIOCSETP_ = 0x80067409; 265 static const unsigned TIOCSETN_ = 0x8006740a; 266 static const unsigned TIOCSETC_ = 0x80067411; 267 static const unsigned TIOCGETC_ = 0x40067412; 268 static const unsigned FIONREAD_ = 0x4004667f; 269 static const unsigned TIOCISATTY_ = 0x2000745e; 270 static const unsigned TIOCGETS_ = 0x402c7413; 271 static const unsigned TIOCGETA_ = 0x5405; 272 static const unsigned TCSETAW_ = 0x5407; // 2.6.15 kernel 273 //@} 274 275 /// For table(). 276 static const int TBL_SYSINFO = 12; 277 278 /// Resource enumeration for getrlimit(). 279 enum rlimit_resources { 280 TGT_RLIMIT_CPU = 0, 281 TGT_RLIMIT_FSIZE = 1, 282 TGT_RLIMIT_DATA = 2, 283 TGT_RLIMIT_STACK = 3, 284 TGT_RLIMIT_CORE = 4, 285 TGT_RLIMIT_RSS = 5, 286 TGT_RLIMIT_NPROC = 6, 287 TGT_RLIMIT_NOFILE = 7, 288 TGT_RLIMIT_MEMLOCK = 8, 289 TGT_RLIMIT_AS = 9, 290 TGT_RLIMIT_LOCKS = 10 291 }; 292 293 /// Limit struct for getrlimit/setrlimit. 294 struct rlimit { 295 uint64_t rlim_cur; //!< soft limit 296 uint64_t rlim_max; //!< hard limit 297 }; 298 299 /// For gettimeofday(). 300 struct timeval { 301 int64_t tv_sec; //!< seconds 302 int64_t tv_usec; //!< microseconds 303 }; 304 305 struct timespec { 306 int64_t tv_sec; //!< seconds 307 int64_t tv_nsec; //!< nanoseconds 308 }; 309 310 // For writev/readv 311 struct tgt_iovec { 312 uint64_t iov_base; // void * 313 uint64_t iov_len; 314 }; 315 316 typedef struct { 317 uint64_t st_dev; 318 uint64_t st_ino; 319 uint64_t st_nlink; 320 uint32_t st_mode; 321 uint32_t st_uid; 322 uint32_t st_gid; 323 uint32_t __pad0; 324 uint64_t st_rdev; 325 uint64_t st_size; 326 uint64_t st_blksize; 327 uint64_t st_blocks; 328 uint64_t st_atimeX; 329 uint64_t st_atime_nsec; 330 uint64_t st_mtimeX; 331 uint64_t st_mtime_nsec; 332 uint64_t st_ctimeX; 333 uint64_t st_ctime_nsec; 334 } tgt_stat; 335 336 typedef struct { 337 uint64_t st_dev; 338 uint64_t st_ino; 339 uint32_t st_mode; 340 uint32_t st_nlink; 341 uint32_t st_uid; 342 uint32_t st_gid; 343 uint32_t __pad0; 344 uint64_t st_rdev; 345 uint64_t st_size; 346 uint64_t st_blksize; 347 uint64_t st_blocks; 348 uint64_t st_atimeX; 349 uint64_t st_atime_nsec; 350 uint64_t st_mtimeX; 351 uint64_t st_mtime_nsec; 352 uint64_t st_ctimeX; 353 uint64_t st_ctime_nsec; 354 } tgt_stat64; 355 356 typedef struct { 357 int64_t uptime; /* Seconds since boot */ 358 uint64_t loads[3]; /* 1, 5, and 15 minute load averages */ 359 uint64_t totalram; /* Total usable main memory size */ 360 uint64_t freeram; /* Available memory size */ 361 uint64_t sharedram; /* Amount of shared memory */ 362 uint64_t bufferram; /* Memory used by buffers */ 363 uint64_t totalswap; /* Total swap space size */ 364 uint64_t freeswap; /* swap space still available */ 365 uint16_t procs; /* Number of current processes */ 366 uint16_t pad; 367 uint64_t totalhigh; /* Total high memory size */ 368 uint64_t freehigh; /* Available high memory size */ 369 uint32_t mem_unit; /* Memory unit size in bytes */ 370 } tgt_sysinfo; 371 372 /// For getrusage(). 373 struct rusage { 374 struct timeval ru_utime; //!< user time used 375 struct timeval ru_stime; //!< system time used 376 int64_t ru_maxrss; //!< max rss 377 int64_t ru_ixrss; //!< integral shared memory size 378 int64_t ru_idrss; //!< integral unshared data " 379 int64_t ru_isrss; //!< integral unshared stack " 380 int64_t ru_minflt; //!< page reclaims - total vmfaults 381 int64_t ru_majflt; //!< page faults 382 int64_t ru_nswap; //!< swaps 383 int64_t ru_inblock; //!< block input operations 384 int64_t ru_oublock; //!< block output operations 385 int64_t ru_msgsnd; //!< messages sent 386 int64_t ru_msgrcv; //!< messages received 387 int64_t ru_nsignals; //!< signals received 388 int64_t ru_nvcsw; //!< voluntary context switches 389 int64_t ru_nivcsw; //!< involuntary " 390 }; 391 392 /// For times(). 393 struct tms { 394 int64_t tms_utime; //!< user time 395 int64_t tms_stime; //!< system time 396 int64_t tms_cutime; //!< user time of children 397 int64_t tms_cstime; //!< system time of children 398 }; 399}; 400 401#endif
| 320 //@} 321 322 /// For mmap(). 323 static const unsigned TGT_MAP_ANONYMOUS = 0x20; 324 static const unsigned TGT_MAP_FIXED = 0x10; 325 326 //@{ 327 /// For getrusage(). 328 static const int TGT_RUSAGE_SELF = 0; 329 static const int TGT_RUSAGE_CHILDREN = -1; 330 static const int TGT_RUSAGE_BOTH = -2; 331 //@} 332 333 //@{ 334 /// ioctl() command codes. 335 static const unsigned TIOCGETP_ = 0x5401; 336 static const unsigned TIOCSETP_ = 0x80067409; 337 static const unsigned TIOCSETN_ = 0x8006740a; 338 static const unsigned TIOCSETC_ = 0x80067411; 339 static const unsigned TIOCGETC_ = 0x40067412; 340 static const unsigned FIONREAD_ = 0x4004667f; 341 static const unsigned TIOCISATTY_ = 0x2000745e; 342 static const unsigned TIOCGETS_ = 0x402c7413; 343 static const unsigned TIOCGETA_ = 0x5405; 344 static const unsigned TCSETAW_ = 0x5407; // 2.6.15 kernel 345 //@} 346 347 /// For table(). 348 static const int TBL_SYSINFO = 12; 349 350 /// Resource enumeration for getrlimit(). 351 enum rlimit_resources { 352 TGT_RLIMIT_CPU = 0, 353 TGT_RLIMIT_FSIZE = 1, 354 TGT_RLIMIT_DATA = 2, 355 TGT_RLIMIT_STACK = 3, 356 TGT_RLIMIT_CORE = 4, 357 TGT_RLIMIT_RSS = 5, 358 TGT_RLIMIT_NPROC = 6, 359 TGT_RLIMIT_NOFILE = 7, 360 TGT_RLIMIT_MEMLOCK = 8, 361 TGT_RLIMIT_AS = 9, 362 TGT_RLIMIT_LOCKS = 10 363 }; 364 365 /// Limit struct for getrlimit/setrlimit. 366 struct rlimit { 367 uint64_t rlim_cur; //!< soft limit 368 uint64_t rlim_max; //!< hard limit 369 }; 370 371 /// For gettimeofday(). 372 struct timeval { 373 int64_t tv_sec; //!< seconds 374 int64_t tv_usec; //!< microseconds 375 }; 376 377 struct timespec { 378 int64_t tv_sec; //!< seconds 379 int64_t tv_nsec; //!< nanoseconds 380 }; 381 382 // For writev/readv 383 struct tgt_iovec { 384 uint64_t iov_base; // void * 385 uint64_t iov_len; 386 }; 387 388 typedef struct { 389 uint64_t st_dev; 390 uint64_t st_ino; 391 uint64_t st_nlink; 392 uint32_t st_mode; 393 uint32_t st_uid; 394 uint32_t st_gid; 395 uint32_t __pad0; 396 uint64_t st_rdev; 397 uint64_t st_size; 398 uint64_t st_blksize; 399 uint64_t st_blocks; 400 uint64_t st_atimeX; 401 uint64_t st_atime_nsec; 402 uint64_t st_mtimeX; 403 uint64_t st_mtime_nsec; 404 uint64_t st_ctimeX; 405 uint64_t st_ctime_nsec; 406 } tgt_stat; 407 408 typedef struct { 409 uint64_t st_dev; 410 uint64_t st_ino; 411 uint32_t st_mode; 412 uint32_t st_nlink; 413 uint32_t st_uid; 414 uint32_t st_gid; 415 uint32_t __pad0; 416 uint64_t st_rdev; 417 uint64_t st_size; 418 uint64_t st_blksize; 419 uint64_t st_blocks; 420 uint64_t st_atimeX; 421 uint64_t st_atime_nsec; 422 uint64_t st_mtimeX; 423 uint64_t st_mtime_nsec; 424 uint64_t st_ctimeX; 425 uint64_t st_ctime_nsec; 426 } tgt_stat64; 427 428 typedef struct { 429 int64_t uptime; /* Seconds since boot */ 430 uint64_t loads[3]; /* 1, 5, and 15 minute load averages */ 431 uint64_t totalram; /* Total usable main memory size */ 432 uint64_t freeram; /* Available memory size */ 433 uint64_t sharedram; /* Amount of shared memory */ 434 uint64_t bufferram; /* Memory used by buffers */ 435 uint64_t totalswap; /* Total swap space size */ 436 uint64_t freeswap; /* swap space still available */ 437 uint16_t procs; /* Number of current processes */ 438 uint16_t pad; 439 uint64_t totalhigh; /* Total high memory size */ 440 uint64_t freehigh; /* Available high memory size */ 441 uint32_t mem_unit; /* Memory unit size in bytes */ 442 } tgt_sysinfo; 443 444 /// For getrusage(). 445 struct rusage { 446 struct timeval ru_utime; //!< user time used 447 struct timeval ru_stime; //!< system time used 448 int64_t ru_maxrss; //!< max rss 449 int64_t ru_ixrss; //!< integral shared memory size 450 int64_t ru_idrss; //!< integral unshared data " 451 int64_t ru_isrss; //!< integral unshared stack " 452 int64_t ru_minflt; //!< page reclaims - total vmfaults 453 int64_t ru_majflt; //!< page faults 454 int64_t ru_nswap; //!< swaps 455 int64_t ru_inblock; //!< block input operations 456 int64_t ru_oublock; //!< block output operations 457 int64_t ru_msgsnd; //!< messages sent 458 int64_t ru_msgrcv; //!< messages received 459 int64_t ru_nsignals; //!< signals received 460 int64_t ru_nvcsw; //!< voluntary context switches 461 int64_t ru_nivcsw; //!< involuntary " 462 }; 463 464 /// For times(). 465 struct tms { 466 int64_t tms_utime; //!< user time 467 int64_t tms_stime; //!< system time 468 int64_t tms_cutime; //!< user time of children 469 int64_t tms_cstime; //!< system time of children 470 }; 471}; 472 473#endif
|