12600SN/A/*
22600SN/A * Copyright (c) 2004-2005 The Regents of The University of Michigan
32600SN/A * All rights reserved.
42600SN/A *
52600SN/A * Redistribution and use in source and binary forms, with or without
62600SN/A * modification, are permitted provided that the following conditions are
72600SN/A * met: redistributions of source code must retain the above copyright
82600SN/A * notice, this list of conditions and the following disclaimer;
92600SN/A * redistributions in binary form must reproduce the above copyright
102600SN/A * notice, this list of conditions and the following disclaimer in the
112600SN/A * documentation and/or other materials provided with the distribution;
122600SN/A * neither the name of the copyright holders nor the names of its
132600SN/A * contributors may be used to endorse or promote products derived from
142600SN/A * this software without specific prior written permission.
152600SN/A *
162600SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172600SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182600SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192600SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202600SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212600SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222600SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232600SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242600SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252600SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262600SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272665Ssaidi@eecs.umich.edu *
282665Ssaidi@eecs.umich.edu * Authors: Ali Saidi
292600SN/A */
302600SN/A
312600SN/A#ifndef __SOLARIS_HH__
322600SN/A#define __SOLARIS_HH__
336215Snate@binkert.org
346215Snate@binkert.org#include "base/types.hh"
353113Sgblack@eecs.umich.edu#include "kern/operatingsystem.hh"
362600SN/A
372600SN/A///
382600SN/A/// This class encapsulates the types, structures, constants,
392600SN/A/// functions, and syscall-number mappings specific to the Solaris
402600SN/A/// syscall interface.
412600SN/A///
423113Sgblack@eecs.umich.educlass Solaris : public OperatingSystem
433113Sgblack@eecs.umich.edu{
442600SN/A
452600SN/A  public:
462600SN/A
472600SN/A    //@{
482600SN/A    /// Basic Solaris types.
493122Sgblack@eecs.umich.edu    typedef uint64_t size_t;
502600SN/A    typedef uint64_t off_t;
512600SN/A    typedef int64_t time_t;
522600SN/A    typedef int32_t uid_t;
532600SN/A    typedef int32_t gid_t;
542600SN/A    typedef uint64_t rlim_t;
552600SN/A    typedef uint64_t ino_t;
562600SN/A    typedef uint64_t dev_t;
572600SN/A    typedef uint32_t mode_t;
583122Sgblack@eecs.umich.edu    typedef uint32_t nlink_t;
592600SN/A    //@}
602600SN/A
612600SN/A    struct tgt_timespec {
622600SN/A        int64_t tv_sec;
632600SN/A        int64_t tv_nsec;
642600SN/A    };
652600SN/A
662600SN/A    /// Stat buffer.  Note that we can't call it 'stat' since that
672600SN/A    /// gets #defined to something else on some systems.
683113Sgblack@eecs.umich.edu    typedef struct {
695543Ssaidi@eecs.umich.edu        uint64_t        st_dev;         //!< device
705543Ssaidi@eecs.umich.edu        uint64_t        st_ino;         //!< inode
715543Ssaidi@eecs.umich.edu        uint32_t        st_mode;        //!< mode
725543Ssaidi@eecs.umich.edu        uint32_t        st_nlink;       //!< link count
735543Ssaidi@eecs.umich.edu        int32_t         st_uid;         //!< owner's user ID
745543Ssaidi@eecs.umich.edu        int32_t         st_gid;         //!< owner's group ID
755543Ssaidi@eecs.umich.edu        uint64_t        st_rdev;        //!< device number
765543Ssaidi@eecs.umich.edu        int64_t         st_size;        //!< file size in bytes
775543Ssaidi@eecs.umich.edu        //struct tgt_timespec   st_atimeX;      //!< time of last access
785543Ssaidi@eecs.umich.edu        //struct tgt_timespec   st_mtimeX;      //!< time of last modification
795543Ssaidi@eecs.umich.edu        //struct tgt_timespec   st_ctimeX;      //!< time of last status change
803113Sgblack@eecs.umich.edu        int64_t st_atimeX, st_mtimeX, st_ctimeX;
815543Ssaidi@eecs.umich.edu        int32_t         st_blksize;     //!< optimal I/O block size
825543Ssaidi@eecs.umich.edu        int64_t         st_blocks;      //!< number of blocks allocated
832600SN/A        char            st_fstype[16];
843113Sgblack@eecs.umich.edu    } tgt_stat;
852600SN/A
862600SN/A    // same for stat64
873113Sgblack@eecs.umich.edu    typedef struct {
885543Ssaidi@eecs.umich.edu        uint64_t        st_dev;         //!< device
895543Ssaidi@eecs.umich.edu        uint64_t        st_ino;         //!< inode
905543Ssaidi@eecs.umich.edu        uint32_t        st_mode;        //!< mode
915543Ssaidi@eecs.umich.edu        uint32_t        st_nlink;       //!< link count
925543Ssaidi@eecs.umich.edu        int32_t         st_uid;         //!< owner's user ID
935543Ssaidi@eecs.umich.edu        int32_t         st_gid;         //!< owner's group ID
945543Ssaidi@eecs.umich.edu        uint64_t        st_rdev;        //!< device number
955543Ssaidi@eecs.umich.edu        int64_t         st_size;        //!< file size in bytes
965543Ssaidi@eecs.umich.edu        //struct tgt_timespec   st_atimeX;      //!< time of last access
975543Ssaidi@eecs.umich.edu        //struct tgt_timespec   st_mtimeX;      //!< time of last modification
985543Ssaidi@eecs.umich.edu        //struct tgt_timespec   st_ctimeX;      //!< time of last status change
993113Sgblack@eecs.umich.edu        int64_t st_atimeX, st_mtimeX, st_ctimeX;
1005543Ssaidi@eecs.umich.edu        int32_t         st_blksize;     //!< optimal I/O block size
1015543Ssaidi@eecs.umich.edu        int64_t         st_blocks;      //!< number of blocks allocated
1022600SN/A        char            st_fstype[16];
1033113Sgblack@eecs.umich.edu    } tgt_stat64;
1042600SN/A
1052600SN/A    /// Length of strings in struct utsname (plus 1 for null char).
1062600SN/A    static const int _SYS_NMLN = 257;
1072600SN/A
1082600SN/A    /// Interface struct for uname().
1093113Sgblack@eecs.umich.edu    typedef struct utsname {
1105543Ssaidi@eecs.umich.edu        char sysname[_SYS_NMLN];        //!< System name.
1115543Ssaidi@eecs.umich.edu        char nodename[_SYS_NMLN];       //!< Node name.
1125543Ssaidi@eecs.umich.edu        char release[_SYS_NMLN];        //!< OS release.
1135543Ssaidi@eecs.umich.edu        char version[_SYS_NMLN];        //!< OS version.
1145543Ssaidi@eecs.umich.edu        char machine[_SYS_NMLN];        //!< Machine type.
1153113Sgblack@eecs.umich.edu    } utsname;
1162600SN/A
11711907SBrandon.Potter@amd.com    // for *at syscalls
11811907SBrandon.Potter@amd.com    static const int TGT_AT_FDCWD   = -100;
11911907SBrandon.Potter@amd.com
1202600SN/A};  // class Solaris
1212600SN/A
1222600SN/A#endif // __SOLARIS_HH__
123