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