1/*
2 * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23#ifndef __FBSD_COMPAT__H_
24#define __FBSD_COMPAT__H_
25
26#include <stdint.h>
27
28#define	OFF_MAX		LLONG_MAX
29#define	OFF_MIN		LLONG_MIN
30#ifndef _BIG_ENDIAN
31#define	_BIG_ENDIAN	BIG_ENDIAN
32#endif /* _BIG_ENDIAN */
33#define	_BYTE_ORDER	BYTE_ORDER
34#define	_LITTLE_ENDIAN	LITTLE_ENDIAN
35#define	__ct_rune_t	ct_rune_t
36#define	__va_list	__darwin_va_list
37
38#define	__isthreaded	1
39
40#ifdef	_FLOCK_DEBUG
41#define _FLOCKFILE(x) _flockfile_debug(x, __FILE__, __LINE__)
42#else
43#define _FLOCKFILE(x) _flockfile(x)
44#endif
45
46#define	FLOCKFILE(fp) _FLOCKFILE(fp)
47#define	FUNLOCKFILE(fp) _funlockfile(fp)
48
49/*
50 * Do the opposite of FreeBSD namespace.h; that is, map the "hidden" names
51 * back to the real names.
52 */
53
54/*
55 * ISO C (C90) section.  Most names in libc aren't in ISO C, so they
56 * should be here.  Most aren't here...
57 */
58#define		_err				err
59#define		_warn				warn
60
61#define		_accept				accept
62#define		_bind				bind
63#define		_close				close
64#define		_connect			connect
65#define		_creat				creat
66#define		_dup				dup
67#define		_dup2				dup2
68#define		_execve				execve
69#define		_fcntl				fcntl
70/*#define		_flock				flock */
71#define		_flockfile			flockfile
72#define		_ftrylockfile			ftrylockfile
73#define		_fstat				fstat
74#define		_fstatfs			fstatfs
75#define		_fsync				fsync
76#define		_funlockfile			funlockfile
77#define		_getdirentries			getdirentries
78/* #define		_getlogin			getlogin */
79#define		_getpeername			getpeername
80#define		_getprogname			getprogname
81#define		_getsockname			getsockname
82#define		_getsockopt			getsockopt
83#define		_ioctl				ioctl
84/* #define		_kevent				kevent */
85#define		_listen				listen
86#define		_nanosleep			nanosleep
87#define		_open				open
88#define		_pause				pause
89#define		_poll				poll
90#define		_pthread_cond_broadcast		pthread_cond_broadcast
91#define		_pthread_cond_destroy		pthread_cond_destroy
92#define		_pthread_cond_init		pthread_cond_init
93#define		_pthread_cond_signal		pthread_cond_signal
94#define		_pthread_cond_timedwait		pthread_cond_timedwait
95#define		_pthread_cond_wait		pthread_cond_wait
96#define		_pthread_exit			pthread_exit
97#define		_pthread_getspecific		pthread_getspecific
98#define		_pthread_key_create		pthread_key_create
99#define		_pthread_key_delete		pthread_key_delete
100#define		_pthread_main_np		pthread_main_np
101#define		_pthread_mutex_destroy		pthread_mutex_destroy
102#define		_pthread_mutex_init		pthread_mutex_init
103#define		_pthread_mutex_lock		pthread_mutex_lock
104#define		_pthread_mutex_trylock		pthread_mutex_trylock
105#define		_pthread_mutex_unlock		pthread_mutex_unlock
106#define		_pthread_mutexattr_destroy	pthread_mutexattr_destroy
107#define		_pthread_mutexattr_init		pthread_mutexattr_init
108#define		_pthread_mutexattr_settype	pthread_mutexattr_settype
109#define		_pthread_once			pthread_once
110#define		_pthread_rwlock_destroy		pthread_rwlock_destroy
111#define		_pthread_rwlock_init		pthread_rwlock_init
112#define		_pthread_rwlock_rdlock		pthread_rwlock_rdlock
113#define		_pthread_rwlock_wrlock		pthread_rwlock_wrlock
114#define		_pthread_rwlock_tryrdlock	pthread_rwlock_tryrdlock
115#define		_pthread_rwlock_trywrlock	pthread_rwlock_trywrlock
116#define		_pthread_rwlock_unlock		pthread_rwlock_unlock
117#define		_pthread_self			pthread_self
118#define		_pthread_setspecific		pthread_setspecific
119#define		_pthread_sigmask		pthread_sigmask
120#define		_read				read
121#define		_readv				readv
122#define		_recvfrom			recvfrom
123#define		_recvmsg			recvmsg
124#define		_select				select
125#define		_sendmsg			sendmsg
126#define		_sendto				sendto
127#define		_setsockopt			setsockopt
128#define		_sigaction			sigaction
129#define		_sigprocmask			sigprocmask
130#define		_sigsuspend			sigsuspend
131#define		_sleep				sleep
132#define		_socket				socket
133#define		_socketpair			socketpair
134#define		_system				system
135#define		_tcdrain			tcdrain
136#define 	_usleep				usleep
137#define		_wait				wait
138#define		_wait4				wait4
139#define		_waitpid			waitpid
140#define		_write				write
141#define		_writev				writev
142
143#define		__creat				creat
144#define		__fmtcheck			fmtcheck
145#define		__inet_addr			inet_addr
146#define		__inet_aton			inet_aton
147#define		__inet_lnaof			inet_lnaof
148#define		__inet_makeaddr			inet_makeaddr
149#define		__inet_net_ntop			inet_net_ntop
150#define		__inet_net_pton			inet_net_pton
151#define		__inet_neta			inet_neta
152#define		__inet_netof			inet_netof
153#define		__inet_network			inet_network
154#define		__inet_nsap_addr		inet_nsap_addr
155#define		__inet_nsap_ntoa		inet_nsap_ntoa
156#define		__inet_ntoa			inet_ntoa
157#define		__inet_ntop			inet_ntop
158#define		__inet_pton			inet_pton
159#define		__makecontext			makecontext
160#define		__makecontext			makecontext
161#define		__pause				pause
162#define		__pselect			pselect
163#define		__raise				raise
164#define		__signalcontext			signalcontext
165#define		__sleep				sleep
166#define		__strtok_r			strtok_r
167#define		__swapcontext			swapcontext
168#define		__system			system
169#define		__tcdrain			tcdrain
170#define 	__usleep			usleep
171#define		__vfscanf			vfscanf
172#define		__wait				wait
173#define		__waitpid			waitpid
174
175#define	_GENERIC_DIRSIZ(dp) \
176    (((unsigned long)&((struct dirent *)0)->d_name + (dp)->d_namlen+1 + 3) & ~3)
177
178#endif /* __FBSD_COMPAT__H_ */
179