comparison src/s/sol2.h @ 173:8eaf7971accc r20-3b13

Import from CVS: tag r20-3b13
author cvs
date Mon, 13 Aug 2007 09:49:09 +0200
parents 15872534500d
children 11cf20601dec
comparison
equal deleted inserted replaced
172:a38aed19690b 173:8eaf7971accc
1 /* Synched up with: FSF 19.31. */ 1 /* Synched up with: Completely divergent from FSF. */
2
3 #define SOLARIS2 1 2 #define SOLARIS2 1
4 #define POSIX 1 3 #define POSIX 1
5 4
6 #ifndef USG 5 #ifndef USG
7 #define USG 6 #define USG
9 8
10 #ifndef USG5_4 9 #ifndef USG5_4
11 #define USG5_4 10 #define USG5_4
12 #endif 11 #endif
13 12
14 #define __EXTENSIONS__ 1
15
16 #undef _POSIX_C_SOURCE 13 #undef _POSIX_C_SOURCE
17 14
18 /* Solaris 2.4 math.h doesn't respect __EXTENSIONS__ */ 15 #if OS_RELEASE > 54
19 #ifndef NOT_C_CODE 16 /* There were some bugs with preprocessor symbol interaction, which
20 17 were not fixed until 2.5. */
21 #if OS_RELEASE <= 54 18 #define __EXTENSIONS__ 1
22 #include <math.h>
23 #endif /* <= Solaris 2.4 */
24
25 /* Fix understandable GCC lossage on Solaris 2.6 */
26 #if OS_RELEASE >= 56
27 #ifdef __GNUC__
28 #define __GNUC_VA_LIST
29 #define _VA_LIST_
30 #define _VA_LIST va_list
31 typedef void *__gnuc_va_list;
32 typedef __gnuc_va_list va_list;
33 #endif /* GCC */
34 #endif /* >= Solaris 2.6 */
35
36 #endif /* C code */
37 19
38 #undef _XOPEN_SOURCE 20 #undef _XOPEN_SOURCE
39 #define _XOPEN_SOURCE 1 21 #define _XOPEN_SOURCE 1
40 22
41 #undef _XOPEN_SOURCE_EXTENDED 23 #undef _XOPEN_SOURCE_EXTENDED
42 #define _XOPEN_SOURCE_EXTENDED 1 24 #define _XOPEN_SOURCE_EXTENDED 1
25 #endif /* > Solaris 2.4 */
26
27 /* Fix understandable GCC lossage on Solaris 2.6 */
28 #if defined(__GNUC__) && OS_RELEASE >= 56 && !defined(NOT_C_CODE)
29
30 /* GCC va_list munging is a little messed up */
31 #define __GNUC_VA_LIST
32 #define _VA_LIST_
33 #define _VA_LIST va_list
34 typedef void *__gnuc_va_list;
35 typedef __gnuc_va_list va_list;
36
37 /* Missing prototypes for functions added in Solaris 2.6 */
38 #include <sys/types.h>
39 struct msghdr;
40 struct sockaddr;
41 extern int __xnet_bind (int, const struct sockaddr *, size_t);
42 extern int __xnet_listen (int, int);
43 extern int __xnet_connect (int, const struct sockaddr *, size_t);
44 extern ssize_t __xnet_recvmsg (int, struct msghdr *, int);
45 extern ssize_t __xnet_sendmsg (int, const struct msghdr *, int);
46 extern ssize_t __xnet_sendto (int, const void *, size_t, int, const struct sockaddr *, size_t);
47 extern int __xnet_socket (int, int, int);
48 extern int __xnet_socketpair (int, int, int, int *);
49 extern int __xnet_getsockopt (int, int, int, void *, size_t *);
50 #endif /* GCC && >= Solaris 2.6 && C code */
43 51
44 #include "usg5-4-2.h" /* XEmacs change from 5-4 to 5-4-2 */ 52 #include "usg5-4-2.h" /* XEmacs change from 5-4 to 5-4-2 */
45 #undef PC /* Defined in x86 /usr/include/sys/reg.h */ 53 #undef PC /* Defined in x86 /usr/include/sys/reg.h */
46 54
47 /* SIGIO seems to be working under Solaris and it makes ^G work better... */ 55 /* SIGIO seems to be working under Solaris and it makes ^G work better... */
83 #if OS_RELEASE <= 53 91 #if OS_RELEASE <= 53
84 /* Solaris 2.3 has a bug in XListFontsWithInfo. */ 92 /* Solaris 2.3 has a bug in XListFontsWithInfo. */
85 #define BROKEN_XLISTFONTSWITHINFO 93 #define BROKEN_XLISTFONTSWITHINFO
86 #endif 94 #endif
87 95
88 /* 2.5 now has random back in libc but we don't want to use it. */
89 #if OS_RELEASE >= 55
90 #undef HAVE_RANDOM
91 /* Apparently not necessary here, and it causes 10% CPU chewage. */
92 #undef BROKEN_SIGCHLD
93 #endif /* >= SunOS 5.5 */
94
95 /* XEmacs addition: Raymond Toy says XEmacs completely misses SIGCHLD 96 /* XEmacs addition: Raymond Toy says XEmacs completely misses SIGCHLD
96 when compiled with GCC 2.7.0 (but not, apparently, with SunPro C?), 97 when compiled with GCC 2.7.0 (but not, apparently, with SunPro C?),
97 X11R6, and Solaris 2.4. 98 X11R6, and Solaris 2.4.
98 99
99 Someone else submitted a simple test program that duplicates this 100 Someone else submitted a simple test program that duplicates this
103 #ifdef THIS_IS_X11R6 104 #ifdef THIS_IS_X11R6
104 #define BROKEN_SIGCHLD 105 #define BROKEN_SIGCHLD
105 #endif 106 #endif
106 107
107 #if OS_RELEASE < 55 108 #if OS_RELEASE < 55
109
110 #if __STDC__ == 1 && defined(__SUNPRO_C)
111 #define _POSIX_C_SOURCE 1
112 #include <setjmp.h>
113 #undef _POSIX_C_SOURCE
114 #endif /* cc -Xc */
115
108 /* Missing prototype, added in Solaris 2.5 */ 116 /* Missing prototype, added in Solaris 2.5 */
109 extern void *__builtin_alloca(size_t); 117 extern void *__builtin_alloca (size_t);
110 #endif /* before SunOS 5.5 */ 118 #endif /* before SunOS 5.5 */
111 119
112 #if OS_RELEASE == 55 120 #if OS_RELEASE == 55
113 /* The following functions were added in Solaris 2.5, 121 /* The following functions were added in Solaris 2.5,
114 but they forgot to add prototypes to the system header files. */ 122 but they forgot to add prototypes to the system header files. */
115 int getpagesize (void); 123 int getpagesize (void);
116 long random (void); 124 long random (void);
117 void srandom (unsigned int seed); 125 void srandom (unsigned int seed);
118 int usleep(unsigned int useconds); 126 int usleep (unsigned int useconds);
119 #endif /* SunOS 5.5 */ 127 #endif /* SunOS 5.5 */
128
129 /* 2.5 now has `random' back in libc but we don't want to use it. */
130 #if OS_RELEASE >= 55
131 #undef HAVE_RANDOM
132 /* Apparently not necessary here, and it causes 10% CPU chewage. */
133 #undef BROKEN_SIGCHLD
134 #endif /* >= SunOS 5.5 */
120 135
121 #if OS_RELEASE < 56 136 #if OS_RELEASE < 56
122 /* Missing prototypes, added in Solaris 2.6 */ 137 /* Missing prototypes, added in Solaris 2.6 */
123 struct timeval; 138 struct timeval;
124 int utimes (char *file, struct timeval *tvp); 139 int utimes (char *file, struct timeval *tvp);
125 int gethostname(char *name, int namelen); 140 int gethostname (char *name, int namelen);
126 #endif /* before SunOS 5.6 */ 141 #endif /* before SunOS 5.6 */
127 142
128 #if defined(__GNUC__) && OS_RELEASE >= 56
129 /* Missing prototypes for functions added in Solaris 2.6 */
130 struct msghdr;
131 struct sockaddr;
132 extern int __xnet_bind(int, const struct sockaddr *, size_t);
133 extern int __xnet_listen(int, int);
134 extern int __xnet_connect(int, const struct sockaddr *, size_t);
135 extern ssize_t __xnet_recvmsg(int, struct msghdr *, int);
136 extern ssize_t __xnet_sendmsg(int, const struct msghdr *, int);
137 extern ssize_t __xnet_sendto(int, const void *, size_t, int, const struct sockaddr *, size_t);
138 extern int __xnet_socket(int, int, int);
139 extern int __xnet_socketpair(int, int, int, int *);
140 extern int __xnet_getsockopt(int, int, int, void *, size_t *);
141 #endif /* GCC && >= SunOS 5.6 */
142
143 #include <sys/utsname.h> /* warning: macro redefined: SYS_NMLN */ 143 #include <sys/utsname.h> /* warning: macro redefined: SYS_NMLN */
144
145 /* Get non-ANSI functions from ANSI header files in cc -Xc mode.
146 Sun has promised to fix setjmp.h */
147 #if __STDC__ == 1 && defined(__SUNPRO_C)
148 #define _POSIX_C_SOURCE 1
149 #include <setjmp.h>
150 #undef _POSIX_C_SOURCE
151 #endif /* cc -Xc */
152 144
153 /* XEmacs: Solaris has sigsetjmp but using it leads to core dumps at 145 /* XEmacs: Solaris has sigsetjmp but using it leads to core dumps at
154 least under 2.4 */ 146 least under 2.4 */
155 #undef _setjmp 147 #undef _setjmp
156 #define _setjmp setjmp 148 #define _setjmp setjmp