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