]> git.ipfire.org Git - thirdparty/squid.git/blob - compat/os/solaris.h
SourceFormat Enforcement
[thirdparty/squid.git] / compat / os / solaris.h
1 /*
2 * Copyright (C) 1996-2016 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9 #ifndef SQUID_OS_SOLARIS_H
10 #define SQUID_OS_SOLARIS_H
11
12 #if _SQUID_SOLARIS_
13
14 /*
15 * ugly hack. System headers require wcsstr, but don't define it.
16 */
17 #include <wchar.h>
18 #ifdef wcsstr
19 #undef wcsstr
20 #endif /* wcsstr */
21 #define wcsstr wcswcs
22
23 /*
24 * On Solaris 9 x86, gcc may includes a "fixed" set of old system
25 * include files that is incompatible with the updated Solaris
26 * header files.
27 */
28 #if defined(i386) || defined(__i386)
29 #if !HAVE_PAD128_T
30 typedef union {
31 long double _q;
32 int32_t _l[4];
33 } pad128_t;
34 #endif
35 #if !HAVE_UPAD128_T
36 typedef union {
37 long double _q;
38 uint32_t _l[4];
39 } upad128_t;
40 #endif
41 #endif
42
43 /**
44 * prototypes for system function missing from system includes
45 * NP: sys/resource.h and sys/time.h are apparently order-dependant.
46 */
47 #include <sys/time.h>
48 #include <sys/resource.h>
49 SQUIDCEXTERN int getrusage(int, struct rusage *);
50
51 /**
52 * prototypes for system function missing from system includes
53 * on some Solaris systems.
54 */
55 SQUIDCEXTERN int getpagesize(void);
56 #if !defined(_XPG4_2) && !(defined(__EXTENSIONS__) || \
57 (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)))
58 SQUIDCEXTERN int gethostname(char *, int);
59 #endif
60
61 /*
62 * SunPro CC handles extern inline as inline, PLUS extern symbols.
63 */
64 #if !defined(_SQUID_EXTERNNEW_) && defined(__SUNPRO_CC)
65 #define _SQUID_EXTERNNEW_ extern
66 #endif
67
68 /*
69 * SunStudio CC does not define C++ portability API __FUNCTION__
70 */
71 #if defined(__SUNPRO_CC) && !defined(__FUNCTION__)
72 #define __FUNCTION__ ""
73 #endif
74
75 /* Bug 2500: Solaris 10/11 require s6_addr* defines. */
76 //#define s6_addr8 _S6_un._S6_u8
77 //#define s6_addr16 _S6_un._S6_u16
78 #define s6_addr32 _S6_un._S6_u32
79
80 /* Bug 3057: Solaris 9 defines struct addrinfo with size_t instead of socklen_t
81 * this causes binary incompatibility on 64-bit systems.
82 * Fix this by bundling a copy of the OpenSolaris 10 netdb.h to use instead.
83 */
84 #if defined(__sparcv9)
85 #include "compat/os/opensolaris_10_netdb.h"
86 #endif
87
88 /* Solaris 10 lacks SUN_LEN */
89 #if !defined(SUN_LEN)
90 #define SUN_LEN(su) (sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path))
91 #endif
92
93 /* Soaris 10 does not define POSIX AF_LOCAL, but does define the Unix name */
94 #if !defined(AF_LOCAL)
95 #define AF_LOCAL AF_UNIX
96 #endif
97
98 /* Solaris lacks paths.h by default */
99 #if HAVE_PATHS_H
100 #include <paths.h>
101 #endif
102 #if !defined(_PATH_DEVNULL)
103 #define _PATH_DEVNULL "/dev/null"
104 #endif
105
106 #endif /* _SQUID_SOLARIS_ */
107 #endif /* SQUID_OS_SOALRIS_H */
108