xref: /csrg-svn/sys/hp/hpux/hpux.h (revision 41486)
1 /*
2  * Copyright (c) 1988 University of Utah.
3  * Copyright (c) 1990 The Regents of the University of California.
4  * 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.15 89/09/25$
13  *
14  *	@(#)hpux.h	7.1 (Berkeley) 05/08/90
15  */
16 
17 #include "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 
60 /* HP-UX directory stuff */
61 
62 #define HPUXNSIZ	14
63 #define HPUXPSIZ	10
64 #define HPUXDSIZ	sizeof(struct hpuxdirect)
65 
66 struct hpuxdirect {
67 	u_long	hpuxd_ino;
68 	u_short hpuxd_reclen;
69 	u_short	hpuxd_namlen;
70 	char	hpuxd_name[HPUXNSIZ];
71 	char	hpuxd_pad[HPUXPSIZ];
72 };
73 
74 /* HP-UX stat structure */
75 
76 #define bsdtohpuxdev(d)	((major(d) << 24) | minor(d))
77 
78 struct	hpuxstat {
79 	long	hst_dev;
80 	u_long	hst_ino;
81 	u_short	hst_mode;
82 	short	hst_nlink;
83 	u_short	hst_uid;
84 	u_short	hst_gid;
85 	long	hst_rdev;
86 	off_t	hst_size;
87 	time_t	hst_atime;
88 	int	hst_spare1;
89 	time_t	hst_mtime;
90 	int	hst_spare2;
91 	time_t	hst_ctime;
92 	int	hst_spare3;
93 	long	hst_blksize;
94 	long	hst_blocks;
95 	u_int	hst_remote;
96 	long	hst_netdev;
97 	u_long	hst_netino;
98 	long	hst_spare4[9];
99 };
100 
101 /*
102  * Skeletal 6.X HP-UX user structure info for ptrace() mapping.
103  * Yes, this is as bogus as it gets...
104  */
105 
106 /* 6.0/6.2 offsets */
107 #define oHU_AROFF	0x004
108 #define oHU_TSOFF	0x092
109 #define oHU_EDOFF	0x91E
110 #define oHU_FPOFF	0xA66
111 
112 /* 6.5 offsets */
113 #define HU_AROFF	0x004
114 #define HU_TSOFF	0x0B2
115 #define HU_EDOFF	0x93A
116 #define HU_FPOFF	0xA86
117 
118 #define HU_PAD1	(HU_AROFF)
119 #define HU_PAD2	(HU_TSOFF-HU_AROFF-4)
120 #define HU_PAD3	(HU_EDOFF-HU_TSOFF-12)
121 #define HU_PAD4	(HU_FPOFF-HU_EDOFF-sizeof(struct hpux_exec))
122 
123 struct hpuxuser {
124 	u_char	whocares1[HU_PAD1];	/* +0x000 */
125 	int	*hpuxu_ar0;		/* +0x004 */
126 	u_char	whocares2[HU_PAD2];	/* +0x008 */
127 	int	hpuxu_tsize;		/* +0x0B2 */
128 	int	hpuxu_dsize;		/* +0x0B6 */
129 	int	hpuxu_ssize;		/* +0x0BA */
130 	u_char	whocares3[HU_PAD3];	/* +0x0BE */
131 	struct	hpux_exec hpuxu_exdata;	/* +0x93A */
132 	u_char	whocares4[HU_PAD4];	/* +0x95E */
133 	struct	hpuxfp {		/* +0xA66 */
134 		int hpfp_save[54];
135 		int hpfp_ctrl[3];
136 		int hpfp_reg[24];
137 	} hpuxu_fp;
138 	short	hpuxu_dragon;		/* +0xBCA */
139 };
140 
141 /* HP-UX compat file flags */
142 #define HPUXFCREAT	00000400
143 #define	HPUXFTRUNC	00001000
144 #define	HPUXFEXCL	00002000
145 #define HPUXFSYNCIO	00100000
146 #define HPUXFREMOTE	01000000
147 #define FUSECACHE	04000000
148 
149 /* HP-UX only sysV shmctl() commands */
150 #define SHM_LOCK	3	/* Lock segment in core */
151 #define SHM_UNLOCK	4	/* Unlock segment */
152 
153 /* HP-UX rtprio values */
154 #define RTPRIO_MIN	0
155 #define RTPRIO_MAX	127
156 #define RTPRIO_NOCHG	1000
157 #define RTPRIO_RTOFF	1001
158 
159 /* HP-UX only sigvec sv_flags values */
160 #define HPUXSV_RESET	000000004
161 
162 /*
163  * HP-UX returns SIGILL instead of SIGFPE for the CHK and TRAPV exceptions.
164  * It also returns different u_code values for certain illegal instruction
165  * and floating point exceptions.  Here are the proper HP-UX u_code values
166  * (numbers from hpux 6.2 manual pages).
167  */
168 
169 /* SIGILL codes */
170 #define	HPUX_ILL_ILLINST_TRAP	0	/* T_ILLINST+USER */
171 #define	HPUX_ILL_CHK_TRAP	6	/* T_CHKINST+USER */
172 #define	HPUX_ILL_TRAPV_TRAP	7	/* T_TRAPVINST+USER */
173 #define	HPUX_ILL_PRIV_TRAP	8	/* T_PRIVINST+USER */
174 
175 /* SIGFPE codes */
176 #define	HPUX_FPE_INTDIV_TRAP	5	/* T_ZERODIV+USER */
177