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 __OSL_SYSTEM_H__
21 #define __OSL_SYSTEM_H__
43 #include <sys/types.h>
45 /* Make sockets of type AF_UNIX use underlying FS rights */
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 # if __BYTE_ORDER == __LITTLE_ENDIAN
77 # define _LITTLE_ENDIAN
78 # elif __BYTE_ORDER == __BIG_ENDIAN
83 # define IORESOURCE_TRANSFER_BSD
84 # define IOCHANNEL_TRANSFER_BSD_RENO
85 # define pthread_testcancel()
86 # define NO_PTHREAD_PRIORITY
87 # define PTHREAD_SIGACTION pthread_sigaction
90 # define ETIME ETIMEDOUT
97 # include <sys/file.h>
98 # include <sys/ioctl.h>
101 # include <netinet/tcp.h>
104 # include <sys/time.h>
105 # define IORESOURCE_TRANSFER_BSD
106 # define IOCHANNEL_TRANSFER_BSD_RENO
107 # define pthread_testcancel()
108 # define NO_PTHREAD_PRIORITY
112 # define NO_PTHREAD_RTL
116 # define ETIME ETIMEDOUT
117 # include <pthread.h>
118 # include <sys/sem.h>
120 # include <sys/filio.h>
121 # include <sys/ioctl.h>
122 # include <sys/param.h>
123 # include <sys/time.h>
124 # include <sys/uio.h>
125 # include <sys/exec.h>
127 # include <vm/vm_param.h>
128 # include <vm/pmap.h>
129 # include <vm/swap_pager.h>
131 # include <netinet/tcp.h>
132 # define IORESOURCE_TRANSFER_BSD
133 # include <machine/endian.h>
134 #if __FreeBSD_version < 500000
135 # if BYTE_ORDER == LITTLE_ENDIAN
136 # define _LITTLE_ENDIAN
137 # elif BYTE_ORDER == BIG_ENDIAN
141 # define NO_PTHREAD_RTL
145 # define ETIME ETIMEDOUT
146 # include <pthread.h>
147 # include <sys/sem.h>
149 # include <sys/filio.h>
150 # include <sys/ioctl.h>
151 # include <sys/param.h>
152 # include <sys/time.h>
153 # include <sys/uio.h>
154 # include <sys/exec.h>
156 # include <netinet/tcp.h>
157 # define IORESOURCE_TRANSFER_BSD
158 # include <machine/endian.h>
159 # define PTR_SIZE_T(s) ((size_t *)&(s))
160 # define IORESOURCE_TRANSFER_BSD
161 # define IOCHANNEL_TRANSFER_BSD_RENO
162 # define pthread_testcancel()
163 # define NO_PTHREAD_PRIORITY
164 # define NO_PTHREAD_RTL
165 # define PTHREAD_SIGACTION pthread_sigaction
168 #if defined(DRAGONFLY) || defined(NETBSD)
169 # define ETIME ETIMEDOUT
170 # include <pthread.h>
171 # include <sys/sem.h>
173 # include <sys/filio.h>
174 # include <sys/ioctl.h>
175 # include <sys/param.h>
176 # include <sys/time.h>
177 # include <sys/uio.h>
178 # include <sys/exec.h>
180 # include <netinet/tcp.h>
181 # include <machine/endian.h>
182 # define IORESOURCE_TRANSFER_BSD
183 # define IOCHANNEL_TRANSFER_BSD_RENO
188 # include <strings.h>
189 # include <pthread.h>
191 # include <sys/time.h>
193 # include <netinet/tcp.h>
194 # include <sys/machine.h>
195 # if BYTE_ORDER == LITTLE_ENDIAN
196 # ifndef _LITTLE_ENDIAN
197 # define _LITTLE_ENDIAN
199 # elif BYTE_ORDER == BIG_ENDIAN
204 # define SLEEP_TIMESPEC(timespec) nsleep(×pec, 0)
205 # define LIBPATH "LIBPATH"
211 # include <stropts.h>
212 # include <pthread.h>
213 # include <netinet/tcp.h>
214 # include <sys/filio.h>
216 # include <sys/isa_defs.h>
217 # define IORESOURCE_TRANSFER_SYSV
218 # define IOCHANNEL_TRANSFER_BSD
219 # define LIBPATH "LD_LIBRARY_PATH"
223 #define __OPENTRANSPORTPROVIDERS__ // these are already defined
224 #define TimeValue CFTimeValue // Do not conflict with TimeValue in sal/inc/osl/time.h
225 #include <Carbon/Carbon.h>
228 # define ETIME ETIMEDOUT
231 # include <pthread.h>
232 # include <sys/file.h>
233 # include <sys/ioctl.h>
234 # include <sys/uio.h>
236 # include <netinet/tcp.h>
237 # include <machine/endian.h>
238 # include <sys/time.h>
239 /* fixme are premac and postmac still needed here? */
241 # include <mach-o/dyld.h>
242 # include <postmac.h>
243 # if BYTE_ORDER == LITTLE_ENDIAN
244 # ifndef _LITTLE_ENDIAN
245 # define _LITTLE_ENDIAN
247 # elif BYTE_ORDER == BIG_ENDIAN
252 # define IOCHANNEL_TRANSFER_BSD_RENO
253 # define NO_PTHREAD_RTL
254 /* for NSGetArgc/Argv/Environ */
255 # include <crt_externs.h>
259 int macxp_resolveAlias(char *path
, int buflen
);
267 # define ETIME ETIMEDOUT
270 # include <pthread.h>
271 # include <sys/file.h>
272 # include <sys/ioctl.h>
273 # include <sys/uio.h>
275 # include <netinet/tcp.h>
276 # include <machine/endian.h>
277 # include <sys/time.h>
278 # if BYTE_ORDER == LITTLE_ENDIAN
279 # ifndef _LITTLE_ENDIAN
280 # define _LITTLE_ENDIAN
282 # elif BYTE_ORDER == BIG_ENDIAN
287 # define IOCHANNEL_TRANSFER_BSD_RENO
288 # define NO_PTHREAD_RTL
291 #if !defined(_WIN32) && \
292 !defined(LINUX) && !defined(NETBSD) && !defined(FREEBSD) && \
294 !defined(SOLARIS) && !defined(MACOSX) && \
295 !defined(OPENBSD) && !defined(DRAGONFLY) && \
296 !defined(IOS) && !defined(ANDROID)
297 # error "Target platform not specified!"
301 # define PTR_FD_SET(s) (&(s))
304 #ifndef NORMALIZE_TIMESPEC
305 # define NORMALIZE_TIMESPEC(timespec) \
306 timespec . tv_sec += timespec . tv_nsec / 1000000000; \
307 timespec . tv_nsec %= 1000000000;
311 # define SET_TIMESPEC(timespec, sec, nsec) \
312 timespec . tv_sec = (sec); \
313 timespec . tv_nsec = (nsec); \
314 NORMALIZE_TIMESPEC(timespec);
317 #ifndef SLEEP_TIMESPEC
318 # define SLEEP_TIMESPEC(timespec) nanosleep(×pec, 0)
322 # define INIT_GROUPS(name, gid) ((setgid((gid)) == 0) && (initgroups((name), (gid)) == 0))
325 #ifndef PTHREAD_VALUE
326 # define PTHREAD_VALUE(t) (t)
329 # define PTHREAD_NONE _pthread_none_
330 # ifndef PTHREAD_NONE_INIT
331 # define PTHREAD_NONE_INIT ((pthread_t)-1)
335 #ifndef PTHREAD_ATTR_DEFAULT
336 # define PTHREAD_ATTR_DEFAULT NULL
338 #ifndef PTHREAD_MUTEXATTR_DEFAULT
339 # define PTHREAD_MUTEXATTR_DEFAULT NULL
341 #ifndef PTHREAD_CONDATTR_DEFAULT
342 # define PTHREAD_CONDATTR_DEFAULT NULL
345 #ifndef PTHREAD_SIGACTION
346 # define PTHREAD_SIGACTION sigaction
350 # define STAT_PARENT lstat
353 /* socket options which might not be defined on all unx flavors */
354 #ifndef SO_ACCEPTCONN
355 # define SO_ACCEPTCONN 0
358 # define SO_SNDLOWAT 0
361 # define SO_RCVLOWAT 0
364 # define SO_SNDTIMEO 0
367 # define SO_RCVTIMEO 0
369 #ifndef SO_USELOOPBACK
370 # define SO_USELOOPBACK 0
372 #ifndef MSG_MAXIOVLEN
373 # define MSG_MAXIOVLEN 0
377 /* dummy define and declarations for IPX should be replaced by */
378 /* original ipx headers when these are available for this platform */
380 #ifndef SA_FAMILY_DECL
381 # define SA_FAMILY_DECL short sa_family
384 typedef struct sockaddr_ipx
{
388 unsigned short sa_socket
;
391 #define NSPROTO_IPX 1000
392 #define NSPROTO_SPX 1256
393 #define NSPROTO_SPXII 1257
397 #ifdef NO_PTHREAD_RTL
398 #if !defined FREEBSD || (__FreeBSD_version < 500112)
400 struct passwd
*getpwent_r(struct passwd
*pwd
, char *buffer
, int buflen
);
402 extern struct spwd
*getspnam_r(const char *name
, struct spwd
*result
,
403 char *buffer
, int buflen
);
405 struct tm
*localtime_r(const time_t *timep
, struct tm
*buffer
);
406 struct tm
*gmtime_r(const time_t *timep
, struct tm
*buffer
);
407 #endif /* !defined FREEBSD || (__FreeBSD_version < 500112) */
408 #if !defined(FREEBSD) || (__FreeBSD_version < 601103)
409 struct hostent
*gethostbyname_r(const char *name
, struct hostent
*result
,
410 char *buffer
, size_t buflen
, int *h_errnop
);
411 #endif /* !defined(FREEBSD) || (__FreeBSD_version < 601103) */
414 #endif /* __OSL_SYSTEM_H__ */
416 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */