2 * Copyright (c) 2004-2005 The Regents of The University of Michigan
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 #include "config/full_system.hh"
43 #include "kern/operatingsystem.hh"
46 /// This class encapsulates the types, structures, constants,
47 /// functions, and syscall-number mappings specific to the Alpha Linux
48 /// syscall interface.
50 class Linux : public OperatingSystem
56 /// Basic Linux types.
57 typedef uint64_t size_t;
58 typedef uint64_t off_t;
59 typedef int64_t time_t;
60 typedef uint32_t uid_t;
61 typedef uint32_t gid_t;
64 /// Stat buffer. Note that we can't call it 'stat' since that
65 /// gets #defined to something else on some systems. This type
66 /// can be specialized by architecture specific "Linux" classes
68 uint32_t st_dev; //!< device
69 uint32_t st_ino; //!< inode
70 uint32_t st_mode; //!< mode
71 uint32_t st_nlink; //!< link count
72 uint32_t st_uid; //!< owner's user ID
73 uint32_t st_gid; //!< owner's group ID
74 uint32_t st_rdev; //!< device number
75 int32_t _pad1; //!< for alignment
76 int64_t st_size; //!< file size in bytes
77 uint64_t st_atimeX; //!< time of last access
78 uint64_t st_mtimeX; //!< time of last modification
79 uint64_t st_ctimeX; //!< time of last status change
80 uint32_t st_blksize; //!< optimal I/O block size
81 int32_t st_blocks; //!< number of blocks allocated
82 uint32_t st_flags; //!< flags
83 uint32_t st_gen; //!< unknown
102 uint64_t st_atime_nsec;
104 uint64_t st_mtime_nsec;
106 uint64_t st_ctime_nsec;
107 int64_t ___unused[3];
110 /// Length of strings in struct utsname (plus 1 for null char).
111 static const int _SYS_NMLN = 65;
113 /// Interface struct for uname().
115 char sysname[_SYS_NMLN]; //!< System name.
116 char nodename[_SYS_NMLN]; //!< Node name.
117 char release[_SYS_NMLN]; //!< OS release.
118 char version[_SYS_NMLN]; //!< OS version.
119 char machine[_SYS_NMLN]; //!< Machine type.
122 /// Limit struct for getrlimit/setrlimit.
124 uint64_t rlim_cur; //!< soft limit
125 uint64_t rlim_max; //!< hard limit
128 /// For gettimeofday().
130 int64_t tv_sec; //!< seconds
131 int64_t tv_usec; //!< microseconds
136 uint64_t iov_base; // void *
143 struct timeval ru_utime; //!< user time used
144 struct timeval ru_stime; //!< system time used
145 int64_t ru_maxrss; //!< max rss
146 int64_t ru_ixrss; //!< integral shared memory size
147 int64_t ru_idrss; //!< integral unshared data "
148 int64_t ru_isrss; //!< integral unshared stack "
149 int64_t ru_minflt; //!< page reclaims - total vmfaults
150 int64_t ru_majflt; //!< page faults
151 int64_t ru_nswap; //!< swaps
152 int64_t ru_inblock; //!< block input operations
153 int64_t ru_oublock; //!< block output operations
154 int64_t ru_msgsnd; //!< messages sent
155 int64_t ru_msgrcv; //!< messages received
156 int64_t ru_nsignals; //!< signals received
157 int64_t ru_nvcsw; //!< voluntary context switches
158 int64_t ru_nivcsw; //!< involuntary "
164 #endif // FULL_SYSTEM
166 #endif // __LINUX_HH__