solaris.hh revision 6215
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" 352600SN/A#include "config/full_system.hh" 362600SN/A 372600SN/A#if FULL_SYSTEM 382600SN/A 392600SN/Aclass Solaris {}; 402600SN/A 412600SN/A#else //!FULL_SYSTEM 422600SN/A 433113Sgblack@eecs.umich.edu#include "kern/operatingsystem.hh" 442600SN/A 452600SN/Aclass TranslatingPort; 462600SN/A 472600SN/A/// 482600SN/A/// This class encapsulates the types, structures, constants, 492600SN/A/// functions, and syscall-number mappings specific to the Solaris 502600SN/A/// syscall interface. 512600SN/A/// 523113Sgblack@eecs.umich.educlass Solaris : public OperatingSystem 533113Sgblack@eecs.umich.edu{ 542600SN/A 552600SN/A public: 562600SN/A 572600SN/A //@{ 582600SN/A /// Basic Solaris types. 593122Sgblack@eecs.umich.edu typedef uint64_t size_t; 602600SN/A typedef uint64_t off_t; 612600SN/A typedef int64_t time_t; 622600SN/A typedef int32_t uid_t; 632600SN/A typedef int32_t gid_t; 642600SN/A typedef uint64_t rlim_t; 652600SN/A typedef uint64_t ino_t; 662600SN/A typedef uint64_t dev_t; 672600SN/A typedef uint32_t mode_t; 683122Sgblack@eecs.umich.edu typedef uint32_t nlink_t; 692600SN/A //@} 702600SN/A 712600SN/A struct tgt_timespec { 722600SN/A int64_t tv_sec; 732600SN/A int64_t tv_nsec; 742600SN/A }; 752600SN/A 762600SN/A /// Stat buffer. Note that we can't call it 'stat' since that 772600SN/A /// gets #defined to something else on some systems. 783113Sgblack@eecs.umich.edu typedef struct { 795543Ssaidi@eecs.umich.edu uint64_t st_dev; //!< device 805543Ssaidi@eecs.umich.edu uint64_t st_ino; //!< inode 815543Ssaidi@eecs.umich.edu uint32_t st_mode; //!< mode 825543Ssaidi@eecs.umich.edu uint32_t st_nlink; //!< link count 835543Ssaidi@eecs.umich.edu int32_t st_uid; //!< owner's user ID 845543Ssaidi@eecs.umich.edu int32_t st_gid; //!< owner's group ID 855543Ssaidi@eecs.umich.edu uint64_t st_rdev; //!< device number 865543Ssaidi@eecs.umich.edu int64_t st_size; //!< file size in bytes 875543Ssaidi@eecs.umich.edu //struct tgt_timespec st_atimeX; //!< time of last access 885543Ssaidi@eecs.umich.edu //struct tgt_timespec st_mtimeX; //!< time of last modification 895543Ssaidi@eecs.umich.edu //struct tgt_timespec st_ctimeX; //!< time of last status change 903113Sgblack@eecs.umich.edu int64_t st_atimeX, st_mtimeX, st_ctimeX; 915543Ssaidi@eecs.umich.edu int32_t st_blksize; //!< optimal I/O block size 925543Ssaidi@eecs.umich.edu int64_t st_blocks; //!< number of blocks allocated 932600SN/A char st_fstype[16]; 943113Sgblack@eecs.umich.edu } tgt_stat; 952600SN/A 962600SN/A // same for stat64 973113Sgblack@eecs.umich.edu typedef struct { 985543Ssaidi@eecs.umich.edu uint64_t st_dev; //!< device 995543Ssaidi@eecs.umich.edu uint64_t st_ino; //!< inode 1005543Ssaidi@eecs.umich.edu uint32_t st_mode; //!< mode 1015543Ssaidi@eecs.umich.edu uint32_t st_nlink; //!< link count 1025543Ssaidi@eecs.umich.edu int32_t st_uid; //!< owner's user ID 1035543Ssaidi@eecs.umich.edu int32_t st_gid; //!< owner's group ID 1045543Ssaidi@eecs.umich.edu uint64_t st_rdev; //!< device number 1055543Ssaidi@eecs.umich.edu int64_t st_size; //!< file size in bytes 1065543Ssaidi@eecs.umich.edu //struct tgt_timespec st_atimeX; //!< time of last access 1075543Ssaidi@eecs.umich.edu //struct tgt_timespec st_mtimeX; //!< time of last modification 1085543Ssaidi@eecs.umich.edu //struct tgt_timespec st_ctimeX; //!< time of last status change 1093113Sgblack@eecs.umich.edu int64_t st_atimeX, st_mtimeX, st_ctimeX; 1105543Ssaidi@eecs.umich.edu int32_t st_blksize; //!< optimal I/O block size 1115543Ssaidi@eecs.umich.edu int64_t st_blocks; //!< number of blocks allocated 1122600SN/A char st_fstype[16]; 1133113Sgblack@eecs.umich.edu } tgt_stat64; 1142600SN/A 1152600SN/A /// Length of strings in struct utsname (plus 1 for null char). 1162600SN/A static const int _SYS_NMLN = 257; 1172600SN/A 1182600SN/A /// Interface struct for uname(). 1193113Sgblack@eecs.umich.edu typedef struct utsname { 1205543Ssaidi@eecs.umich.edu char sysname[_SYS_NMLN]; //!< System name. 1215543Ssaidi@eecs.umich.edu char nodename[_SYS_NMLN]; //!< Node name. 1225543Ssaidi@eecs.umich.edu char release[_SYS_NMLN]; //!< OS release. 1235543Ssaidi@eecs.umich.edu char version[_SYS_NMLN]; //!< OS version. 1245543Ssaidi@eecs.umich.edu char machine[_SYS_NMLN]; //!< Machine type. 1253113Sgblack@eecs.umich.edu } utsname; 1262600SN/A 1272600SN/A}; // class Solaris 1282600SN/A 1292600SN/A 1302600SN/A#endif // FULL_SYSTEM 1312600SN/A 1322600SN/A#endif // __SOLARIS_HH__ 133