gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
freebsd.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Ruslan Bukin <br@bsdpad.com>
3  * All rights reserved.
4  *
5  * This software was developed by the University of Cambridge Computer
6  * Laboratory as part of the CTSRD Project, with support from the UK Higher
7  * Education Innovation Fund (HEIF).
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions are
11  * met: redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer;
13  * redistributions in binary form must reproduce the above copyright
14  * notice, this list of conditions and the following disclaimer in the
15  * documentation and/or other materials provided with the distribution;
16  * neither the name of the copyright holders nor the names of its
17  * contributors may be used to endorse or promote products derived from
18  * this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef __FREEBSD_HH__
34 #define __FREEBSD_HH__
35 
36 #include <string>
37 
38 #include "base/types.hh"
39 #include "kern/operatingsystem.hh"
40 
41 class ThreadContext;
42 class Process;
43 
49 class FreeBSD : public OperatingSystem
50 {
51 
52  public:
53 
55  typedef uint64_t size_t;
57  typedef uint64_t off_t;
58  typedef int64_t time_t;
59  typedef int64_t clock_t;
60  typedef uint32_t uid_t;
61  typedef uint32_t gid_t;
63 
65  static const int M5_SC_CLK_TCK = 100;
66 
68  static const unsigned TGT_TIOCGETA = 0x402c7413;
70  static const unsigned TGT_TIOCSETA = 0x802c7414;
71  static const unsigned TGT_TIOCSETAW = 0x802c7415;
72  static const unsigned TGT_FIONREAD = 0x4004667f;
74 
79  static bool
80  isTtyReq(unsigned req)
81  {
82  switch (req) {
83  case TGT_TIOCGETA:
84  case TGT_TIOCSETA:
85  case TGT_TIOCSETAW:
86  case TGT_FIONREAD:
87  return true;
88  default:
89  return false;
90  }
91  }
92 
94  static const unsigned TGT_RLIMIT_CPU = 0;
95  static const unsigned TGT_RLIMIT_FSIZE = 1;
96  static const unsigned TGT_RLIMIT_DATA = 2;
97  static const unsigned TGT_RLIMIT_STACK = 3;
98  static const unsigned TGT_RLIMIT_CORE = 4;
99  static const unsigned TGT_RLIMIT_RSS = 5;
100  static const unsigned TGT_RLIMIT_MEMLOCK = 6;
101  static const unsigned TGT_RLIMIT_NPROC = 7;
102  static const unsigned TGT_RLIMIT_NOFILE = 8;
103  static const unsigned TGT_RLIMIT_SBSIZE = 9;
104  static const unsigned TGT_RLIMIT_VMEM = 10;
105  static const unsigned TGT_RLIMIT_AS = TGT_RLIMIT_VMEM;
106  static const unsigned TGT_RLIMIT_NPTS = 11;
107  static const unsigned TGT_RLIMIT_SWAP = 12;
108  static const unsigned TGT_RLIMIT_KQUEUES = 13;
109 
111  static const int TGT_RUSAGE_SELF = 0;
112  static const int TGT_RUSAGE_CHILDREN = -1;
113  static const int TGT_RUSAGE_THREAD = 1;
114 
115  // for *at syscalls
116  static const int TGT_AT_FDCWD = -100;
117 
118 }; // class FreeBSD
119 
120 #endif // __FREEBSD_HH__
static const unsigned TGT_RLIMIT_NPTS
Definition: freebsd.hh:106
static const unsigned TGT_RLIMIT_CORE
Definition: freebsd.hh:98
static const unsigned TGT_RLIMIT_KQUEUES
Definition: freebsd.hh:108
static bool isTtyReq(unsigned req)
Return true for the ioctl codes for which we return ENOTTY without printing a warning, since we know that ENOTTY is the correct thing to return (and not just a sign that we don't recognize the ioctl code.
Definition: freebsd.hh:80
This class encapsulates the types, structures, constants, functions, and syscall-number mappings spec...
static const unsigned TGT_RLIMIT_MEMLOCK
Definition: freebsd.hh:100
static const unsigned TGT_RLIMIT_DATA
Definition: freebsd.hh:96
static const int TGT_RUSAGE_THREAD
Definition: freebsd.hh:113
uint32_t gid_t
Definition: freebsd.hh:61
static const unsigned TGT_RLIMIT_STACK
Definition: freebsd.hh:97
static const unsigned TGT_RLIMIT_VMEM
Definition: freebsd.hh:104
ThreadContext is the external interface to all thread state for anything outside of the CPU...
static const int M5_SC_CLK_TCK
Clock ticks per second, for times().
Definition: freebsd.hh:65
static const int TGT_AT_FDCWD
Definition: freebsd.hh:116
static const unsigned TGT_RLIMIT_FSIZE
Definition: freebsd.hh:95
uint32_t uid_t
Definition: freebsd.hh:60
static const unsigned TGT_TIOCSETAW
Definition: freebsd.hh:71
int64_t time_t
Definition: freebsd.hh:58
static const unsigned TGT_RLIMIT_NPROC
Definition: freebsd.hh:101
static const unsigned TGT_FIONREAD
Definition: freebsd.hh:72
static const unsigned TGT_RLIMIT_SBSIZE
Definition: freebsd.hh:103
static const unsigned TGT_TIOCSETA
Definition: freebsd.hh:70
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,16,32,64}_t.
uint64_t off_t
Definition: freebsd.hh:57
static const unsigned TGT_RLIMIT_NOFILE
Definition: freebsd.hh:102
static const int TGT_RUSAGE_CHILDREN
Definition: freebsd.hh:112
uint64_t size_t
Basic FreeBSD types.
Definition: freebsd.hh:56
static const unsigned TGT_RLIMIT_CPU
Resource constants for getrlimit().
Definition: freebsd.hh:94
static const unsigned TGT_TIOCGETA
ioctl() command codes.
Definition: freebsd.hh:69
static const unsigned TGT_RLIMIT_SWAP
Definition: freebsd.hh:107
static const int TGT_RUSAGE_SELF
For getrusage().
Definition: freebsd.hh:111
static const unsigned TGT_RLIMIT_RSS
Definition: freebsd.hh:99
int64_t clock_t
Definition: freebsd.hh:59
static const unsigned TGT_RLIMIT_AS
Definition: freebsd.hh:105
This class encapsulates the types, structures, constants, functions, and syscall-number mappings spec...
Definition: freebsd.hh:49

Generated on Fri Jun 9 2017 13:03:38 for gem5 by doxygen 1.8.6