annotate src/s/sol2.h @ 169:15872534500d r20-3b11

Import from CVS: tag r20-3b11
author cvs
date Mon, 13 Aug 2007 09:46:53 +0200
parents 85ec50267440
children 8eaf7971accc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 /* Synched up with: FSF 19.31. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
3 #define SOLARIS2 1
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
4 #define POSIX 1
169
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
5
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
6 #ifndef USG
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
7 #define USG
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
8 #endif
169
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
9
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
10 #ifndef USG5_4
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
11 #define USG5_4
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
12 #endif
169
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
13
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
14 #define __EXTENSIONS__ 1
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
15
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
16 #undef _POSIX_C_SOURCE
169
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
17
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
18 /* Solaris 2.4 math.h doesn't respect __EXTENSIONS__ */
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
19 #ifndef NOT_C_CODE
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
20
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
21 #if OS_RELEASE <= 54
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
22 #include <math.h>
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
23 #endif /* <= Solaris 2.4 */
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
24
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
25 /* Fix understandable GCC lossage on Solaris 2.6 */
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
26 #if OS_RELEASE >= 56
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
27 #ifdef __GNUC__
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
28 #define __GNUC_VA_LIST
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
29 #define _VA_LIST_
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
30 #define _VA_LIST va_list
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
31 typedef void *__gnuc_va_list;
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
32 typedef __gnuc_va_list va_list;
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
33 #endif /* GCC */
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
34 #endif /* >= Solaris 2.6 */
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
35
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
36 #endif /* C code */
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
37
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
38 #undef _XOPEN_SOURCE
169
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
39 #define _XOPEN_SOURCE 1
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
40
167
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents: 163
diff changeset
41 #undef _XOPEN_SOURCE_EXTENDED
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
42 #define _XOPEN_SOURCE_EXTENDED 1
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
44 #include "usg5-4-2.h" /* XEmacs change from 5-4 to 5-4-2 */
169
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
45 #undef PC /* Defined in x86 /usr/include/sys/reg.h */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 /* SIGIO seems to be working under Solaris and it makes ^G work better... */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 #undef BROKEN_SIGIO
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 /* eggert@twinsun.com said these work in Solaris.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 Perhaps they work in all kinds of SVR4, but this is more conservative. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 #undef BROKEN_TIOCGETC
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 #undef BROKEN_TIOCGWINSZ
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54
157
6b37e6ddd302 Import from CVS: tag r20-3b5
cvs
parents: 151
diff changeset
55 #ifdef NOT_C_CODE
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
56 #define ORDINARY_LINK
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 149
diff changeset
57 /* XEmacs change -- some Motif packages need -lgen to get regex and regcmp */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 #undef LIBS_SYSTEM
157
6b37e6ddd302 Import from CVS: tag r20-3b5
cvs
parents: 151
diff changeset
60 #define LIBS_SYSTEM "-lsocket -lnsl -lelf -lgen -ldl"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 /* SYSTEM_MALLOC must be defined if dbx/RTC is going to be used. dbx/RTC does
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 not work with a static definition of malloc(). */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 /* We want to be able to test out ralloc.c. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 /* #define SYSTEM_MALLOC */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 /* XEmacs: there used to be a special definition of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 PTY_TTY_NAME_SPRINTF here that was identical to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 other SYSV R4 definitions except that it didn't
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 block SIGCHLD around the call to grantpt(). This
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 is *not* in 19.29 and is almost certainly incorrect.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 149
diff changeset
74 #undef UNEXEC
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
75 #if OS_RELEASE < 56
157
6b37e6ddd302 Import from CVS: tag r20-3b5
cvs
parents: 151
diff changeset
76 #define UNEXEC "unexsol2.o"
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
77 #else
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
78 #define UNEXEC "unexsol2-6.o"
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
79 #endif
157
6b37e6ddd302 Import from CVS: tag r20-3b5
cvs
parents: 151
diff changeset
80
6b37e6ddd302 Import from CVS: tag r20-3b5
cvs
parents: 151
diff changeset
81 #else /* C_CODE */
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
82
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
83 #if OS_RELEASE <= 53
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
84 /* Solaris 2.3 has a bug in XListFontsWithInfo. */
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
85 #define BROKEN_XLISTFONTSWITHINFO
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
86 #endif
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
87
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
88 /* 2.5 now has random back in libc but we don't want to use it. */
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
89 #if OS_RELEASE >= 55
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
90 #undef HAVE_RANDOM
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
91 /* Apparently not necessary here, and it causes 10% CPU chewage. */
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
92 #undef BROKEN_SIGCHLD
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
93 #endif /* >= SunOS 5.5 */
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
94
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
95 /* XEmacs addition: Raymond Toy says XEmacs completely misses SIGCHLD
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
96 when compiled with GCC 2.7.0 (but not, apparently, with SunPro C?),
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
97 X11R6, and Solaris 2.4.
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
98
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
99 Someone else submitted a simple test program that duplicates this
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
100 behavior, and says it has something to do with the fact that X11R6
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
101 links with the threads library. */
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
102
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
103 #ifdef THIS_IS_X11R6
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
104 #define BROKEN_SIGCHLD
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
105 #endif
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
106
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
107 #if OS_RELEASE < 55
167
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents: 163
diff changeset
108 /* Missing prototype, added in Solaris 2.5 */
157
6b37e6ddd302 Import from CVS: tag r20-3b5
cvs
parents: 151
diff changeset
109 extern void *__builtin_alloca(size_t);
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
110 #endif /* before SunOS 5.5 */
157
6b37e6ddd302 Import from CVS: tag r20-3b5
cvs
parents: 151
diff changeset
111
169
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
112 #if OS_RELEASE == 55
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
113 /* The following functions were added in Solaris 2.5,
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
114 but they forgot to add prototypes to the system header files. */
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
115 int getpagesize (void);
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
116 long random (void);
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
117 void srandom (unsigned int seed);
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
118 int usleep(unsigned int useconds);
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
119 #endif /* SunOS 5.5 */
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
120
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
121 #if OS_RELEASE < 56
167
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents: 163
diff changeset
122 /* Missing prototypes, added in Solaris 2.6 */
157
6b37e6ddd302 Import from CVS: tag r20-3b5
cvs
parents: 151
diff changeset
123 struct timeval;
6b37e6ddd302 Import from CVS: tag r20-3b5
cvs
parents: 151
diff changeset
124 int utimes (char *file, struct timeval *tvp);
167
85ec50267440 Import from CVS: tag r20-3b10
cvs
parents: 163
diff changeset
125 int gethostname(char *name, int namelen);
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
126 #endif /* before SunOS 5.6 */
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
127
169
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
128 #if defined(__GNUC__) && OS_RELEASE >= 56
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
129 /* Missing prototypes for functions added in Solaris 2.6 */
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
130 struct msghdr;
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
131 struct sockaddr;
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
132 extern int __xnet_bind(int, const struct sockaddr *, size_t);
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
133 extern int __xnet_listen(int, int);
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
134 extern int __xnet_connect(int, const struct sockaddr *, size_t);
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
135 extern ssize_t __xnet_recvmsg(int, struct msghdr *, int);
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
136 extern ssize_t __xnet_sendmsg(int, const struct msghdr *, int);
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
137 extern ssize_t __xnet_sendto(int, const void *, size_t, int, const struct sockaddr *, size_t);
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
138 extern int __xnet_socket(int, int, int);
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
139 extern int __xnet_socketpair(int, int, int, int *);
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
140 extern int __xnet_getsockopt(int, int, int, void *, size_t *);
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
141 #endif /* GCC && >= SunOS 5.6 */
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 167
diff changeset
142
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
143 #include <sys/utsname.h> /* warning: macro redefined: SYS_NMLN */
157
6b37e6ddd302 Import from CVS: tag r20-3b5
cvs
parents: 151
diff changeset
144
6b37e6ddd302 Import from CVS: tag r20-3b5
cvs
parents: 151
diff changeset
145 /* Get non-ANSI functions from ANSI header files in cc -Xc mode.
6b37e6ddd302 Import from CVS: tag r20-3b5
cvs
parents: 151
diff changeset
146 Sun has promised to fix setjmp.h */
6b37e6ddd302 Import from CVS: tag r20-3b5
cvs
parents: 151
diff changeset
147 #if __STDC__ == 1 && defined(__SUNPRO_C)
6b37e6ddd302 Import from CVS: tag r20-3b5
cvs
parents: 151
diff changeset
148 #define _POSIX_C_SOURCE 1
6b37e6ddd302 Import from CVS: tag r20-3b5
cvs
parents: 151
diff changeset
149 #include <setjmp.h>
6b37e6ddd302 Import from CVS: tag r20-3b5
cvs
parents: 151
diff changeset
150 #undef _POSIX_C_SOURCE
6b37e6ddd302 Import from CVS: tag r20-3b5
cvs
parents: 151
diff changeset
151 #endif /* cc -Xc */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 /* XEmacs: Solaris has sigsetjmp but using it leads to core dumps at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 least under 2.4 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 #undef _setjmp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 #define _setjmp setjmp
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
157
157
6b37e6ddd302 Import from CVS: tag r20-3b5
cvs
parents: 151
diff changeset
158 #endif /* C_CODE */