1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
42 #include <sys/types.h>
44 /* Make sockets of type AF_UNIX use underlying FS rights */
45 #if defined(__sun) && !defined(_XOPEN_SOURCE)
46 # define _XOPEN_SOURCE 500
47 # include <sys/socket.h>
50 # include <sys/socket.h>
53 #include <netinet/in.h>
54 #include <arpa/inet.h>
57 # include <sys/utsname.h>
67 # include <sys/file.h>
68 # include <sys/ioctl.h>
71 # include <netinet/tcp.h>
74 # include <sys/time.h>
75 # define IORESOURCE_TRANSFER_BSD
76 # define IOCHANNEL_TRANSFER_BSD_RENO
77 # define pthread_testcancel()
78 # define NO_PTHREAD_PRIORITY
79 # define PTHREAD_SIGACTION pthread_sigaction
82 # define ETIME ETIMEDOUT
90 # include <sys/file.h>
91 # include <sys/ioctl.h>
94 # include <netinet/tcp.h>
97 # include <sys/time.h>
98 # define IORESOURCE_TRANSFER_BSD
99 # define IOCHANNEL_TRANSFER_BSD_RENO
100 # define pthread_testcancel()
101 # define NO_PTHREAD_PRIORITY
102 # define NO_PTHREAD_RTL
103 # define PTHREAD_SIGACTION pthread_sigaction
106 # define ETIME ETIMEDOUT
108 # define SIGIOT SIGABRT
110 // hack: Haiku defines SOL_SOCKET as -1, but this makes GCC complain about
111 // narrowing conversion
113 # define SOL_SOCKET (sal_uInt32) -1
118 # include <pthread.h>
119 # include <sys/file.h>
120 # include <sys/ioctl.h>
121 # include <sys/uio.h>
123 # include <netinet/tcp.h>
126 # include <sys/time.h>
127 # define IORESOURCE_TRANSFER_BSD
128 # define IOCHANNEL_TRANSFER_BSD_RENO
129 # define pthread_testcancel()
130 # define NO_PTHREAD_PRIORITY
134 # define NO_PTHREAD_RTL
139 # define ETIME ETIMEDOUT
141 # include <pthread.h>
142 # include <sys/sem.h>
144 # include <sys/filio.h>
145 # include <sys/ioctl.h>
146 # include <sys/param.h>
147 # include <sys/time.h>
148 # include <sys/uio.h>
149 # include <sys/exec.h>
151 # include <vm/vm_param.h>
152 # include <vm/pmap.h>
153 # include <vm/swap_pager.h>
155 # include <netinet/tcp.h>
156 # define IORESOURCE_TRANSFER_BSD
157 # include <machine/endian.h>
158 # define NO_PTHREAD_RTL
162 # define ETIME ETIMEDOUT
163 # include <pthread.h>
164 # include <sys/sem.h>
166 # include <sys/filio.h>
167 # include <sys/ioctl.h>
168 # include <sys/param.h>
169 # include <sys/time.h>
170 # include <sys/uio.h>
171 # include <sys/exec.h>
173 # include <netinet/tcp.h>
174 # define IORESOURCE_TRANSFER_BSD
175 # include <machine/endian.h>
176 # define PTR_SIZE_T(s) ((size_t *)&(s))
177 # define IORESOURCE_TRANSFER_BSD
178 # define IOCHANNEL_TRANSFER_BSD_RENO
179 # define pthread_testcancel()
180 # define NO_PTHREAD_PRIORITY
181 # define NO_PTHREAD_RTL
182 # define PTHREAD_SIGACTION pthread_sigaction
185 #if defined(DRAGONFLY) || defined(NETBSD)
186 # define ETIME ETIMEDOUT
187 # include <pthread.h>
188 # include <sys/sem.h>
190 # include <sys/filio.h>
191 # include <sys/ioctl.h>
192 # include <sys/param.h>
193 # include <sys/time.h>
194 # include <sys/uio.h>
195 # include <sys/exec.h>
197 # include <netinet/tcp.h>
198 # include <machine/endian.h>
199 # define IORESOURCE_TRANSFER_BSD
200 # define IOCHANNEL_TRANSFER_BSD_RENO
206 # include <stropts.h>
207 # include <pthread.h>
208 # include <netinet/tcp.h>
209 # include <sys/filio.h>
211 # include <sys/isa_defs.h>
212 # define IORESOURCE_TRANSFER_SYSV
213 # define IOCHANNEL_TRANSFER_BSD
214 # define LIBPATH "LD_LIBRARY_PATH"
218 #define TimeValue CFTimeValue // Do not conflict with TimeValue in sal/inc/osl/time.h
219 #include <Carbon/Carbon.h>
222 # define ETIME ETIMEDOUT
225 # include <pthread.h>
226 # include <sys/file.h>
227 # include <sys/ioctl.h>
228 # include <sys/uio.h>
230 # include <netinet/tcp.h>
231 # include <machine/endian.h>
232 # include <sys/time.h>
233 # include <mach-o/dyld.h>
234 # define IOCHANNEL_TRANSFER_BSD_RENO
235 # define NO_PTHREAD_RTL
236 /* for NSGetArgc/Argv/Environ */
237 # include <crt_externs.h>
238 int macxp_resolveAlias(char *path
, int buflen
);
243 # define ETIME ETIMEDOUT
246 # include <pthread.h>
247 # include <sys/file.h>
248 # include <sys/ioctl.h>
249 # include <sys/uio.h>
251 # include <netinet/tcp.h>
252 # include <machine/endian.h>
253 # include <sys/time.h>
254 # define IOCHANNEL_TRANSFER_BSD_RENO
255 # define NO_PTHREAD_RTL
260 # define ETIME ETIMEDOUT
262 # include <pthread.h>
263 # include <sys/file.h>
264 # include <sys/ioctl.h>
265 # include <sys/uio.h>
267 # include <netinet/tcp.h>
270 # include <sys/time.h>
271 # define IORESOURCE_TRANSFER_BSD
272 # define IOCHANNEL_TRANSFER_BSD_RENO
273 # define pthread_testcancel()
274 # define NO_PTHREAD_PRIORITY
275 # define INIT_GROUPS(name, gid) false
278 #if !defined(_WIN32) && \
279 !defined(LINUX) && !defined(NETBSD) && !defined(FREEBSD) && \
280 !defined(__sun) && !defined(MACOSX) && \
281 !defined(OPENBSD) && !defined(DRAGONFLY) && \
282 !defined(IOS) && !defined(ANDROID) && \
283 !defined(HAIKU) && !defined(EMSCRIPTEN)
284 # error "Target platform not specified!"
288 # define PTR_FD_SET(s) (&(s))
291 #ifndef NORMALIZE_TIMESPEC
292 # define NORMALIZE_TIMESPEC(timespec) \
293 timespec . tv_sec += timespec . tv_nsec / 1000000000; \
294 timespec . tv_nsec %= 1000000000;
298 # define SET_TIMESPEC(timespec, sec, nsec) \
299 timespec . tv_sec = (sec); \
300 timespec . tv_nsec = (nsec); \
301 NORMALIZE_TIMESPEC(timespec);
304 #ifndef SLEEP_TIMESPEC
305 # define SLEEP_TIMESPEC(timespec) nanosleep(×pec, nullptr)
309 # define INIT_GROUPS(name, gid) ((setgid((gid)) == 0) && (initgroups((name), (gid)) == 0))
313 # define PTHREAD_NONE _pthread_none_
314 # ifndef PTHREAD_NONE_INIT
315 # define PTHREAD_NONE_INIT ((pthread_t)-1)
319 #ifndef PTHREAD_ATTR_DEFAULT
320 # define PTHREAD_ATTR_DEFAULT nullptr
322 #ifndef PTHREAD_MUTEXATTR_DEFAULT
323 # define PTHREAD_MUTEXATTR_DEFAULT nullptr
325 #ifndef PTHREAD_CONDATTR_DEFAULT
326 # define PTHREAD_CONDATTR_DEFAULT nullptr
329 #ifndef PTHREAD_SIGACTION
330 # define PTHREAD_SIGACTION sigaction
334 # define STAT_PARENT lstat
337 /* socket options which might not be defined on all unx flavors */
338 #ifndef SO_ACCEPTCONN
339 # define SO_ACCEPTCONN 0
342 # define SO_SNDLOWAT 0
345 # define SO_RCVLOWAT 0
348 # define SO_SNDTIMEO 0
351 # define SO_RCVTIMEO 0
353 #ifndef SO_USELOOPBACK
354 # define SO_USELOOPBACK 0
356 #ifndef MSG_MAXIOVLEN
357 # define MSG_MAXIOVLEN 0
361 /* dummy define and declarations for IPX should be replaced by */
362 /* original ipx headers when these are available for this platform */
364 #ifndef SA_FAMILY_DECL
365 # define SA_FAMILY_DECL short sa_family
368 #define NSPROTO_IPX 1000
369 #define NSPROTO_SPX 1256
370 #define NSPROTO_SPXII 1257
374 #ifdef NO_PTHREAD_RTL
377 struct passwd
*getpwent_r(struct passwd
*pwd
, char *buffer
, int buflen
);
379 extern struct spwd
*getspnam_r(const char *name
, struct spwd
*result
,
380 char *buffer
, int buflen
);
383 struct tm
*localtime_r(const time_t *timep
, struct tm
*buffer
);
384 struct tm
*gmtime_r(const time_t *timep
, struct tm
*buffer
);
386 #endif /* !defined(FREEBSD) */
389 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */