sh.types.h revision 100616
1/* $Header: /src/pub/tcsh/sh.types.h,v 3.39 2002/03/08 17:36:47 christos Exp $ */
2/* sh.types.h: Do the necessary typedefs for each system.
3 *             Up till now I avoided making this into a separate file
4 *	       But I just wanted to eliminate the whole mess from sh.h
5 *	       In reality this should not be here! It is OS and MACHINE
6 *	       dependent, even between different revisions of OS's...
7 *	       Ideally there should be a way in c, to find out if something
8 *	       was typedef'ed, but unfortunately we rely in cpp kludges.
9 *	       Someday, this file will be removed...
10 *
11 *						christos
12 */
13/*-
14 * Copyright (c) 1980, 1991 The Regents of the University of California.
15 * All rights reserved.
16 *
17 * Redistribution and use in source and binary forms, with or without
18 * modification, are permitted provided that the following conditions
19 * are met:
20 * 1. Redistributions of source code must retain the above copyright
21 *    notice, this list of conditions and the following disclaimer.
22 * 2. Redistributions in binary form must reproduce the above copyright
23 *    notice, this list of conditions and the following disclaimer in the
24 *    documentation and/or other materials provided with the distribution.
25 * 3. Neither the name of the University nor the names of its contributors
26 *    may be used to endorse or promote products derived from this software
27 *    without specific prior written permission.
28 *
29 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
30 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
33 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
38 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39 * SUCH DAMAGE.
40 */
41#ifndef _h_sh_types
42#define _h_sh_types
43
44
45/***
46 *** LynxOS 2.1
47 ***/
48#ifdef Lynx
49# ifndef _SIGMASK_T
50#  define _SIGMASK_T
51    typedef long sigmask_t;
52# endif /* _SIGMASK_T */
53# ifndef _PID_T
54#  define _PID_T
55# endif /* _PID_T */
56#endif
57
58/***
59 *** MachTen
60 ***/
61#ifdef __MACHTEN__
62# ifndef _PID_T
63#  define _PID_T
64# endif
65#endif
66
67
68/***
69 *** Suns running sunos3.x - sunos4.1.x
70 ***/
71#if (defined(sun) || defined(__sun__)) && SYSVREL == 0
72/* This used to be long, but lint dissagrees... */
73# ifndef _SIGMASK_T
74#  define _SIGMASK_T
75    typedef int sigmask_t;
76# endif /* _SIGMASK_T */
77# ifndef _PTR_T
78#  define _PTR_T
79#   ifdef __GNUC__
80    typedef void * ptr_t;
81#   else
82    typedef char * ptr_t;
83#   endif /* __GNUC__ */
84# endif /* _PTR_T */
85# ifndef _SIZE_T
86#  define _SIZE_T
87# endif /* _SIZE_T */
88# ifndef __sys_stdtypes_h
89#  define __sys_stdtypes_h
90#   ifndef __lucid
91     typedef int pid_t;
92     typedef unsigned int speed_t;
93#   endif
94# endif /* __sys_stdtypes.h */
95# ifndef _PID_T
96#  define _PID_T
97# endif /* _PID_T */
98# ifndef _SPEED_T
99#  define _SPEED_T
100# endif /* _SPEED_T */
101# ifndef SUNOS4
102#  ifndef MACH
103#   ifndef _UID_T
104#    define _UID_T
105      typedef int uid_t;
106#   endif /* _UID_T */
107#   ifndef _GID_T
108#    define _GID_T
109      typedef int gid_t;
110#   endif /* _GID_T */
111#  endif /* !MACH */
112# endif /* !SUNOS4 */
113#endif /* (sun || __sun__) && SYSVREL == 0 */
114
115
116/***
117 *** Hp's running hpux 7.0 or 8.0
118 ***/
119#ifdef __hpux
120# ifndef _SIZE_T
121#  define _SIZE_T
122    typedef unsigned int size_t;
123# endif /* _SIZE_T */
124
125# ifndef _PTR_T
126#  define _PTR_T
127    typedef void * ptr_t;
128# endif /* _PTR_T */
129
130# ifndef _PID_T
131#  define _PID_T
132    typedef long pid_t;
133# endif /* _PID_T */
134
135# ifndef _SIGMASK_T
136#  define _SIGMASK_T
137    typedef long sigmask_t;
138# endif /* _SIGMASK_T */
139
140# ifndef _SPEED_T
141   /* I thought POSIX was supposed to protect all typedefs! */
142#  define _SPEED_T
143# endif /* _SPEED_T */
144
145extern uid_t getuid(), geteuid();
146extern gid_t getgid(), getegid();
147extern sigmask_t sigblock();
148extern sigmask_t sigsetmask();
149extern pid_t getpid();
150extern pid_t fork();
151extern void perror();
152extern void _exit();
153extern void abort();
154extern void qsort();
155extern void free();
156extern unsigned int alarm();
157extern unsigned int sleep();
158# if HPUXVERSION < 800	/* XXX: Not true for 8.0 */
159extern void sigpause();
160extern sigmask_t sigspace();
161extern int lstat();
162extern int readlink();
163extern int sigvector();
164extern int gethostname();
165extern int ioctl();
166extern int nice();
167extern char *sbrk();
168# endif /* HPUXVERSION < 800 */
169#endif /* __hpux */
170
171#if (defined(_MINIX) && !defined(_MINIX_VMD)) || defined(__EMX__) || defined(COHERENT)
172typedef char * caddr_t;
173#endif /* (_MINIX && !_MINIX_VMD) || __EMX__ || COHERENT */
174
175/***
176 *** hp9000s500 running hpux-5.2
177 ***/
178#ifdef hp9000s500
179# ifndef _PTR_T
180#  define _PTR_T
181    typedef char * ptr_t;
182# endif /* _PTR_T */
183#endif /* hp9000s500 */
184
185/***
186 *** Data General AViiON 88000 or Pentium, running dgux 5.4R3 or R4.11
187 ***/
188#ifdef DGUX
189# ifndef _SIZE_T
190#  define _SIZE_T size_t
191    typedef unsigned int size_t;
192# endif /* _SIZE_T */
193# ifndef _PID_T
194#  define _PID_T
195# endif /* _PID_T */
196#endif /* DGUX */
197
198
199/***
200 *** Intel 386, ISC 386/ix v2.0.2
201 ***/
202#ifdef ISC202
203# ifndef _SIZE_T
204#  define _SIZE_T
205# endif /* _SIZE_T */
206#endif /* ISC202 */
207
208/***
209 *** a PFU/Fujitsu A-xx computer SX/A Edition 60 or later
210 ***/
211#ifdef SXA
212# ifndef _SIZE_T
213#  define _SIZE_T
214# endif /* _SIZE_T */
215#endif /* SXA */
216
217/***
218 *** a stellar 2600, running stellix 2.3
219 ***/
220#ifdef stellar
221# ifndef _SIZE_T
222#  define _SIZE_T
223# endif /* _SIZE_T */
224#endif /* stellar */
225
226/***
227 *** BSD systems, pre and post 4.3
228 ***/
229#ifdef BSD
230# ifndef _SIZE_T
231#  define _SIZE_T
232# endif /* _SIZE_T */
233#endif /* BSD */
234
235
236/***
237 *** BSD RENO advertises itself as POSIX, but
238 *** it is missing speed_t
239 ***/
240#ifdef RENO
241# ifndef _SPEED_T
242#  define _SPEED_T
243   typedef unsigned int speed_t;
244# endif /* _SPEED_T */
245#endif /* RENO */
246
247
248/***
249 *** NeXT OS 3.x
250 ***/
251#ifdef NeXT
252# ifndef _SPEED_T
253#  define _SPEED_T
254   typedef unsigned int speed_t;
255# endif /* _SPEED_T */
256#endif /* NeXT */
257
258/***
259 *** Utah's HPBSD
260 *** some posix & 4.4 BSD changes (pid_t is a short)
261 ***/
262#ifdef HPBSD
263# ifndef _PID_T
264#  define _PID_T
265# endif /* _PID_T */
266#endif /* HPBSD */
267
268
269/***
270 *** Pyramid, BSD universe
271 *** In addition to the size_t
272 ***/
273#ifdef pyr
274# ifndef _PID_T
275#  define _PID_T
276   typedef short pid_t;
277# endif /* _PID_T */
278#endif /* pyr */
279
280
281/***
282 *** rs6000, ibm370, ps2, rt: running flavors of aix.
283 ***/
284#ifdef IBMAIX
285# ifndef _SIZE_T
286#  define _SIZE_T
287# endif /* _SIZE_T */
288# ifndef aiws
289#  ifndef _PID_T
290#   define _PID_T
291#  endif /* _PID_T */
292# endif /* !aiws */
293# ifdef _IBMR2
294#  ifndef _SPEED_T
295#   define _SPEED_T
296#  endif /* _SPEED_T */
297# endif /* _IBMR2 */
298#endif /* IBMAIX */
299
300
301/***
302 *** Ultrix...
303 ***/
304#if defined(ultrix) || defined(__ultrix)
305# ifndef _SIZE_T
306#  define _SIZE_T
307# endif /* _SIZE_T */
308# ifndef _PID_T
309#  define _PID_T
310# endif /* _PID_T */
311# ifndef _PTR_T
312#  define _PTR_T
313    typedef void * ptr_t;
314# endif /* _PTR_T */
315#endif /* ultrix || __ultrix */
316
317
318/***
319 *** Silicon graphics IRIS4D running IRIX3_3
320 ***/
321#if defined(IRIS4D) && defined(IRIX3_3)
322# ifndef _PID_T
323#  define _PID_T
324# endif /* _PID_T */
325#endif /* IRIS4D && IRIX3_3 */
326
327
328/***
329 *** Sequent
330 ***/
331#ifdef sequent
332# ifndef _SIZE_T
333#  define _SIZE_T
334# endif /* _SIZE_T */
335#endif /* sequent */
336
337/***
338 *** Apple AUX.
339 ***/
340#ifdef OREO
341# ifndef _SIZE_T
342#  define _SIZE_T
343# endif /* _SIZE_T */
344# ifndef _PID_T
345#  define _PID_T
346# endif /* _PID_T */
347#endif /* OREO */
348
349/***
350 *** Intel 386, Hypercube
351 ***/
352#ifdef INTEL
353# ifndef _SIZE_T
354#  define _SIZE_T
355# endif /* _SIZE_T */
356#endif /* INTEL */
357
358/***
359 *** Concurrent (Masscomp) running RTU 4.1A & RTU 5.0.
360 **** [RTU 6.0 from mike connor]
361 *** Added, DAS DEC-90.
362 ***/
363#ifdef	masscomp
364# ifndef _SIZE_T
365#  define _SIZE_T
366# endif /* _SIZE_T */
367# ifdef RTU6
368#  ifndef _PID_T
369#   define _PID_T
370#  endif /* _PID_T */
371#  ifndef _SPEED_T
372#   define _SPEED_T
373#  endif /* _SPEED_T */
374#endif /* RTU6 */
375#endif	/* masscomp */
376
377/***
378 *** Encore multimax running umax 4.2
379 ***/
380#ifdef	ns32000
381# ifdef __TYPES_DOT_H__
382#  ifndef _SIZE_T
383#   define _SIZE_T
384#  endif /* _SIZE_T */
385# endif /* __TYPES_DOT_H__ */
386#endif	/* ns32000 */
387
388/***
389 *** Silicon Graphics IRIS 3000
390 ***
391 ***/
392#ifdef IRIS3D
393# ifndef _SIZE_T
394#  define _SIZE_T
395# endif /* _SIZE_T */
396#endif /* IRIS3D */
397
398/*
399 * Motorola MPC running R32V2 (sysV88)
400 */
401#ifdef sysV88
402# ifndef _SIZE_T
403#  define _SIZE_T
404# endif /* _SIZE_T */
405# ifndef _PID_T
406#  define _PID_T
407# endif /* _PID_T */
408#endif /* sysV88 */
409
410/*
411 * Amdahl running UTS (Sys V3)
412 */
413#ifdef uts
414# ifndef _SIZE_T
415#  define _SIZE_T
416# endif /* _SIZE_T */
417# ifndef _PID_T
418#  define _PID_T
419# endif /* _PID_T */
420#endif /* uts */
421
422/*
423 * Tektronix 4300 running UTek 4.0 (BSD 4.2)
424 */
425#ifdef UTek
426# ifndef _SIZE_T
427#  define _SIZE_T
428# endif /* _SIZE_T */
429# ifndef _UID_T
430#  define _UID_T
431   typedef int uid_t;
432# endif /* _UID_T */
433# ifndef _GID_T
434#  define _GID_T
435   typedef int gid_t;
436# endif /* _GID_T */
437#endif /* UTek */
438
439/*
440 * Tektronix XD88/10 running UTekV (Sys V3)
441 */
442#ifdef UTekV
443# ifndef _SIZE_T
444#  define _SIZE_T
445# endif /* _SIZE_T */
446# ifndef _PID_T
447#  define _PID_T
448# endif /* _PID_T */
449#endif /* UTekV*/
450
451/*
452 * UnixPC aka u3b1
453 */
454#ifdef UNIXPC
455# ifdef types_h
456#  ifndef _SIZE_T
457#   define _SIZE_T
458#  endif /* _SIZE_T */
459# endif /* types_h */
460#endif /* UNIXPC */
461
462/*
463 * NS32000 OPUS
464 */
465#ifdef OPUS
466# ifndef _SIZE_T
467#  define _SIZE_T
468# endif /* _SIZE_T */
469#endif /* OPUS */
470
471/*
472 * BBN Butterfly gp1000
473 */
474#ifdef butterfly
475# ifndef _PID_T
476#  define _PID_T
477# endif /* _PID_T */
478#endif /* butterfly */
479
480/*
481 * Convex
482 */
483#ifdef convex
484# if defined(__SIZE_T) && !defined(_SIZE_T)
485#  define _SIZE_T
486# endif /* __SIZE_T && !_SIZE_T */
487#endif /* convex */
488
489/*
490 * Alliant FX-2800/FX-80
491 */
492#ifdef alliant
493# ifndef _PID_T
494#  define _PID_T
495# endif /* _PID_T */
496# ifdef mc68000
497   typedef int   pid_t; /* FX-80 */
498# else
499   typedef short pid_t;	/* FX-2800 */
500# endif
501#endif /* alliant */
502
503/*
504 * DNIX
505 */
506#ifdef DNIX
507# ifndef _PID_T
508#  define _PID_T
509# endif /* _PID_T */
510#endif /* DNIX */
511
512/*
513 *  Apollo running Domain/OS SR10.3 or greater
514 */
515#ifdef apollo
516# ifndef _PID_T
517#  define _PID_T
518   typedef int pid_t;	/* Older versions might not like that */
519# endif /* _PID_T */
520#endif /* apollo */
521
522/*
523 *  Vax running VMS_POSIX
524 */
525#ifdef _VMS_POSIX
526# ifndef _SIZE_T
527#  define _SIZE_T
528# endif /* _SIZE_T */
529#endif /* _VMS_POSIX */
530
531/***
532 *** a pdp/11, running 2BSD
533 ***/
534#ifdef pdp11
535# ifndef _PID_T
536#  define _PID_T
537# endif /* _PID_T */
538#endif /* pdp11 */
539
540/***
541 *** a Harris, running CX/UX
542 ***/
543#ifdef _CX_UX
544# ifndef _PID_T
545#  define _PID_T
546# endif /* _PID_T */
547#endif /* _CX_UX */
548
549/***
550 *** Catch all for non POSIX and/or non ANSI systems.
551 *** Systems up to spec *should* define these automatically
552 *** I am open to suggestions on how to do this correctly!
553 ***/
554
555#ifndef __STDC__
556
557# ifndef _SIZE_T
558#  define _SIZE_T
559   typedef int size_t;		/* As sun comments ??? : meaning I take it */
560# endif /* _SIZE_T */		/* Until we make the world ANSI... */
561
562#endif  /* ! __STDC__ */
563
564#ifndef POSIX
565
566# ifndef _PID_T
567#  define _PID_T
568    typedef int pid_t;
569# endif /* _PID_T */
570
571# ifndef _SPEED_T
572#  define _SPEED_T
573    typedef unsigned int speed_t;
574# endif /* _SPEED_T */
575
576# ifndef _PTR_T
577#  define _PTR_T
578    typedef char * ptr_t;
579#endif /* _PTR_T */
580
581# ifndef _IOCTL_T
582#  define _IOCTL_T
583    typedef char * ioctl_t;	/* Third arg of ioctl */
584# endif /* _IOCTL_T */
585
586#endif /* ! POSIX */
587
588
589
590/***
591 *** This is our own junk types.
592 ***/
593#ifndef _PTR_T
594# define _PTR_T
595    typedef void * ptr_t;
596#endif /* _PTR_T */
597
598#ifndef _SIGMASK_T
599# define _SIGMASK_T
600    typedef int sigmask_t;
601#endif /* _SIGMASK_T */
602
603#ifndef _IOCTL_T
604# define _IOCTL_T
605    typedef void * ioctl_t;	/* Third arg of ioctl */
606#endif /* _IOCTL_T */
607
608#endif /* _h_sh_types */
609