gem5  v20.1.0.0
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__
FreeBSD::TGT_RUSAGE_THREAD
static const int TGT_RUSAGE_THREAD
Definition: freebsd.hh:113
FreeBSD::TGT_RLIMIT_CORE
static const unsigned TGT_RLIMIT_CORE
Definition: freebsd.hh:98
Process
Definition: process.hh:65
FreeBSD::TGT_TIOCSETAW
static const unsigned TGT_TIOCSETAW
Definition: freebsd.hh:71
FreeBSD::uid_t
uint32_t uid_t
Definition: freebsd.hh:60
OperatingSystem
This class encapsulates the types, structures, constants, functions, and syscall-number mappings spec...
Definition: operatingsystem.hh:52
FreeBSD::TGT_TIOCSETA
static const unsigned TGT_TIOCSETA
Definition: freebsd.hh:70
FreeBSD::TGT_RLIMIT_NPTS
static const unsigned TGT_RLIMIT_NPTS
Definition: freebsd.hh:106
FreeBSD::TGT_RLIMIT_KQUEUES
static const unsigned TGT_RLIMIT_KQUEUES
Definition: freebsd.hh:108
FreeBSD::TGT_TIOCGETA
static const unsigned TGT_TIOCGETA
ioctl() command codes.
Definition: freebsd.hh:69
FreeBSD::TGT_RLIMIT_SWAP
static const unsigned TGT_RLIMIT_SWAP
Definition: freebsd.hh:107
FreeBSD::TGT_RLIMIT_MEMLOCK
static const unsigned TGT_RLIMIT_MEMLOCK
Definition: freebsd.hh:100
ThreadContext
ThreadContext is the external interface to all thread state for anything outside of the CPU.
Definition: thread_context.hh:88
FreeBSD::TGT_RLIMIT_CPU
static const unsigned TGT_RLIMIT_CPU
Resource constants for getrlimit().
Definition: freebsd.hh:94
operatingsystem.hh
FreeBSD::M5_SC_CLK_TCK
static const int M5_SC_CLK_TCK
Clock ticks per second, for times().
Definition: freebsd.hh:65
FreeBSD::clock_t
int64_t clock_t
Definition: freebsd.hh:59
FreeBSD::TGT_RLIMIT_FSIZE
static const unsigned TGT_RLIMIT_FSIZE
Definition: freebsd.hh:95
FreeBSD::TGT_RLIMIT_VMEM
static const unsigned TGT_RLIMIT_VMEM
Definition: freebsd.hh:104
FreeBSD::TGT_RLIMIT_DATA
static const unsigned TGT_RLIMIT_DATA
Definition: freebsd.hh:96
FreeBSD::off_t
uint64_t off_t
Definition: freebsd.hh:57
types.hh
FreeBSD::TGT_RLIMIT_NOFILE
static const unsigned TGT_RLIMIT_NOFILE
Definition: freebsd.hh:102
FreeBSD::TGT_RLIMIT_SBSIZE
static const unsigned TGT_RLIMIT_SBSIZE
Definition: freebsd.hh:103
FreeBSD::TGT_RUSAGE_CHILDREN
static const int TGT_RUSAGE_CHILDREN
Definition: freebsd.hh:112
FreeBSD::TGT_RLIMIT_STACK
static const unsigned TGT_RLIMIT_STACK
Definition: freebsd.hh:97
FreeBSD::size_t
uint64_t size_t
Basic FreeBSD types.
Definition: freebsd.hh:56
FreeBSD
Definition: threadinfo.hh:39
FreeBSD::TGT_RLIMIT_AS
static const unsigned TGT_RLIMIT_AS
Definition: freebsd.hh:105
FreeBSD::time_t
int64_t time_t
Definition: freebsd.hh:58
FreeBSD::isTtyReq
static bool isTtyReq(unsigned req)
Return true for the ioctl codes for which we return ENOTTY without printing a warning,...
Definition: freebsd.hh:80
FreeBSD::gid_t
uint32_t gid_t
Definition: freebsd.hh:61
FreeBSD::TGT_RLIMIT_NPROC
static const unsigned TGT_RLIMIT_NPROC
Definition: freebsd.hh:101
FreeBSD::TGT_FIONREAD
static const unsigned TGT_FIONREAD
Definition: freebsd.hh:72
FreeBSD::TGT_RUSAGE_SELF
static const int TGT_RUSAGE_SELF
For getrusage().
Definition: freebsd.hh:111
FreeBSD::TGT_RLIMIT_RSS
static const unsigned TGT_RLIMIT_RSS
Definition: freebsd.hh:99
FreeBSD::TGT_AT_FDCWD
static const int TGT_AT_FDCWD
Definition: freebsd.hh:116

Generated on Wed Sep 30 2020 14:01:59 for gem5 by doxygen 1.8.17