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 .
20 #ifndef INCLUDED_SAL_OSL_UNX_SYSTEM_HXX
21 #define INCLUDED_SAL_OSL_UNX_SYSTEM_HXX
43 #include <sys/types.h>
45 /* Make sockets of type AF_UNIX use underlying FS rights */
46 #if defined(__sun) && !defined(_XOPEN_SOURCE)
47 # define _XOPEN_SOURCE 500
48 # include <sys/socket.h>
51 # include <sys/socket.h>
54 #include <netinet/in.h>
55 #include <arpa/inet.h>
58 # include <sys/utsname.h>
68 # include <sys/file.h>
69 # include <sys/ioctl.h>
72 # include <netinet/tcp.h>
75 # include <sys/time.h>
76 # define IORESOURCE_TRANSFER_BSD
77 # define IOCHANNEL_TRANSFER_BSD_RENO
78 # define pthread_testcancel()
79 # define NO_PTHREAD_PRIORITY
80 # define PTHREAD_SIGACTION pthread_sigaction
83 # define ETIME ETIMEDOUT
91 # include <sys/file.h>
92 # include <sys/ioctl.h>
95 # include <netinet/tcp.h>
98 # include <sys/time.h>
99 # define IORESOURCE_TRANSFER_BSD
100 # define IOCHANNEL_TRANSFER_BSD_RENO
101 # define pthread_testcancel()
102 # define NO_PTHREAD_PRIORITY
103 # define NO_PTHREAD_RTL
104 # define PTHREAD_SIGACTION pthread_sigaction
107 # define ETIME ETIMEDOUT
109 # define SIGIOT SIGABRT
111 // hack: Haiku defines SOL_SOCKET as -1, but this makes GCC complain about
112 // narrowing conversion
114 # define SOL_SOCKET (sal_uInt32) -1
119 # include <pthread.h>
120 # include <sys/file.h>
121 # include <sys/ioctl.h>
122 # include <sys/uio.h>
124 # include <netinet/tcp.h>
127 # include <sys/time.h>
128 # define IORESOURCE_TRANSFER_BSD
129 # define IOCHANNEL_TRANSFER_BSD_RENO
130 # define pthread_testcancel()
131 # define NO_PTHREAD_PRIORITY
135 # define NO_PTHREAD_RTL
139 # define ETIME ETIMEDOUT
140 # include <pthread.h>
141 # include <sys/sem.h>
143 # include <sys/filio.h>
144 # include <sys/ioctl.h>
145 # include <sys/param.h>
146 # include <sys/time.h>
147 # include <sys/uio.h>
148 # include <sys/exec.h>
150 # include <vm/vm_param.h>
151 # include <vm/pmap.h>
152 # include <vm/swap_pager.h>
154 # include <netinet/tcp.h>
155 # define IORESOURCE_TRANSFER_BSD
156 # include <machine/endian.h>
157 # define NO_PTHREAD_RTL
161 # define ETIME ETIMEDOUT
162 # include <pthread.h>
163 # include <sys/sem.h>
165 # include <sys/filio.h>
166 # include <sys/ioctl.h>
167 # include <sys/param.h>
168 # include <sys/time.h>
169 # include <sys/uio.h>
170 # include <sys/exec.h>
172 # include <netinet/tcp.h>
173 # define IORESOURCE_TRANSFER_BSD
174 # include <machine/endian.h>
175 # define PTR_SIZE_T(s) ((size_t *)&(s))
176 # define IORESOURCE_TRANSFER_BSD
177 # define IOCHANNEL_TRANSFER_BSD_RENO
178 # define pthread_testcancel()
179 # define NO_PTHREAD_PRIORITY
180 # define NO_PTHREAD_RTL
181 # define PTHREAD_SIGACTION pthread_sigaction
184 #if defined(DRAGONFLY) || defined(NETBSD)
185 # define ETIME ETIMEDOUT
186 # include <pthread.h>
187 # include <sys/sem.h>
189 # include <sys/filio.h>
190 # include <sys/ioctl.h>
191 # include <sys/param.h>
192 # include <sys/time.h>
193 # include <sys/uio.h>
194 # include <sys/exec.h>
196 # include <netinet/tcp.h>
197 # include <machine/endian.h>
198 # define IORESOURCE_TRANSFER_BSD
199 # define IOCHANNEL_TRANSFER_BSD_RENO
204 # include <strings.h>
205 # include <pthread.h>
207 # include <sys/time.h>
209 # include <netinet/tcp.h>
210 # include <sys/machine.h>
211 # define SLEEP_TIMESPEC(timespec) nsleep(×pec, 0)
212 # define LIBPATH "LIBPATH"
218 # include <stropts.h>
219 # include <pthread.h>
220 # include <netinet/tcp.h>
221 # include <sys/filio.h>
223 # include <sys/isa_defs.h>
224 # define IORESOURCE_TRANSFER_SYSV
225 # define IOCHANNEL_TRANSFER_BSD
226 # define LIBPATH "LD_LIBRARY_PATH"
230 #define TimeValue CFTimeValue // Do not conflict with TimeValue in sal/inc/osl/time.h
231 #include <Carbon/Carbon.h>
234 # define ETIME ETIMEDOUT
237 # include <pthread.h>
238 # include <sys/file.h>
239 # include <sys/ioctl.h>
240 # include <sys/uio.h>
242 # include <netinet/tcp.h>
243 # include <machine/endian.h>
244 # include <sys/time.h>
245 # include <mach-o/dyld.h>
246 # define IOCHANNEL_TRANSFER_BSD_RENO
247 # define NO_PTHREAD_RTL
248 /* for NSGetArgc/Argv/Environ */
249 # include <crt_externs.h>
250 int macxp_resolveAlias(char *path
, int buflen
);
255 # define ETIME ETIMEDOUT
258 # include <pthread.h>
259 # include <sys/file.h>
260 # include <sys/ioctl.h>
261 # include <sys/uio.h>
263 # include <netinet/tcp.h>
264 # include <machine/endian.h>
265 # include <sys/time.h>
266 # define IOCHANNEL_TRANSFER_BSD_RENO
267 # define NO_PTHREAD_RTL
270 #if !defined(_WIN32) && \
271 !defined(LINUX) && !defined(NETBSD) && !defined(FREEBSD) && \
273 !defined(__sun) && !defined(MACOSX) && \
274 !defined(OPENBSD) && !defined(DRAGONFLY) && \
275 !defined(IOS) && !defined(ANDROID) && \
277 # error "Target platform not specified!"
281 # define PTR_FD_SET(s) (&(s))
284 #ifndef NORMALIZE_TIMESPEC
285 # define NORMALIZE_TIMESPEC(timespec) \
286 timespec . tv_sec += timespec . tv_nsec / 1000000000; \
287 timespec . tv_nsec %= 1000000000;
291 # define SET_TIMESPEC(timespec, sec, nsec) \
292 timespec . tv_sec = (sec); \
293 timespec . tv_nsec = (nsec); \
294 NORMALIZE_TIMESPEC(timespec);
297 #ifndef SLEEP_TIMESPEC
298 # define SLEEP_TIMESPEC(timespec) nanosleep(×pec, nullptr)
302 # define INIT_GROUPS(name, gid) ((setgid((gid)) == 0) && (initgroups((name), (gid)) == 0))
306 # define PTHREAD_NONE _pthread_none_
307 # ifndef PTHREAD_NONE_INIT
308 # define PTHREAD_NONE_INIT ((pthread_t)-1)
312 #ifndef PTHREAD_ATTR_DEFAULT
313 # define PTHREAD_ATTR_DEFAULT nullptr
315 #ifndef PTHREAD_MUTEXATTR_DEFAULT
316 # define PTHREAD_MUTEXATTR_DEFAULT nullptr
318 #ifndef PTHREAD_CONDATTR_DEFAULT
319 # define PTHREAD_CONDATTR_DEFAULT nullptr
322 #ifndef PTHREAD_SIGACTION
323 # define PTHREAD_SIGACTION sigaction
327 # define STAT_PARENT lstat
330 /* socket options which might not be defined on all unx flavors */
331 #ifndef SO_ACCEPTCONN
332 # define SO_ACCEPTCONN 0
335 # define SO_SNDLOWAT 0
338 # define SO_RCVLOWAT 0
341 # define SO_SNDTIMEO 0
344 # define SO_RCVTIMEO 0
346 #ifndef SO_USELOOPBACK
347 # define SO_USELOOPBACK 0
349 #ifndef MSG_MAXIOVLEN
350 # define MSG_MAXIOVLEN 0
354 /* dummy define and declarations for IPX should be replaced by */
355 /* original ipx headers when these are available for this platform */
357 #ifndef SA_FAMILY_DECL
358 # define SA_FAMILY_DECL short sa_family
361 #define NSPROTO_IPX 1000
362 #define NSPROTO_SPX 1256
363 #define NSPROTO_SPXII 1257
367 #ifdef NO_PTHREAD_RTL
370 struct passwd
*getpwent_r(struct passwd
*pwd
, char *buffer
, int buflen
);
372 extern struct spwd
*getspnam_r(const char *name
, struct spwd
*result
,
373 char *buffer
, int buflen
);
376 struct tm
*localtime_r(const time_t *timep
, struct tm
*buffer
);
377 struct tm
*gmtime_r(const time_t *timep
, struct tm
*buffer
);
379 struct hostent
*gethostbyname_r(const char *name
, struct hostent
*result
,
380 char *buffer
, size_t buflen
, int *h_errnop
);
381 #endif /* !defined(FREEBSD) */
384 #endif // INCLUDED_SAL_OSL_UNX_SYSTEM_H
386 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */