solaris.hh revision 5543
1/*
2 * Copyright (c) 2004-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
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.
15 *
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.
27 *
28 * Authors: Ali Saidi
29 */
30
31#ifndef __SOLARIS_HH__
32#define __SOLARIS_HH__
33#include "config/full_system.hh"
34
35#if FULL_SYSTEM
36
37class Solaris {};
38
39#else //!FULL_SYSTEM
40
41#include <inttypes.h>
42
43#include "kern/operatingsystem.hh"
44
45class TranslatingPort;
46
47///
48/// This class encapsulates the types, structures, constants,
49/// functions, and syscall-number mappings specific to the Solaris
50/// syscall interface.
51///
52class Solaris : public OperatingSystem
53{
54
55  public:
56
57    //@{
58    /// Basic Solaris types.
59    typedef uint64_t size_t;
60    typedef uint64_t off_t;
61    typedef int64_t time_t;
62    typedef int32_t uid_t;
63    typedef int32_t gid_t;
64    typedef uint64_t rlim_t;
65    typedef uint64_t ino_t;
66    typedef uint64_t dev_t;
67    typedef uint32_t mode_t;
68    typedef uint32_t nlink_t;
69    //@}
70
71    struct tgt_timespec {
72        int64_t tv_sec;
73        int64_t tv_nsec;
74    };
75
76    /// Stat buffer.  Note that we can't call it 'stat' since that
77    /// gets #defined to something else on some systems.
78    typedef struct {
79        uint64_t        st_dev;         //!< device
80        uint64_t        st_ino;         //!< inode
81        uint32_t        st_mode;        //!< mode
82        uint32_t        st_nlink;       //!< link count
83        int32_t         st_uid;         //!< owner's user ID
84        int32_t         st_gid;         //!< owner's group ID
85        uint64_t        st_rdev;        //!< device number
86        int64_t         st_size;        //!< file size in bytes
87        //struct tgt_timespec   st_atimeX;      //!< time of last access
88        //struct tgt_timespec   st_mtimeX;      //!< time of last modification
89        //struct tgt_timespec   st_ctimeX;      //!< time of last status change
90        int64_t st_atimeX, st_mtimeX, st_ctimeX;
91        int32_t         st_blksize;     //!< optimal I/O block size
92        int64_t         st_blocks;      //!< number of blocks allocated
93        char            st_fstype[16];
94    } tgt_stat;
95
96    // same for stat64
97    typedef struct {
98        uint64_t        st_dev;         //!< device
99        uint64_t        st_ino;         //!< inode
100        uint32_t        st_mode;        //!< mode
101        uint32_t        st_nlink;       //!< link count
102        int32_t         st_uid;         //!< owner's user ID
103        int32_t         st_gid;         //!< owner's group ID
104        uint64_t        st_rdev;        //!< device number
105        int64_t         st_size;        //!< file size in bytes
106        //struct tgt_timespec   st_atimeX;      //!< time of last access
107        //struct tgt_timespec   st_mtimeX;      //!< time of last modification
108        //struct tgt_timespec   st_ctimeX;      //!< time of last status change
109        int64_t st_atimeX, st_mtimeX, st_ctimeX;
110        int32_t         st_blksize;     //!< optimal I/O block size
111        int64_t         st_blocks;      //!< number of blocks allocated
112        char            st_fstype[16];
113    } tgt_stat64;
114
115    /// Length of strings in struct utsname (plus 1 for null char).
116    static const int _SYS_NMLN = 257;
117
118    /// Interface struct for uname().
119    typedef struct utsname {
120        char sysname[_SYS_NMLN];        //!< System name.
121        char nodename[_SYS_NMLN];       //!< Node name.
122        char release[_SYS_NMLN];        //!< OS release.
123        char version[_SYS_NMLN];        //!< OS version.
124        char machine[_SYS_NMLN];        //!< Machine type.
125    } utsname;
126
127};  // class Solaris
128
129
130#endif // FULL_SYSTEM
131
132#endif // __SOLARIS_HH__
133