linux.hh revision 11383:5ac090acd180
112047Schristian.menard@tu-dresden.de/* 212047Schristian.menard@tu-dresden.de * Copyright (c) 2010, 2011-2012, 2015 ARM Limited 312047Schristian.menard@tu-dresden.de * All rights reserved 412047Schristian.menard@tu-dresden.de * 512047Schristian.menard@tu-dresden.de * The license below extends only to copyright in the software and shall 612047Schristian.menard@tu-dresden.de * not be construed as granting a license to any other intellectual 712047Schristian.menard@tu-dresden.de * property including but not limited to intellectual property relating 812047Schristian.menard@tu-dresden.de * to a hardware implementation of the functionality of the software 912047Schristian.menard@tu-dresden.de * licensed hereunder. You may use the software subject to the license 1012047Schristian.menard@tu-dresden.de * terms below provided that you ensure that this notice is replicated 1112047Schristian.menard@tu-dresden.de * unmodified and in its entirety in all distributions of the software, 1212047Schristian.menard@tu-dresden.de * modified or unmodified, in source code or in binary form. 1312047Schristian.menard@tu-dresden.de * 1412047Schristian.menard@tu-dresden.de * Copyright (c) 2003-2005 The Regents of The University of Michigan 1512047Schristian.menard@tu-dresden.de * Copyright (c) 2007-2008 The Florida State University 1612047Schristian.menard@tu-dresden.de * All rights reserved. 1712047Schristian.menard@tu-dresden.de * 1812047Schristian.menard@tu-dresden.de * Redistribution and use in source and binary forms, with or without 1912047Schristian.menard@tu-dresden.de * modification, are permitted provided that the following conditions are 2012047Schristian.menard@tu-dresden.de * met: redistributions of source code must retain the above copyright 2112047Schristian.menard@tu-dresden.de * notice, this list of conditions and the following disclaimer; 2212047Schristian.menard@tu-dresden.de * redistributions in binary form must reproduce the above copyright 2312047Schristian.menard@tu-dresden.de * notice, this list of conditions and the following disclaimer in the 2412047Schristian.menard@tu-dresden.de * documentation and/or other materials provided with the distribution; 2512047Schristian.menard@tu-dresden.de * neither the name of the copyright holders nor the names of its 2612047Schristian.menard@tu-dresden.de * contributors may be used to endorse or promote products derived from 2712047Schristian.menard@tu-dresden.de * this software without specific prior written permission. 2812047Schristian.menard@tu-dresden.de * 2912047Schristian.menard@tu-dresden.de * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 3012047Schristian.menard@tu-dresden.de * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 3112047Schristian.menard@tu-dresden.de * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 3212047Schristian.menard@tu-dresden.de * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 3312047Schristian.menard@tu-dresden.de * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 3412047Schristian.menard@tu-dresden.de * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 3512047Schristian.menard@tu-dresden.de * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 3612047Schristian.menard@tu-dresden.de * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 3712047Schristian.menard@tu-dresden.de * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 3812047Schristian.menard@tu-dresden.de * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 3912047Schristian.menard@tu-dresden.de * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 4012047Schristian.menard@tu-dresden.de * 4112047Schristian.menard@tu-dresden.de * Authors: Ali Saidi 4212047Schristian.menard@tu-dresden.de * Stephen Hines 4312047Schristian.menard@tu-dresden.de */ 4412047Schristian.menard@tu-dresden.de 4512047Schristian.menard@tu-dresden.de#ifndef __ARCH_ARM_LINUX_LINUX_HH__ 4612047Schristian.menard@tu-dresden.de#define __ARCH_ARM_LINUX_LINUX_HH__ 4712047Schristian.menard@tu-dresden.de 4812047Schristian.menard@tu-dresden.de#include "kern/linux/linux.hh" 4912047Schristian.menard@tu-dresden.de 5012047Schristian.menard@tu-dresden.declass ArmLinux32 : public Linux 5112047Schristian.menard@tu-dresden.de{ 5212047Schristian.menard@tu-dresden.de public: 5312047Schristian.menard@tu-dresden.de 5412047Schristian.menard@tu-dresden.de static const int TGT_SIGHUP = 0x000001; 5512047Schristian.menard@tu-dresden.de static const int TGT_SIGINT = 0x000002; 5612047Schristian.menard@tu-dresden.de static const int TGT_SIGQUIT = 0x000003; 5712047Schristian.menard@tu-dresden.de static const int TGT_SIGILL = 0x000004; 5812047Schristian.menard@tu-dresden.de static const int TGT_SIGTRAP = 0x000005; 5912047Schristian.menard@tu-dresden.de static const int TGT_SIGABRT = 0x000006; 6012047Schristian.menard@tu-dresden.de static const int TGT_SIGIOT = 0x000006; 6112047Schristian.menard@tu-dresden.de static const int TGT_SIGBUS = 0x000007; 6212047Schristian.menard@tu-dresden.de static const int TGT_SIGFPE = 0x000008; 6312047Schristian.menard@tu-dresden.de static const int TGT_SIGKILL = 0x000009; 6412047Schristian.menard@tu-dresden.de static const int TGT_SIGUSR1 = 0x00000a; 6512047Schristian.menard@tu-dresden.de static const int TGT_SIGSEGV = 0x00000b; 6612047Schristian.menard@tu-dresden.de static const int TGT_SIGUSR2 = 0x00000c; 6712047Schristian.menard@tu-dresden.de static const int TGT_SIGPIPE = 0x00000d; 6812047Schristian.menard@tu-dresden.de static const int TGT_SIGALRM = 0x00000e; 6912047Schristian.menard@tu-dresden.de static const int TGT_SIGTERM = 0x00000f; 7012047Schristian.menard@tu-dresden.de static const int TGT_SIGSTKFLT = 0x000010; 7112047Schristian.menard@tu-dresden.de static const int TGT_SIGCHLD = 0x000011; 7212047Schristian.menard@tu-dresden.de static const int TGT_SIGCONT = 0x000012; 7312047Schristian.menard@tu-dresden.de static const int TGT_SIGSTOP = 0x000013; 7412047Schristian.menard@tu-dresden.de static const int TGT_SIGTSTP = 0x000014; 7512047Schristian.menard@tu-dresden.de static const int TGT_SIGTTIN = 0x000015; 7612047Schristian.menard@tu-dresden.de static const int TGT_SIGTTOU = 0x000016; 7712047Schristian.menard@tu-dresden.de static const int TGT_SIGURG = 0x000017; 7812047Schristian.menard@tu-dresden.de static const int TGT_SIGXCPU = 0x000018; 7912047Schristian.menard@tu-dresden.de static const int TGT_SIGXFSZ = 0x000019; 8012047Schristian.menard@tu-dresden.de static const int TGT_SIGVTALRM = 0x00001a; 8112047Schristian.menard@tu-dresden.de static const int TGT_SIGPROF = 0x00001b; 8212047Schristian.menard@tu-dresden.de static const int TGT_SIGWINCH = 0x00001c; 8312047Schristian.menard@tu-dresden.de static const int TGT_SIGIO = 0x00001d; 8412047Schristian.menard@tu-dresden.de static const int TGT_SIGPOLL = 0x00001d; 8512047Schristian.menard@tu-dresden.de static const int TGT_SIGPWR = 0x00001e; 8612047Schristian.menard@tu-dresden.de static const int TGT_SIGSYS = 0x00001f; 8712047Schristian.menard@tu-dresden.de static const int TGT_SIGUNUSED = 0x00001f; 8812047Schristian.menard@tu-dresden.de 8912047Schristian.menard@tu-dresden.de /// This table maps the target open() flags to the corresponding 9012047Schristian.menard@tu-dresden.de /// host open() flags. 9112047Schristian.menard@tu-dresden.de static SyscallFlagTransTable openFlagTable[]; 9212047Schristian.menard@tu-dresden.de 9312047Schristian.menard@tu-dresden.de /// Number of entries in openFlagTable[]. 9412047Schristian.menard@tu-dresden.de static const int NUM_OPEN_FLAGS; 9512047Schristian.menard@tu-dresden.de 9612047Schristian.menard@tu-dresden.de //@{ 9712047Schristian.menard@tu-dresden.de /// Basic ARM Linux types 9812047Schristian.menard@tu-dresden.de typedef uint32_t size_t; 9912047Schristian.menard@tu-dresden.de typedef uint32_t off_t; 10012047Schristian.menard@tu-dresden.de typedef int32_t time_t; 10112047Schristian.menard@tu-dresden.de typedef int32_t clock_t; 102 //@} 103 104 //@{ 105 /// open(2) flag values. 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 125 //@} 126 127 /// For mmap(). 128 static SyscallFlagTransTable mmapFlagTable[]; 129 130 static const unsigned TGT_MAP_SHARED = 0x00001; 131 static const unsigned TGT_MAP_PRIVATE = 0x00002; 132 static const unsigned TGT_MAP_ANON = 0x00020; 133 static const unsigned TGT_MAP_DENYWRITE = 0x00800; 134 static const unsigned TGT_MAP_EXECUTABLE = 0x01000; 135 static const unsigned TGT_MAP_FILE = 0x00000; 136 static const unsigned TGT_MAP_GROWSDOWN = 0x00100; 137 static const unsigned TGT_MAP_HUGETLB = 0x40000; 138 static const unsigned TGT_MAP_LOCKED = 0x02000; 139 static const unsigned TGT_MAP_NONBLOCK = 0x10000; 140 static const unsigned TGT_MAP_NORESERVE = 0x04000; 141 static const unsigned TGT_MAP_POPULATE = 0x08000; 142 static const unsigned TGT_MAP_STACK = 0x20000; 143 static const unsigned TGT_MAP_ANONYMOUS = 0x00020; 144 static const unsigned TGT_MAP_FIXED = 0x00010; 145 146 static const unsigned NUM_MMAP_FLAGS; 147 148 /// For table(). 149 static const int TBL_SYSINFO = 12; 150 151 /// Limit struct for getrlimit/setrlimit. 152 struct rlimit { 153 uint32_t rlim_cur; //!< soft limit 154 uint32_t rlim_max; //!< hard limit 155 }; 156 157 /// For gettimeofday(). 158 struct timeval { 159 int32_t tv_sec; //!< seconds 160 int32_t tv_usec; //!< microseconds 161 }; 162 163 struct timespec { 164 int32_t tv_sec; //!< seconds 165 int32_t tv_nsec; //!< nanoseconds 166 }; 167 168 // For writev/readv 169 struct tgt_iovec { 170 uint32_t iov_base; // void * 171 uint32_t iov_len; 172 }; 173 174 175 typedef struct { 176 uint32_t st_dev; 177 uint32_t st_ino; 178 uint16_t st_mode; 179 uint16_t st_nlink; 180 uint16_t st_uid; 181 uint16_t st_gid; 182 uint32_t st_rdev; 183 uint32_t __pad1; 184 uint32_t st_size; 185 uint32_t st_blksize; 186 uint32_t __pad2; 187 uint32_t st_blocks; 188 uint32_t st_atimeX; 189 uint32_t st_atime_nsec; 190 uint32_t st_mtimeX; 191 uint32_t st_mtime_nsec; 192 uint32_t st_ctimeX; 193 uint32_t st_ctime_nsec; 194 } tgt_stat; 195 196 typedef struct { 197 uint64_t st_dev; 198 uint8_t __pad0[4]; 199 uint32_t __st_ino; 200 uint32_t st_mode; 201 uint32_t st_nlink; 202 uint32_t st_uid; 203 uint32_t st_gid; 204 uint64_t st_rdev; 205 uint8_t __pad3[4]; 206 int64_t __attribute__ ((aligned (8))) st_size; 207 uint32_t st_blksize; 208 uint64_t __attribute__ ((aligned (8))) st_blocks; 209 uint32_t st_atimeX; 210 uint32_t st_atime_nsec; 211 uint32_t st_mtimeX; 212 uint32_t st_mtime_nsec; 213 uint32_t st_ctimeX; 214 uint32_t st_ctime_nsec; 215 uint64_t st_ino; 216 } tgt_stat64; 217 218 typedef struct { 219 int32_t uptime; /* Seconds since boot */ 220 uint32_t loads[3]; /* 1, 5, and 15 minute load averages */ 221 uint32_t totalram; /* Total usable main memory size */ 222 uint32_t freeram; /* Available memory size */ 223 uint32_t sharedram; /* Amount of shared memory */ 224 uint32_t bufferram; /* Memory used by buffers */ 225 uint32_t totalswap; /* Total swap space size */ 226 uint32_t freeswap; /* swap space still available */ 227 uint16_t procs; /* Number of current processes */ 228 uint32_t totalhigh; /* Total high memory size */ 229 uint32_t freehigh; /* Available high memory size */ 230 uint32_t mem_unit; /* Memory unit size in bytes */ 231 } tgt_sysinfo; 232 233 /// For getrusage(). 234 struct rusage { 235 struct timeval ru_utime; //!< user time used 236 struct timeval ru_stime; //!< system time used 237 int32_t ru_maxrss; //!< max rss 238 int32_t ru_ixrss; //!< integral shared memory size 239 int32_t ru_idrss; //!< integral unshared data " 240 int32_t ru_isrss; //!< integral unshared stack " 241 int32_t ru_minflt; //!< page reclaims - total vmfaults 242 int32_t ru_majflt; //!< page faults 243 int32_t ru_nswap; //!< swaps 244 int32_t ru_inblock; //!< block input operations 245 int32_t ru_oublock; //!< block output operations 246 int32_t ru_msgsnd; //!< messages sent 247 int32_t ru_msgrcv; //!< messages received 248 int32_t ru_nsignals; //!< signals received 249 int32_t ru_nvcsw; //!< voluntary context switches 250 int32_t ru_nivcsw; //!< involuntary " 251 }; 252 253 /// For times(). 254 struct tms { 255 int32_t tms_utime; //!< user time 256 int32_t tms_stime; //!< system time 257 int32_t tms_cutime; //!< user time of children 258 int32_t tms_cstime; //!< system time of children 259 }; 260}; 261 262class ArmLinux64 : public Linux 263{ 264 public: 265 266 static const int TGT_SIGHUP = 0x000001; 267 static const int TGT_SIGINT = 0x000002; 268 static const int TGT_SIGQUIT = 0x000003; 269 static const int TGT_SIGILL = 0x000004; 270 static const int TGT_SIGTRAP = 0x000005; 271 static const int TGT_SIGABRT = 0x000006; 272 static const int TGT_SIGIOT = 0x000006; 273 static const int TGT_SIGBUS = 0x000007; 274 static const int TGT_SIGFPE = 0x000008; 275 static const int TGT_SIGKILL = 0x000009; 276 static const int TGT_SIGUSR1 = 0x00000a; 277 static const int TGT_SIGSEGV = 0x00000b; 278 static const int TGT_SIGUSR2 = 0x00000c; 279 static const int TGT_SIGPIPE = 0x00000d; 280 static const int TGT_SIGALRM = 0x00000e; 281 static const int TGT_SIGTERM = 0x00000f; 282 static const int TGT_SIGSTKFLT = 0x000010; 283 static const int TGT_SIGCHLD = 0x000011; 284 static const int TGT_SIGCONT = 0x000012; 285 static const int TGT_SIGSTOP = 0x000013; 286 static const int TGT_SIGTSTP = 0x000014; 287 static const int TGT_SIGTTIN = 0x000015; 288 static const int TGT_SIGTTOU = 0x000016; 289 static const int TGT_SIGURG = 0x000017; 290 static const int TGT_SIGXCPU = 0x000018; 291 static const int TGT_SIGXFSZ = 0x000019; 292 static const int TGT_SIGVTALRM = 0x00001a; 293 static const int TGT_SIGPROF = 0x00001b; 294 static const int TGT_SIGWINCH = 0x00001c; 295 static const int TGT_SIGIO = 0x00001d; 296 static const int TGT_SIGPOLL = 0x00001d; 297 static const int TGT_SIGPWR = 0x00001e; 298 static const int TGT_SIGSYS = 0x00001f; 299 static const int TGT_SIGUNUSED = 0x00001f; 300 301 /// This table maps the target open() flags to the corresponding 302 /// host open() flags. 303 static SyscallFlagTransTable openFlagTable[]; 304 305 /// Number of entries in openFlagTable[]. 306 static const int NUM_OPEN_FLAGS; 307 308 //@{ 309 /// Basic ARM Linux types 310 typedef uint64_t size_t; 311 typedef uint64_t off_t; 312 typedef int64_t time_t; 313 typedef int64_t clock_t; 314 //@} 315 316 //@{ 317 /// open(2) flag values. 318 static const int TGT_O_RDONLY = 000000000; //!< O_RDONLY 319 static const int TGT_O_WRONLY = 000000001; //!< O_WRONLY 320 static const int TGT_O_RDWR = 000000002; //!< O_RDWR 321 static const int TGT_O_CREAT = 000000100; //!< O_CREAT 322 static const int TGT_O_EXCL = 000000200; //!< O_EXCL 323 static const int TGT_O_NOCTTY = 000000400; //!< O_NOCTTY 324 static const int TGT_O_TRUNC = 000001000; //!< O_TRUNC 325 static const int TGT_O_APPEND = 000002000; //!< O_APPEND 326 static const int TGT_O_NONBLOCK = 000004000; //!< O_NONBLOCK 327 static const int TGT_O_DSYNC = 000010000; //!< O_DSYNC 328 static const int TGT_FASYNC = 000020000; //!< FASYNC 329 static const int TGT_O_DIRECT = 000200000; //!< O_DIRECT 330 static const int TGT_O_LARGEFILE = 000400000; //!< O_LARGEFILE 331 static const int TGT_O_DIRECTORY = 000040000; //!< O_DIRECTORY 332 static const int TGT_O_NOFOLLOW = 000100000; //!< O_NOFOLLOW 333 static const int TGT_O_NOATIME = 001000000; //!< O_NOATIME 334 static const int TGT_O_CLOEXEC = 002000000; //!< O_NOATIME 335 static const int TGT_O_SYNC = 004010000; //!< O_SYNC 336 static const int TGT_O_PATH = 010000000; //!< O_PATH 337 //@} 338 339 /// For mmap(). 340 static SyscallFlagTransTable mmapFlagTable[]; 341 342 static const unsigned TGT_MAP_SHARED = 0x00001; 343 static const unsigned TGT_MAP_PRIVATE = 0x00002; 344 static const unsigned TGT_MAP_ANON = 0x00020; 345 static const unsigned TGT_MAP_DENYWRITE = 0x00800; 346 static const unsigned TGT_MAP_EXECUTABLE = 0x01000; 347 static const unsigned TGT_MAP_FILE = 0x00000; 348 static const unsigned TGT_MAP_GROWSDOWN = 0x00100; 349 static const unsigned TGT_MAP_HUGETLB = 0x40000; 350 static const unsigned TGT_MAP_LOCKED = 0x02000; 351 static const unsigned TGT_MAP_NONBLOCK = 0x10000; 352 static const unsigned TGT_MAP_NORESERVE = 0x04000; 353 static const unsigned TGT_MAP_POPULATE = 0x08000; 354 static const unsigned TGT_MAP_STACK = 0x20000; 355 static const unsigned TGT_MAP_ANONYMOUS = 0x00020; 356 static const unsigned TGT_MAP_FIXED = 0x00010; 357 358 static const unsigned NUM_MMAP_FLAGS; 359 360 //@{ 361 /// For getrusage(). 362 static const int TGT_RUSAGE_SELF = 0; 363 static const int TGT_RUSAGE_CHILDREN = -1; 364 static const int TGT_RUSAGE_BOTH = -2; 365 //@} 366 367 //@{ 368 /// ioctl() command codes. 369 static const unsigned TIOCGETP_ = 0x5401; 370 static const unsigned TIOCSETP_ = 0x80067409; 371 static const unsigned TIOCSETN_ = 0x8006740a; 372 static const unsigned TIOCSETC_ = 0x80067411; 373 static const unsigned TIOCGETC_ = 0x40067412; 374 static const unsigned FIONREAD_ = 0x4004667f; 375 static const unsigned TIOCISATTY_ = 0x2000745e; 376 static const unsigned TIOCGETS_ = 0x402c7413; 377 static const unsigned TIOCGETA_ = 0x5405; 378 static const unsigned TCSETAW_ = 0x5407; // 2.6.15 kernel 379 //@} 380 381 /// For table(). 382 static const int TBL_SYSINFO = 12; 383 384 /// Resource enumeration for getrlimit(). 385 enum rlimit_resources { 386 TGT_RLIMIT_CPU = 0, 387 TGT_RLIMIT_FSIZE = 1, 388 TGT_RLIMIT_DATA = 2, 389 TGT_RLIMIT_STACK = 3, 390 TGT_RLIMIT_CORE = 4, 391 TGT_RLIMIT_RSS = 5, 392 TGT_RLIMIT_NPROC = 6, 393 TGT_RLIMIT_NOFILE = 7, 394 TGT_RLIMIT_MEMLOCK = 8, 395 TGT_RLIMIT_AS = 9, 396 TGT_RLIMIT_LOCKS = 10 397 }; 398 399 /// Limit struct for getrlimit/setrlimit. 400 struct rlimit { 401 uint64_t rlim_cur; //!< soft limit 402 uint64_t rlim_max; //!< hard limit 403 }; 404 405 /// For gettimeofday(). 406 struct timeval { 407 int64_t tv_sec; //!< seconds 408 int64_t tv_usec; //!< microseconds 409 }; 410 411 struct timespec { 412 int64_t tv_sec; //!< seconds 413 int64_t tv_nsec; //!< nanoseconds 414 }; 415 416 // For writev/readv 417 struct tgt_iovec { 418 uint64_t iov_base; // void * 419 uint64_t iov_len; 420 }; 421 422 typedef struct { 423 uint64_t st_dev; 424 uint64_t st_ino; 425 uint64_t st_nlink; 426 uint32_t st_mode; 427 uint32_t st_uid; 428 uint32_t st_gid; 429 uint32_t __pad0; 430 uint64_t st_rdev; 431 uint64_t st_size; 432 uint64_t st_blksize; 433 uint64_t st_blocks; 434 uint64_t st_atimeX; 435 uint64_t st_atime_nsec; 436 uint64_t st_mtimeX; 437 uint64_t st_mtime_nsec; 438 uint64_t st_ctimeX; 439 uint64_t st_ctime_nsec; 440 } tgt_stat; 441 442 typedef struct { 443 uint64_t st_dev; 444 uint64_t st_ino; 445 uint32_t st_mode; 446 uint32_t st_nlink; 447 uint32_t st_uid; 448 uint32_t st_gid; 449 uint32_t __pad0; 450 uint64_t st_rdev; 451 uint64_t st_size; 452 uint64_t st_blksize; 453 uint64_t st_blocks; 454 uint64_t st_atimeX; 455 uint64_t st_atime_nsec; 456 uint64_t st_mtimeX; 457 uint64_t st_mtime_nsec; 458 uint64_t st_ctimeX; 459 uint64_t st_ctime_nsec; 460 } tgt_stat64; 461 462 typedef struct { 463 int64_t uptime; /* Seconds since boot */ 464 uint64_t loads[3]; /* 1, 5, and 15 minute load averages */ 465 uint64_t totalram; /* Total usable main memory size */ 466 uint64_t freeram; /* Available memory size */ 467 uint64_t sharedram; /* Amount of shared memory */ 468 uint64_t bufferram; /* Memory used by buffers */ 469 uint64_t totalswap; /* Total swap space size */ 470 uint64_t freeswap; /* swap space still available */ 471 uint16_t procs; /* Number of current processes */ 472 uint16_t pad; 473 uint64_t totalhigh; /* Total high memory size */ 474 uint64_t freehigh; /* Available high memory size */ 475 uint32_t mem_unit; /* Memory unit size in bytes */ 476 } tgt_sysinfo; 477 478 /// For getrusage(). 479 struct rusage { 480 struct timeval ru_utime; //!< user time used 481 struct timeval ru_stime; //!< system time used 482 int64_t ru_maxrss; //!< max rss 483 int64_t ru_ixrss; //!< integral shared memory size 484 int64_t ru_idrss; //!< integral unshared data " 485 int64_t ru_isrss; //!< integral unshared stack " 486 int64_t ru_minflt; //!< page reclaims - total vmfaults 487 int64_t ru_majflt; //!< page faults 488 int64_t ru_nswap; //!< swaps 489 int64_t ru_inblock; //!< block input operations 490 int64_t ru_oublock; //!< block output operations 491 int64_t ru_msgsnd; //!< messages sent 492 int64_t ru_msgrcv; //!< messages received 493 int64_t ru_nsignals; //!< signals received 494 int64_t ru_nvcsw; //!< voluntary context switches 495 int64_t ru_nivcsw; //!< involuntary " 496 }; 497 498 /// For times(). 499 struct tms { 500 int64_t tms_utime; //!< user time 501 int64_t tms_stime; //!< system time 502 int64_t tms_cutime; //!< user time of children 503 int64_t tms_cstime; //!< system time of children 504 }; 505}; 506 507#endif 508