]> git.ipfire.org Git - thirdparty/squid.git/blob - compat/os/solaris.h
07de191a3168bf0b87323db65942451fbe1ab0ee
[thirdparty/squid.git] / compat / os / solaris.h
1 /*
2 * Copyright (C) 1996-2023 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 *--------------------------------------------------------------------------*
16 * DO *NOT* MAKE ANY CHANGES below here unless you know what you're doing...*
17 *--------------------------------------------------------------------------*
18 ****************************************************************************/
19
20 /*
21 * ugly hack. System headers require wcsstr, but don't define it.
22 */
23 #include <wchar.h>
24 #ifdef wcsstr
25 #undef wcsstr
26 #endif /* wcsstr */
27 #define wcsstr wcswcs
28
29 /*
30 * On Solaris 9 x86, gcc may includes a "fixed" set of old system
31 * include files that is incompatible with the updated Solaris
32 * header files.
33 */
34 #if defined(i386) || defined(__i386)
35 #if !HAVE_PAD128_T
36 typedef union {
37 long double _q;
38 int32_t _l[4];
39 } pad128_t;
40 #endif
41 #if !HAVE_UPAD128_T
42 typedef union {
43 long double _q;
44 uint32_t _l[4];
45 } upad128_t;
46 #endif
47 #endif
48
49 /**
50 * prototypes for system function missing from system includes
51 * NP: sys/resource.h and sys/time.h are apparently order-dependant.
52 */
53 #include <sys/time.h>
54 #include <sys/resource.h>
55 SQUIDCEXTERN int getrusage(int, struct rusage *);
56
57 #if defined(__SUNPRO_CC)
58 // Solaris 11 needs this before <sys/socket.h> to get the definition for msg_control
59 // and possibly other type definitions we do not know about specifically
60 #define _XPG4_2 1
61 #include <sys/socket.h>
62 #endif
63
64 /**
65 * prototypes for system function missing from system includes
66 * on some Solaris systems.
67 */
68 SQUIDCEXTERN int getpagesize(void);
69 #if !defined(_XPG4_2) && !(defined(__EXTENSIONS__) || \
70 (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)))
71 SQUIDCEXTERN int gethostname(char *, int);
72 #endif
73
74 /* Bug 2500: Solaris 10/11 require s6_addr* defines. */
75 //#define s6_addr8 _S6_un._S6_u8
76 //#define s6_addr16 _S6_un._S6_u16
77 #define s6_addr32 _S6_un._S6_u32
78
79 /* Solaris 10 lacks SUN_LEN */
80 #if !defined(SUN_LEN)
81 #define SUN_LEN(su) (sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path))
82 #endif
83
84 /* Soaris 10 does not define POSIX AF_LOCAL, but does define the Unix name */
85 #if !defined(AF_LOCAL)
86 #define AF_LOCAL AF_UNIX
87 #endif
88
89 /* Solaris lacks paths.h by default */
90 #if HAVE_PATHS_H
91 #include <paths.h>
92 #endif
93 #if !defined(_PATH_DEVNULL)
94 #define _PATH_DEVNULL "/dev/null"
95 #endif
96
97 #endif /* _SQUID_SOLARIS_ */
98 #endif /* SQUID_OS_SOALRIS_H */
99