]> git.ipfire.org Git - thirdparty/squid.git/blob - compat/os/solaris.h
adc630fbe2315f9816d3b723d3a959084426727d
[thirdparty/squid.git] / compat / os / solaris.h
1 /*
2 * Copyright (C) 1996-2017 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 // Solaris 11 needs this before <sys/socket.h> to get the definition for msg_control
52 // and possibly other type definitions we dont know about specifically
53 #define _XPG4_2 1
54 #include <sys/socket.h>
55
56 /**
57 * prototypes for system function missing from system includes
58 * on some Solaris systems.
59 */
60 SQUIDCEXTERN int getpagesize(void);
61 #if !defined(_XPG4_2) && !(defined(__EXTENSIONS__) || \
62 (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)))
63 SQUIDCEXTERN int gethostname(char *, int);
64 #endif
65
66 /*
67 * SunStudio CC does not define C++ portability API __FUNCTION__
68 */
69 #if defined(__SUNPRO_CC) && !defined(__FUNCTION__)
70 #define __FUNCTION__ ""
71 #endif
72
73 /* Bug 2500: Solaris 10/11 require s6_addr* defines. */
74 //#define s6_addr8 _S6_un._S6_u8
75 //#define s6_addr16 _S6_un._S6_u16
76 #define s6_addr32 _S6_un._S6_u32
77
78 /* Bug 3057: Solaris 9 defines struct addrinfo with size_t instead of socklen_t
79 * this causes binary incompatibility on 64-bit systems.
80 * Fix this by bundling a copy of the OpenSolaris 10 netdb.h to use instead.
81 */
82 #if defined(__sparcv9)
83 #include "compat/os/opensolaris_10_netdb.h"
84 #endif
85
86 /* Solaris 10 lacks SUN_LEN */
87 #if !defined(SUN_LEN)
88 #define SUN_LEN(su) (sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path))
89 #endif
90
91 /* Soaris 10 does not define POSIX AF_LOCAL, but does define the Unix name */
92 #if !defined(AF_LOCAL)
93 #define AF_LOCAL AF_UNIX
94 #endif
95
96 /* Solaris lacks paths.h by default */
97 #if HAVE_PATHS_H
98 #include <paths.h>
99 #endif
100 #if !defined(_PATH_DEVNULL)
101 #define _PATH_DEVNULL "/dev/null"
102 #endif
103
104 #endif /* _SQUID_SOLARIS_ */
105 #endif /* SQUID_OS_SOALRIS_H */
106