1/*
2 * tclXunixPort.h
3 *
4 * Portability include file for Unix systems.
5 *-----------------------------------------------------------------------------
6 * Copyright 1996-1999 Karl Lehenbauer and Mark Diekhans.
7 *
8 * Permission to use, copy, modify, and distribute this software and its
9 * documentation for any purpose and without fee is hereby granted, provided
10 * that the above copyright notice appear in all copies.  Karl Lehenbauer and
11 * Mark Diekhans make no representations about the suitability of this
12 * software for any purpose.  It is provided "as is" without express or
13 * implied warranty.
14 *-----------------------------------------------------------------------------
15 * $Id: tclXunixPort.h,v 8.5 2007/02/28 00:14:09 hobbs Exp $
16 *-----------------------------------------------------------------------------
17 */
18
19#ifndef TCLXUNIXPORT_H
20#define TCLXUNIXPORT_H
21
22#include <sys/param.h>
23
24#include <math.h>
25
26#ifdef NO_LIMITS_H
27#    include <values.h>
28#else
29#    include <limits.h>
30#endif
31
32#include <sys/times.h>
33#include <grp.h>
34#include <assert.h>
35
36#ifndef __xlC__ /* AIX xlc */
37extern int h_errno;
38#endif
39
40#ifdef __APPLE__
41# undef panic
42#endif
43
44/*
45 * Included the tcl file tclUnixPort.h after other system files, as it checks
46 * if certain things are defined.
47 */
48#include "tclUnixPort.h"
49
50/*
51 * Define O_ACCMODE if <fcntl.h> does not define it.
52 */
53#ifndef O_ACCMODE
54#    define O_ACCMODE  (O_RDONLY|O_WRONLY|O_RDWR)
55#endif
56
57/*
58 * Make sure we have both O_NONBLOCK and O_NDELAY defined.
59 */
60#ifndef O_NONBLOCK
61#   define O_NONBLOCK O_NDELAY
62#endif
63#ifndef O_NDELAY
64#   define O_NDELAY O_NONBLOCK
65#endif
66
67/*
68 * Make sure CLK_TCK is defined.
69 */
70#ifndef CLK_TCK
71#    ifdef HZ
72#        define CLK_TCK HZ
73#    else
74#        define CLK_TCK 60
75#    endif
76#endif
77
78/*
79 * Defines needed for socket code.  ((unsigned long) -1) is not correct
80 * for 64-bit systems, use 0XFFFFFFFFUL. [Bug 1242825]
81 */
82#ifndef INADDR_NONE
83#    define INADDR_NONE 0xFFFFFFFFUL
84#endif
85
86/*
87 * BSD functions.
88 */
89#ifdef NO_BCOPY
90#    define bcopy(from, to, length) memmove((to), (from), (length))
91#endif
92
93#ifdef NO_BZERO
94#    define bzero(to,length) memset(to,'\0',length)
95#endif
96
97/*
98 * Math defines.
99 */
100#ifndef MAXDOUBLE
101#    define MAXDOUBLE HUGE_VAL
102#endif
103
104
105/*
106 * Define C lib prototypes that are either missing or being emulated by
107 * the compat library.
108 */
109#if defined(NO_RANDOM) || defined(NO_RANDOM_PROTO)
110extern long random ();
111#endif
112
113/*
114 * If sigaction is available, check for restartable signals.
115 */
116#ifndef NO_SIGACTION
117#    ifndef SA_RESTART
118#        define NO_SIG_RESTART
119#    endif
120#else
121#    define NO_SIG_RESTART
122#endif
123
124
125/*
126 * Define a macro to call wait pid.  We don't use Tcl_WaitPid on Unix because
127 * it delays signals.
128 */
129#define TCLX_WAITPID(pid, status, options) waitpid (pid, status, options)
130
131#endif
132
133
134