sh.types.h revision 131962
1/* $Header: /src/pub/tcsh/sh.types.h,v 3.40 2003/06/18 19:32:44 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
145# if HPUXVERSION < 1100	/* XXX: Not true for 11.0 */
146extern uid_t getuid(), geteuid();
147extern gid_t getgid(), getegid();
148extern sigmask_t sigblock();
149extern sigmask_t sigsetmask();
150extern pid_t getpid();
151extern pid_t fork();
152extern void perror();
153extern void _exit();
154extern void abort();
155extern void qsort();
156extern void free();
157extern unsigned int alarm();
158extern unsigned int sleep();
159# endif /* HPUXVERSION < 1100 */
160# if HPUXVERSION < 800	/* XXX: Not true for 8.0 */
161extern void sigpause();
162extern sigmask_t sigspace();
163extern int lstat();
164extern int readlink();
165extern int sigvector();
166extern int gethostname();
167extern int ioctl();
168extern int nice();
169extern char *sbrk();
170# endif /* HPUXVERSION < 800 */
171#endif /* __hpux */
172
173#if (defined(_MINIX) && !defined(_MINIX_VMD)) || defined(__EMX__) || defined(COHERENT)
174typedef char * caddr_t;
175#endif /* (_MINIX && !_MINIX_VMD) || __EMX__ || COHERENT */
176
177/***
178 *** hp9000s500 running hpux-5.2
179 ***/
180#ifdef hp9000s500
181# ifndef _PTR_T
182#  define _PTR_T
183    typedef char * ptr_t;
184# endif /* _PTR_T */
185#endif /* hp9000s500 */
186
187/***
188 *** Data General AViiON 88000 or Pentium, running dgux 5.4R3 or R4.11
189 ***/
190#ifdef DGUX
191# ifndef _SIZE_T
192#  define _SIZE_T size_t
193    typedef unsigned int size_t;
194# endif /* _SIZE_T */
195# ifndef _PID_T
196#  define _PID_T
197# endif /* _PID_T */
198#endif /* DGUX */
199
200
201/***
202 *** Intel 386, ISC 386/ix v2.0.2
203 ***/
204#ifdef ISC202
205# ifndef _SIZE_T
206#  define _SIZE_T
207# endif /* _SIZE_T */
208#endif /* ISC202 */
209
210/***
211 *** a PFU/Fujitsu A-xx computer SX/A Edition 60 or later
212 ***/
213#ifdef SXA
214# ifndef _SIZE_T
215#  define _SIZE_T
216# endif /* _SIZE_T */
217#endif /* SXA */
218
219/***
220 *** a stellar 2600, running stellix 2.3
221 ***/
222#ifdef stellar
223# ifndef _SIZE_T
224#  define _SIZE_T
225# endif /* _SIZE_T */
226#endif /* stellar */
227
228/***
229 *** BSD systems, pre and post 4.3
230 ***/
231#ifdef BSD
232# ifndef _SIZE_T
233#  define _SIZE_T
234# endif /* _SIZE_T */
235#endif /* BSD */
236
237
238/***
239 *** BSD RENO advertises itself as POSIX, but
240 *** it is missing speed_t
241 ***/
242#ifdef RENO
243# ifndef _SPEED_T
244#  define _SPEED_T
245   typedef unsigned int speed_t;
246# endif /* _SPEED_T */
247#endif /* RENO */
248
249
250/***
251 *** NeXT OS 3.x
252 ***/
253#ifdef NeXT
254# ifndef _SPEED_T
255#  define _SPEED_T
256   typedef unsigned int speed_t;
257# endif /* _SPEED_T */
258#endif /* NeXT */
259
260/***
261 *** Utah's HPBSD
262 *** some posix & 4.4 BSD changes (pid_t is a short)
263 ***/
264#ifdef HPBSD
265# ifndef _PID_T
266#  define _PID_T
267# endif /* _PID_T */
268#endif /* HPBSD */
269
270
271/***
272 *** Pyramid, BSD universe
273 *** In addition to the size_t
274 ***/
275#ifdef pyr
276# ifndef _PID_T
277#  define _PID_T
278   typedef short pid_t;
279# endif /* _PID_T */
280#endif /* pyr */
281
282
283/***
284 *** rs6000, ibm370, ps2, rt: running flavors of aix.
285 ***/
286#ifdef IBMAIX
287# ifndef _SIZE_T
288#  define _SIZE_T
289# endif /* _SIZE_T */
290# ifndef aiws
291#  ifndef _PID_T
292#   define _PID_T
293#  endif /* _PID_T */
294# endif /* !aiws */
295# ifdef _IBMR2
296#  ifndef _SPEED_T
297#   define _SPEED_T
298#  endif /* _SPEED_T */
299# endif /* _IBMR2 */
300#endif /* IBMAIX */
301
302
303/***
304 *** Ultrix...
305 ***/
306#if defined(ultrix) || defined(__ultrix)
307# ifndef _SIZE_T
308#  define _SIZE_T
309# endif /* _SIZE_T */
310# ifndef _PID_T
311#  define _PID_T
312# endif /* _PID_T */
313# ifndef _PTR_T
314#  define _PTR_T
315    typedef void * ptr_t;
316# endif /* _PTR_T */
317#endif /* ultrix || __ultrix */
318
319
320/***
321 *** Silicon graphics IRIS4D running IRIX3_3
322 ***/
323#if defined(IRIS4D) && defined(IRIX3_3)
324# ifndef _PID_T
325#  define _PID_T
326# endif /* _PID_T */
327#endif /* IRIS4D && IRIX3_3 */
328
329
330/***
331 *** Sequent
332 ***/
333#ifdef sequent
334# ifndef _SIZE_T
335#  define _SIZE_T
336# endif /* _SIZE_T */
337#endif /* sequent */
338
339/***
340 *** Apple AUX.
341 ***/
342#ifdef OREO
343# ifndef _SIZE_T
344#  define _SIZE_T
345# endif /* _SIZE_T */
346# ifndef _PID_T
347#  define _PID_T
348# endif /* _PID_T */
349#endif /* OREO */
350
351/***
352 *** Intel 386, Hypercube
353 ***/
354#ifdef INTEL
355# ifndef _SIZE_T
356#  define _SIZE_T
357# endif /* _SIZE_T */
358#endif /* INTEL */
359
360/***
361 *** Concurrent (Masscomp) running RTU 4.1A & RTU 5.0.
362 **** [RTU 6.0 from mike connor]
363 *** Added, DAS DEC-90.
364 ***/
365#ifdef	masscomp
366# ifndef _SIZE_T
367#  define _SIZE_T
368# endif /* _SIZE_T */
369# ifdef RTU6
370#  ifndef _PID_T
371#   define _PID_T
372#  endif /* _PID_T */
373#  ifndef _SPEED_T
374#   define _SPEED_T
375#  endif /* _SPEED_T */
376#endif /* RTU6 */
377#endif	/* masscomp */
378
379/***
380 *** Encore multimax running umax 4.2
381 ***/
382#ifdef	ns32000
383# ifdef __TYPES_DOT_H__
384#  ifndef _SIZE_T
385#   define _SIZE_T
386#  endif /* _SIZE_T */
387# endif /* __TYPES_DOT_H__ */
388#endif	/* ns32000 */
389
390/***
391 *** Silicon Graphics IRIS 3000
392 ***
393 ***/
394#ifdef IRIS3D
395# ifndef _SIZE_T
396#  define _SIZE_T
397# endif /* _SIZE_T */
398#endif /* IRIS3D */
399
400/*
401 * Motorola MPC running R32V2 (sysV88)
402 */
403#ifdef sysV88
404# ifndef _SIZE_T
405#  define _SIZE_T
406# endif /* _SIZE_T */
407# ifndef _PID_T
408#  define _PID_T
409# endif /* _PID_T */
410#endif /* sysV88 */
411
412/*
413 * Amdahl running UTS (Sys V3)
414 */
415#ifdef uts
416# ifndef _SIZE_T
417#  define _SIZE_T
418# endif /* _SIZE_T */
419# ifndef _PID_T
420#  define _PID_T
421# endif /* _PID_T */
422#endif /* uts */
423
424/*
425 * Tektronix 4300 running UTek 4.0 (BSD 4.2)
426 */
427#ifdef UTek
428# ifndef _SIZE_T
429#  define _SIZE_T
430# endif /* _SIZE_T */
431# ifndef _UID_T
432#  define _UID_T
433   typedef int uid_t;
434# endif /* _UID_T */
435# ifndef _GID_T
436#  define _GID_T
437   typedef int gid_t;
438# endif /* _GID_T */
439#endif /* UTek */
440
441/*
442 * Tektronix XD88/10 running UTekV (Sys V3)
443 */
444#ifdef UTekV
445# ifndef _SIZE_T
446#  define _SIZE_T
447# endif /* _SIZE_T */
448# ifndef _PID_T
449#  define _PID_T
450# endif /* _PID_T */
451#endif /* UTekV*/
452
453/*
454 * UnixPC aka u3b1
455 */
456#ifdef UNIXPC
457# ifdef types_h
458#  ifndef _SIZE_T
459#   define _SIZE_T
460#  endif /* _SIZE_T */
461# endif /* types_h */
462#endif /* UNIXPC */
463
464/*
465 * NS32000 OPUS
466 */
467#ifdef OPUS
468# ifndef _SIZE_T
469#  define _SIZE_T
470# endif /* _SIZE_T */
471#endif /* OPUS */
472
473/*
474 * BBN Butterfly gp1000
475 */
476#ifdef butterfly
477# ifndef _PID_T
478#  define _PID_T
479# endif /* _PID_T */
480#endif /* butterfly */
481
482/*
483 * Convex
484 */
485#ifdef convex
486# if defined(__SIZE_T) && !defined(_SIZE_T)
487#  define _SIZE_T
488# endif /* __SIZE_T && !_SIZE_T */
489#endif /* convex */
490
491/*
492 * Alliant FX-2800/FX-80
493 */
494#ifdef alliant
495# ifndef _PID_T
496#  define _PID_T
497# endif /* _PID_T */
498# ifdef mc68000
499   typedef int   pid_t; /* FX-80 */
500# else
501   typedef short pid_t;	/* FX-2800 */
502# endif
503#endif /* alliant */
504
505/*
506 * DNIX
507 */
508#ifdef DNIX
509# ifndef _PID_T
510#  define _PID_T
511# endif /* _PID_T */
512#endif /* DNIX */
513
514/*
515 *  Apollo running Domain/OS SR10.3 or greater
516 */
517#ifdef apollo
518# ifndef _PID_T
519#  define _PID_T
520   typedef int pid_t;	/* Older versions might not like that */
521# endif /* _PID_T */
522#endif /* apollo */
523
524/*
525 *  Vax running VMS_POSIX
526 */
527#ifdef _VMS_POSIX
528# ifndef _SIZE_T
529#  define _SIZE_T
530# endif /* _SIZE_T */
531#endif /* _VMS_POSIX */
532
533/***
534 *** a pdp/11, running 2BSD
535 ***/
536#ifdef pdp11
537# ifndef _PID_T
538#  define _PID_T
539# endif /* _PID_T */
540#endif /* pdp11 */
541
542/***
543 *** a Harris, running CX/UX
544 ***/
545#ifdef _CX_UX
546# ifndef _PID_T
547#  define _PID_T
548# endif /* _PID_T */
549#endif /* _CX_UX */
550
551/***
552 *** Catch all for non POSIX and/or non ANSI systems.
553 *** Systems up to spec *should* define these automatically
554 *** I am open to suggestions on how to do this correctly!
555 ***/
556
557#ifndef __STDC__
558
559# ifndef _SIZE_T
560#  define _SIZE_T
561   typedef int size_t;		/* As sun comments ??? : meaning I take it */
562# endif /* _SIZE_T */		/* Until we make the world ANSI... */
563
564#endif  /* ! __STDC__ */
565
566#ifndef POSIX
567
568# ifndef _PID_T
569#  define _PID_T
570    typedef int pid_t;
571# endif /* _PID_T */
572
573# ifndef _SPEED_T
574#  define _SPEED_T
575    typedef unsigned int speed_t;
576# endif /* _SPEED_T */
577
578# ifndef _PTR_T
579#  define _PTR_T
580    typedef char * ptr_t;
581#endif /* _PTR_T */
582
583# ifndef _IOCTL_T
584#  define _IOCTL_T
585    typedef char * ioctl_t;	/* Third arg of ioctl */
586# endif /* _IOCTL_T */
587
588#endif /* ! POSIX */
589
590
591
592/***
593 *** This is our own junk types.
594 ***/
595#ifndef _PTR_T
596# define _PTR_T
597    typedef void * ptr_t;
598#endif /* _PTR_T */
599
600#ifndef _SIGMASK_T
601# define _SIGMASK_T
602    typedef int sigmask_t;
603#endif /* _SIGMASK_T */
604
605#ifndef _IOCTL_T
606# define _IOCTL_T
607    typedef void * ioctl_t;	/* Third arg of ioctl */
608#endif /* _IOCTL_T */
609
610#endif /* _h_sh_types */
611