root/compat/hpux/hpux.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


    1 /*      $OpenBSD: hpux.h,v 1.14 2004/09/19 22:03:16 mickey Exp $        */
    2 /*      $NetBSD: hpux.h,v 1.11 1997/04/01 19:58:58 scottr Exp $ */
    3 
    4 /*
    5  * Copyright (c) 1995 Jason R. Thorpe.  All rights reserved.
    6  * Copyright (c) 1988 University of Utah.
    7  * Copyright (c) 1990, 1993
    8  *      The Regents of the University of California.  All rights reserved.
    9  *
   10  * This code is derived from software contributed to Berkeley by
   11  * the Systems Programming Group of the University of Utah Computer
   12  * Science Department.
   13  *
   14  * Redistribution and use in source and binary forms, with or without
   15  * modification, are permitted provided that the following conditions
   16  * are met:
   17  * 1. Redistributions of source code must retain the above copyright
   18  *    notice, this list of conditions and the following disclaimer.
   19  * 2. Redistributions in binary form must reproduce the above copyright
   20  *    notice, this list of conditions and the following disclaimer in the
   21  *    documentation and/or other materials provided with the distribution.
   22  * 3. Neither the name of the University nor the names of its contributors
   23  *    may be used to endorse or promote products derived from this software
   24  *    without specific prior written permission.
   25  *
   26  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   27  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   28  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   29  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   30  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   31  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   32  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   33  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   34  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   35  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   36  * SUCH DAMAGE.
   37  *
   38  * from: Utah $Hdr: hpux.h 1.33 93/08/05$
   39  *
   40  *      @(#)hpux.h      8.4 (Berkeley) 2/13/94
   41  */
   42 
   43 #include <compat/hpux/hpux_exec.h>
   44 
   45 /* HP-UX style UTSNAME struct used by uname syscall */
   46 
   47 struct hpux_utsname {
   48         char    sysname[9];
   49         char    nodename[9];
   50         char    release[9];
   51         char    version[9];
   52         char    machine[9];
   53         char    idnumber[15];
   54 };
   55 
   56 /* HP-UX style "old" IOCTLs */
   57 
   58 struct hpux_sgttyb {
   59         char    sg_ispeed;
   60         char    sg_ospeed;
   61         char    sg_erase;
   62         char    sg_kill;
   63         int     sg_flags;       /* only a short in BSD */
   64 };
   65 
   66 #define V7_HUPCL        00001
   67 #define V7_XTABS        00002
   68 #define V7_NOAL         04000
   69 
   70 #define HPUXTIOCGETP    _IOR('t', 8, struct hpux_sgttyb)
   71 #define HPUXTIOCSETP    _IOW('t', 9, struct hpux_sgttyb)
   72 
   73 /* 6.5 job control related ioctls which need to be mapped */
   74 
   75 #define HPUXTIOCSLTC    _IOW('T', 23, struct ltchars)
   76 #define HPUXTIOCGLTC    _IOR('T', 24, struct ltchars)
   77 #define HPUXTIOCLBIS    _IOW('T', 25, int)
   78 #define HPUXTIOCLBIC    _IOW('T', 26, int)
   79 #define HPUXTIOCLSET    _IOW('T', 27, int)
   80 #define HPUXTIOCLGET    _IOR('T', 28, int)
   81 #       define HPUXLTOSTOP      0000001
   82 #define HPUXTIOCSPGRP   _IOW('T', 29, int)
   83 #define HPUXTIOCGPGRP   _IOR('T', 30, int)
   84 #define HPUXTIOCCONS    _IO('t', 104)
   85 #define HPUXTIOCSWINSZ  _IOW('t', 106, struct winsize)
   86 #define HPUXTIOCGWINSZ  _IOR('t', 107, struct winsize)
   87 
   88 /* non-blocking IO--doesn't interfere with O_NDELAY */
   89 #define HPUXFIOSNBIO    _IOW('f', 126, int)
   90 
   91 /* HP-UX stat structure */
   92 
   93 #define bsdtohpuxdev(d) ((major(d) << 24) | minor(d))
   94 
   95 struct  hpux_stat {
   96         int             hst_dev;
   97         u_int           hst_ino;
   98         u_short         hst_mode;
   99         short           hst_nlink;
  100         u_short         hst_old_uid;    /* these have since moved */
  101         u_short         hst_old_gid;    /* ... */
  102         int             hst_rdev;
  103         int             hst_size;
  104         int             hst_atime;
  105         int             hst_spare1;
  106         int             hst_mtime;
  107         int             hst_spare2;
  108         int             hst_ctime;
  109         int             hst_spare3;
  110         int             hst_blksize;
  111         int             hst_blocks;
  112         u_int           hst_remote;
  113         int             hst_netdev;
  114         u_int           hst_netino;
  115         u_short         hst_cnode;
  116         u_short         hst_rcnode;
  117         u_short         hst_netsite;
  118         short           hst_fstype;
  119         int             hst_realdev;
  120         u_short         hst_basemode;
  121         u_short         hst_spareshort1;
  122         int             hst_uid;
  123         int             hst_gid;
  124         int             hst_spare4[3];
  125 };
  126 
  127 struct  hpux_stat64 {
  128         int             hst_dev;
  129         u_quad_t        hst_ino;
  130         u_short         hst_mode;
  131         short           hst_nlink;
  132         u_short         hst_old_uid;    /* these have since moved */
  133         u_short         hst_old_gid;    /* ... */
  134         int             hst_rdev;
  135         quad_t          hst_size;
  136         quad_t          hst_atime;
  137         int             hst_spare1;
  138         quad_t          hst_mtime;
  139         int             hst_spare2;
  140         quad_t          hst_ctime;
  141         int             hst_spare3;
  142         quad_t          hst_blksize;
  143         quad_t          hst_blocks;
  144         u_int           hst_remote;
  145         int             hst_netdev;
  146         u_quad_t        hst_netino;
  147         u_short         hst_cnode;
  148         u_short         hst_rcnode;
  149         u_short         hst_netsite;
  150         short           hst_fstype;
  151         int             hst_realdev;
  152         u_short         hst_basemode;
  153         u_short         hst_spareshort1;
  154         int             hst_uid;
  155         int             hst_gid;
  156         int             hst_spare4[3];
  157 };
  158 
  159 #define HST_REMOTE_REMOTE       0x01    /* set if file is remote */
  160 #define HST_REMOTE_ACL          0x02    /* set if file has ACL entries */
  161 #define HST_REMOTE_ACLV         0x04    /* set if file has ACL v2 entries */
  162 
  163 /* from old timeb.h */
  164 struct hpux_otimeb {
  165         time_t  time;
  166         u_short millitm;
  167         short   timezone;
  168         short   dstflag;
  169 };
  170 
  171 /* ye ole stat structure */
  172 struct  hpux_ostat {
  173         u_short hst_dev;
  174         u_short hst_ino;
  175         u_short hst_mode;
  176         short   hst_nlink;
  177         short   hst_uid;
  178         short   hst_gid;
  179         u_short hst_rdev;
  180         int     hst_size;
  181         int     hst_atime;
  182         int     hst_mtime;
  183         int     hst_ctime;
  184 };
  185 
  186 /* HP-UX compat file flags */
  187 #define HPUXNDELAY      00000004
  188 #define HPUXFCREAT      00000400
  189 #define HPUXFTRUNC      00001000
  190 #define HPUXFEXCL       00002000
  191 #define HPUXFSYNCIO     00100000
  192 #define HPUXNONBLOCK    00200000
  193 #define HPUXFREMOTE     01000000
  194 
  195 /* HP-UX fcntl file locking */
  196 struct hpux_flock {
  197         short   hl_type;
  198         short   hl_whence;
  199         long    hl_start;
  200         long    hl_len;
  201         long    hl_pid;
  202 };
  203 
  204 #define HPUXF_GETLK     7
  205 #define HPUXF_SETLK     8
  206 #define HPUXF_SETLKW    9
  207 
  208 #define HPUXF_RDLCK     1
  209 #define HPUXF_WRLCK     2
  210 #define HPUXF_UNLCK     3
  211 
  212 /* HP-UX only sysV shmctl() commands */
  213 #define SHM_LOCK        3       /* Lock segment in core */
  214 #define SHM_UNLOCK      4       /* Unlock segment */
  215 
  216 /* SHM stuff reflecting POSIX types */
  217 struct hpux_ipc_perm {
  218         long    uid;    /* owner's user id */
  219         long    gid;    /* owner's group id */
  220         long    cuid;   /* creator's user id */
  221         long    cgid;   /* creator's group id */
  222         u_short mode;   /* access modes */
  223         u_short seq;    /* slot usage sequence number */
  224         long    key;    /* key */
  225 };
  226 
  227 struct hpux_shmid_ds {
  228         struct hpux_ipc_perm shm_perm;  /* operation permission struct */
  229         int             shm_segsz;      /* segment size (bytes) */
  230         struct pte      *shm_ptbl;      /* ptr to associated page table */
  231         long            shm_lpid;       /* pid of last shmop */
  232         long            shm_cpid;       /* pid of creator */
  233         u_short         shm_nattch;     /* current # attached */
  234         u_short         shm_cnattch;    /* in memory # attached */
  235         time_t          shm_atime;      /* last shmat time */
  236         time_t          shm_dtime;      /* last shmdt time */
  237         time_t          shm_ctime;      /* last change time */
  238         /* actually longer */
  239 };
  240 
  241 /* HP-UX rtprio values */
  242 #define RTPRIO_MIN      0
  243 #define RTPRIO_MAX      127
  244 #define RTPRIO_NOCHG    1000
  245 #define RTPRIO_RTOFF    1001
  246 
  247 /* HP-UX only sigvec sv_flags values */
  248 #define HPUXSV_RESET    000000004
  249 
  250 /*
  251  * HP-UX returns SIGILL instead of SIGFPE for the CHK and TRAPV exceptions.
  252  * It also returns different u_code values for certain illegal instruction
  253  * and floating point exceptions.  Here are the proper HP-UX u_code values
  254  * (numbers from hpux 6.2 manual pages).
  255  */
  256 
  257 /* SIGILL codes */
  258 #define HPUX_ILL_ILLINST_TRAP   0       /* T_ILLINST+USER */
  259 #define HPUX_ILL_CHK_TRAP       6       /* T_CHKINST+USER */
  260 #define HPUX_ILL_TRAPV_TRAP     7       /* T_TRAPVINST+USER */
  261 #define HPUX_ILL_PRIV_TRAP      8       /* T_PRIVINST+USER */
  262 
  263 /* SIGFPE codes */
  264 #define HPUX_FPE_INTDIV_TRAP    5       /* T_ZERODIV+USER */
  265 
  266 /* HP-UX POSIX signal stuff implementation */
  267 typedef struct __hpux_sigset_t { u_int sigset[8]; } hpux_sigset_t;
  268 struct hpux_sigaction {
  269         void            (*sa__handler)(int);
  270         hpux_sigset_t   sa_mask;
  271         int             sa_flags;
  272 };
  273 #define HPUXSA_ONSTACK          1
  274 #define HPUXSA_RESETHAND        4
  275 #define HPUXSA_NOCLDSTOP        8
  276 #define HPUXSA_NODEFER          32
  277 #define HPUXSA_RESTART          64
  278 #define HPUXSA_NOCLDWAIT        128
  279 
  280 #define HPUXSIG_BLOCK   0       /* block specified signal set */
  281 #define HPUXSIG_UNBLOCK 1       /* unblock specified signal set */
  282 #define HPUXSIG_SETMASK 2       /* set specified signal set */
  283 
  284 /* sysconf stuff */
  285 #define HPUX_SYSCONF_CLKTICK    2
  286 #define HPUX_SYSCONF_OPENMAX    4
  287 #define HPUX_SYSCONF_CPUTYPE    10001
  288 #define HPUX_SYSCONF_CPUM020    0x20C
  289 #define HPUX_SYSCONF_CPUM030    0x20D
  290 #define HPUX_SYSCONF_CPUM040    0x20E
  291 #define HPUX_SYSCONF_CPUPA10    0x20B
  292 #define HPUX_SYSCONF_CPUPA11    0x210
  293 #define HPUX_SYSCONF_CPUPA20    0x214
  294 
  295 /* mmap stuff */
  296 #define HPUXMAP_FIXED   0x04
  297 #define HPUXMAP_REPLACE 0x08
  298 #define HPUXMAP_ANON    0x10
  299 
  300 /* rlimit stuff */
  301 #define HPUXRLIMIT_NOFILE       6
  302 
  303 /*
  304  * In BSD EAGAIN and EWOULDBLOCK are the same error code.
  305  * However, for HP-UX we must split them out to separate codes.
  306  * The easiest way to do this was to check the return value of
  307  * BSD routines which are known to return EAGAIN (but never
  308  * EWOULDBLOCK) and change it to the pseudo-code OEAGAIN when
  309  * we see it.  The error translation table will them map that
  310  * code to the HP-UX EAGAIN value.
  311  */
  312 #define OEAGAIN 82
  313 
  314 /*
  315  * Extensions to the fd_ofileflags flags.
  316  */
  317 #define HPUX_UF_NONBLOCK_ON     0x10
  318 #define HPUX_UF_FNDELAY_ON      0x20
  319 #define HPUX_UF_FIONBIO_ON      0x40 
  320 
  321 #ifdef __m68k__
  322 /*
  323  * Skeletal 6.X HP-UX user structure info for ptrace() mapping.
  324  * Yes, this is as bogus as it gets...
  325  */
  326 
  327 /* 6.0/6.2 offsets */
  328 #define ooHU_AROFF      0x004
  329 #define ooHU_TSOFF      0x092
  330 #define ooHU_EDOFF      0x91E
  331 #define ooHU_FPOFF      0xA66
  332 
  333 /* 6.5 offsets */
  334 #define oHU_AROFF       0x004
  335 #define oHU_TSOFF       0x0B2
  336 #define oHU_EDOFF       0x93A
  337 #define oHU_FPOFF       0xA86
  338 
  339 /* 7.X offsets */
  340 #define HU_AROFF        0x004
  341 #define HU_TSOFF        0x0B4
  342 #define HU_EDOFF        0x8C8
  343 #define HU_FPOFF        0xA28
  344 
  345 #define HU_PAD1 (HU_AROFF)
  346 #define HU_PAD2 (HU_TSOFF-HU_AROFF-4)
  347 #define HU_PAD3 (HU_EDOFF-HU_TSOFF-12)
  348 #define HU_PAD4 (HU_FPOFF-HU_EDOFF-sizeof(struct hpux_exec))
  349 
  350 struct hpux_user {
  351         u_char  whocares1[HU_PAD1];     /* +0x000 */
  352         int     *hpuxu_ar0;             /* +0x004 */
  353         u_char  whocares2[HU_PAD2];     /* +0x008 */
  354         int     hpuxu_tsize;            /* +0x0B2 */
  355         int     hpuxu_dsize;            /* +0x0B6 */
  356         int     hpuxu_ssize;            /* +0x0BA */
  357         u_char  whocares3[HU_PAD3];     /* +0x0BE */
  358         struct  hpux_exec hpuxu_exdata; /* +0x93A */
  359         u_char  whocares4[HU_PAD4];     /* +0x95E */
  360         struct  hpux_fp {               /* +0xA66 */
  361                 int hpfp_save[54];
  362                 int hpfp_ctrl[3];
  363                 int hpfp_reg[24];
  364         } hpuxu_fp;
  365         short   hpuxu_dragon;           /* +0xBCA */
  366  };
  367 #endif

/* [<][>][^][v][top][bottom][index][help] */