1 /* 2 * Copyright (c) 1988 University of Utah. 3 * Copyright (c) 1990, 1993 4 * The Regents of the University of California. All rights reserved. 5 * 6 * This code is derived from software contributed to Berkeley by 7 * the Systems Programming Group of the University of Utah Computer 8 * Science Department. 9 * 10 * %sccs.include.redist.c% 11 * 12 * from: Utah $Hdr: hpux.h 1.33 93/08/05$ 13 * 14 * @(#)hpux.h 8.3 (Berkeley) 11/16/93 15 */ 16 17 #include <hp/hpux/hpux_exec.h> 18 19 /* HP-UX style UTSNAME struct used by uname syscall */ 20 21 struct hpuxutsname { 22 char sysname[9]; 23 char nodename[9]; 24 char release[9]; 25 char version[9]; 26 char machine[9]; 27 char idnumber[15]; 28 }; 29 30 /* HP-UX style "old" IOCTLs */ 31 32 struct hpuxsgttyb { 33 char sg_ispeed; 34 char sg_ospeed; 35 char sg_erase; 36 char sg_kill; 37 int sg_flags; /* only a short in BSD */ 38 }; 39 40 #define V7_HUPCL 00001 41 #define V7_XTABS 00002 42 #define V7_NOAL 04000 43 44 #define HPUXTIOCGETP _IOR('t', 8, struct hpuxsgttyb) 45 #define HPUXTIOCSETP _IOW('t', 9, struct hpuxsgttyb) 46 47 /* 6.5 job control related ioctls which need to be mapped */ 48 49 #define HPUXTIOCSLTC _IOW('T', 23, struct ltchars) 50 #define HPUXTIOCGLTC _IOR('T', 24, struct ltchars) 51 #define HPUXTIOCLBIS _IOW('T', 25, int) 52 #define HPUXTIOCLBIC _IOW('T', 26, int) 53 #define HPUXTIOCLSET _IOW('T', 27, int) 54 #define HPUXTIOCLGET _IOR('T', 28, int) 55 # define HPUXLTOSTOP 0000001 56 #define HPUXTIOCSPGRP _IOW('T', 29, int) 57 #define HPUXTIOCGPGRP _IOR('T', 30, int) 58 #define HPUXTIOCCONS _IO('t', 104) 59 #define HPUXTIOCSWINSZ _IOW('t', 106, struct winsize) 60 #define HPUXTIOCGWINSZ _IOR('t', 107, struct winsize) 61 62 /* non-blocking IO--doesn't interfere with O_NDELAY */ 63 #define HPUXFIOSNBIO _IOW('f', 126, int) 64 65 /* HP-UX stat structure */ 66 67 #define bsdtohpuxdev(d) ((major(d) << 24) | minor(d)) 68 69 struct hpuxstat { 70 long hst_dev; 71 u_long hst_ino; 72 u_short hst_mode; 73 short hst_nlink; 74 u_short hst_uid; 75 u_short hst_gid; 76 long hst_rdev; 77 long hst_size; 78 time_t hst_atime; 79 int hst_spare1; 80 time_t hst_mtime; 81 int hst_spare2; 82 time_t hst_ctime; 83 int hst_spare3; 84 long hst_blksize; 85 long hst_blocks; 86 u_int hst_remote; 87 long hst_netdev; 88 u_long hst_netino; 89 long hst_spare4[9]; 90 }; 91 92 /* 93 * Skeletal 6.X HP-UX user structure info for ptrace() mapping. 94 * Yes, this is as bogus as it gets... 95 */ 96 97 /* 6.0/6.2 offsets */ 98 #define ooHU_AROFF 0x004 99 #define ooHU_TSOFF 0x092 100 #define ooHU_EDOFF 0x91E 101 #define ooHU_FPOFF 0xA66 102 103 /* 6.5 offsets */ 104 #define oHU_AROFF 0x004 105 #define oHU_TSOFF 0x0B2 106 #define oHU_EDOFF 0x93A 107 #define oHU_FPOFF 0xA86 108 109 /* 7.X offsets */ 110 #define HU_AROFF 0x004 111 #define HU_TSOFF 0x0B4 112 #define HU_EDOFF 0x8C8 113 #define HU_FPOFF 0xA28 114 115 #define HU_PAD1 (HU_AROFF) 116 #define HU_PAD2 (HU_TSOFF-HU_AROFF-4) 117 #define HU_PAD3 (HU_EDOFF-HU_TSOFF-12) 118 #define HU_PAD4 (HU_FPOFF-HU_EDOFF-sizeof(struct hpux_exec)) 119 120 struct hpuxuser { 121 u_char whocares1[HU_PAD1]; /* +0x000 */ 122 int *hpuxu_ar0; /* +0x004 */ 123 u_char whocares2[HU_PAD2]; /* +0x008 */ 124 int hpuxu_tsize; /* +0x0B2 */ 125 int hpuxu_dsize; /* +0x0B6 */ 126 int hpuxu_ssize; /* +0x0BA */ 127 u_char whocares3[HU_PAD3]; /* +0x0BE */ 128 struct hpux_exec hpuxu_exdata; /* +0x93A */ 129 u_char whocares4[HU_PAD4]; /* +0x95E */ 130 struct hpuxfp { /* +0xA66 */ 131 int hpfp_save[54]; 132 int hpfp_ctrl[3]; 133 int hpfp_reg[24]; 134 } hpuxu_fp; 135 short hpuxu_dragon; /* +0xBCA */ 136 }; 137 138 /* HP-UX compat file flags */ 139 #define HPUXNDELAY 00000004 140 #define HPUXFCREAT 00000400 141 #define HPUXFTRUNC 00001000 142 #define HPUXFEXCL 00002000 143 #define HPUXFSYNCIO 00100000 144 #define HPUXNONBLOCK 00200000 145 #define HPUXFREMOTE 01000000 146 147 /* HP-UX only sysV shmctl() commands */ 148 #define SHM_LOCK 3 /* Lock segment in core */ 149 #define SHM_UNLOCK 4 /* Unlock segment */ 150 151 /* SHM stuff reflecting POSIX types */ 152 struct hpuxipc_perm { 153 long uid; /* owner's user id */ 154 long gid; /* owner's group id */ 155 long cuid; /* creator's user id */ 156 long cgid; /* creator's group id */ 157 u_short mode; /* access modes */ 158 u_short seq; /* slot usage sequence number */ 159 long key; /* key */ 160 }; 161 162 struct hpuxshmid_ds { 163 struct hpuxipc_perm shm_perm; /* operation permission struct */ 164 int shm_segsz; /* segment size (bytes) */ 165 struct pte *shm_ptbl; /* ptr to associated page table */ 166 long shm_lpid; /* pid of last shmop */ 167 long shm_cpid; /* pid of creator */ 168 u_short shm_nattch; /* current # attached */ 169 u_short shm_cnattch; /* in memory # attached */ 170 time_t shm_atime; /* last shmat time */ 171 time_t shm_dtime; /* last shmdt time */ 172 time_t shm_ctime; /* last change time */ 173 /* actually longer */ 174 }; 175 176 /* HP-UX rtprio values */ 177 #define RTPRIO_MIN 0 178 #define RTPRIO_MAX 127 179 #define RTPRIO_NOCHG 1000 180 #define RTPRIO_RTOFF 1001 181 182 /* HP-UX only sigvec sv_flags values */ 183 #define HPUXSV_RESET 000000004 184 185 /* 186 * HP-UX returns SIGILL instead of SIGFPE for the CHK and TRAPV exceptions. 187 * It also returns different u_code values for certain illegal instruction 188 * and floating point exceptions. Here are the proper HP-UX u_code values 189 * (numbers from hpux 6.2 manual pages). 190 */ 191 192 /* SIGILL codes */ 193 #define HPUX_ILL_ILLINST_TRAP 0 /* T_ILLINST+USER */ 194 #define HPUX_ILL_CHK_TRAP 6 /* T_CHKINST+USER */ 195 #define HPUX_ILL_TRAPV_TRAP 7 /* T_TRAPVINST+USER */ 196 #define HPUX_ILL_PRIV_TRAP 8 /* T_PRIVINST+USER */ 197 198 /* SIGFPE codes */ 199 #define HPUX_FPE_INTDIV_TRAP 5 /* T_ZERODIV+USER */ 200 201 /* HP-UX POSIX signal stuff implementation */ 202 typedef struct __hpuxsigset_t { long sigset[8]; } hpuxsigset_t; 203 struct hpuxsigaction { 204 void (*sa_handler)(); 205 hpuxsigset_t sa_mask; 206 int sa_flags; 207 }; 208 #define HPUXSA_ONSTACK 1 209 #define HPUXSA_RESETHAND 4 210 #define HPUXSA_NOCLDSTOP 8 211 212 #define HPUXSIG_BLOCK 0 /* block specified signal set */ 213 #define HPUXSIG_UNBLOCK 1 /* unblock specified signal set */ 214 #define HPUXSIG_SETMASK 2 /* set specified signal set */ 215 216 /* sysconf stuff */ 217 #define HPUX_SYSCONF_CLKTICK 2 218 #define HPUX_SYSCONF_OPENMAX 4 219 #define HPUX_SYSCONF_CPUTYPE 10001 220 #define HPUX_SYSCONF_CPUM020 0x20C 221 #define HPUX_SYSCONF_CPUM030 0x20D 222 #define HPUX_SYSCONF_CPUM040 0x20E 223 #define HPUX_SYSCONF_CPUPA10 0x20B 224 #define HPUX_SYSCONF_CPUPA11 0x210 225 226 /* mmap stuff */ 227 #define HPUXMAP_FIXED 0x04 228 #define HPUXMAP_REPLACE 0x08 229 #define HPUXMAP_ANON 0x10 230 231 /* rlimit stuff */ 232 #define HPUXRLIMIT_NOFILE 6 233 234 /* 235 * In BSD EAGAIN and EWOULDBLOCK are the same error code. 236 * However, for HP-UX we must split them out to seperate codes. 237 * The easiest way to do this was to check the return value of 238 * BSD routines which are known to return EAGAIN (but never 239 * EWOULDBLOCK) and change it to the pseudo-code OEAGAIN when 240 * we see it. The error translation table will them map that 241 * code to the HP-UX EAGAIN value. 242 */ 243 #define OEAGAIN 82 244