summaryrefslogtreecommitdiff
path: root/devel/linuxthreads/files/freebsd-compat.h
blob: 83041c3dfcff9835305942e6e255a629eb98634f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
#include <poll.h>
#include <bits/local_lim.h>
#include <sys/queue.h>
#include <sched.h>
#include <sys/types.h>
#include <sys/time.h>


#if __FreeBSD__ >= 5
#define __libc_accept __sys_accept
#define __libc_close __sys_close
#define __libc_connect __sys_connect
#define __libc_fcntl __sys_fcntl
#define __libc_fork __sys_fork
#define __libc_fsync __sys_fsync
#define __libc_nanosleep __sys_nanosleep
#define __libc_open __sys_open
#define __libc_read __sys_read
#define __libc_waitpid __waitpid
#define __libc_write __sys_write
#define __libc_longjmp __longjmp
#define __libc_siglongjmp __siglongjmp
#define __libc_msync __sys_msync
#define __libc_recvfrom __sys_recvfrom
#define __libc_recvmsg __sys_recvmsg
#define __libc_sendmsg __sys_sendmsg
#define __libc_sendto __sys_sendto
#define __libc_sigaction __sys_sigaction
#define __libc_poll __sys_poll
#define __libc_getpid __sys_getpid
#else
#define __libc_accept _accept
#define __libc_close _close
#define __libc_connect _connect
#define __libc_fcntl _fcntl
#define __libc_fork _fork
#define __libc_fsync _fsync
#define __libc_nanosleep _nanosleep
#define __libc_open _open
#define __libc_read _read
#define __libc_waitpid __waitpid
#define __libc_write _write
#define __libc_longjmp __longjmp
#define __libc_siglongjmp __siglongjmp
#define __libc_msync _msync
#define __libc_recvfrom _recvfrom
#define __libc_recvmsg _recvmsg
#define __libc_sendmsg _sendmsg
#define __libc_sendto _sendto
#define __libc_sigaction _sigaction
#define __libc_poll _poll
#define __libc_getpid _getpid
#endif
#define __libc_wait __wait
#define __libc_system __system
#define __getpid __libc_getpid
#define __poll __libc_poll
#define __libc_tcdrain __tcdrain
#define __libc_pause __pause
#define __libc_current_sigrtmin current_sigrtmin
#define __libc_current_sigrtmax current_sigrtmax
#define __libc_allocate_rtsig allocate_rtsig
#define __getpagesize getpagesize
#define __sched_param sched_param
#define __sched_get_priority_min sched_get_priority_min
#define __sched_get_priority_max sched_get_priority_max
#define __sched_setscheduler sched_setscheduler
#define __sched_getscheduler sched_getscheduler
#define __sched_getparam sched_getparam
#define __gettimeofday _gettimeofday
#define __jmp_buf jmp_buf
#define _h_errno h_errno
#define __ptr_t void *
#define __pid_t pid_t

ssize_t __libc_write(int, const void *, size_t);
ssize_t __libc_read(int, void *, size_t);
pid_t   __libc_waitpid(pid_t wpid, int *status, int options);
int	__libc_poll(struct pollfd *_pfd, unsigned int _nfsd, int _timeout);
pid_t	__libc_getpid(void);
pid_t	__libc_waitpid(pid_t, int *, int);
int	__libc_sigaction(int, const struct sigaction *, struct sigaction *);
int	__libc_fcntl(int, int, ...);
int	__libc_fsync(int);
int     __libc_msync(void *, size_t, int);
int     __libc_open(const char *, int, ...);
int     __libc_pause(void);
ssize_t __libc_pwrite(int, const void *, size_t, off_t);
ssize_t __libc_pread(int, void *, size_t, off_t);
int     __libc_tcdrain(int);
pid_t   __libc_wait(int *);
int     __libc_system(const char *);
int     __libc_accept(int s, struct sockaddr *addr, socklen_t *addrlen);
int	__libc_connect(int, const struct sockaddr *, socklen_t);
ssize_t __libc_recvfrom(int, void *, size_t, int, struct sockaddr *,
			socklen_t *);
ssize_t __libc_recvmsg(int, struct msghdr *, int);
ssize_t __libc_sendmsg(int, const struct msghdr *, int);
ssize_t __libc_sendto(int, const void *,
		      size_t, int, const struct sockaddr *, socklen_t);

#ifndef __P
#   define __P(args)	args
#endif

#ifndef __THROW
#define __THROW
#endif

#ifndef __restrict
#define __restrict
#endif

#define SHLIB_COMPAT(lib, old, new) 0

#define versioned_symbol(libname, realname, aliasname, libver) __strong_reference(realname,aliasname)

#define link_warning(symbol, warning) __warn_references(symbol, warning);

#ifndef __PMT
#  define __PMT(args)	args
#endif

# define strong_alias(name, aliasname) \
  extern __typeof (name) aliasname __attribute__ ((alias (#name)));

#  define weak_alias(name, aliasname) \
  extern __typeof (name) aliasname __attribute__ ((weak, alias (#name)));

#define ENOTSUP EOPNOTSUPP

#define __builtin_expect(x,y) (x)
#define internal_function


#undef PAGE_SIZE 
#define PAGE_SIZE getpagesize()

#define MAP_ANONYMOUS MAP_ANON
#define MAP_GROWSDOWN MAP_STACK

#define __WCLONE WLINUXCLONE

#define SIGCONTEXT struct sigcontext * 
#define SIGCONTEXT_EXTRA_ARGS

# define __WAIT_STATUS_DEFN	int *

# define __SOCKADDR_ARG		struct sockaddr *
# define __CONST_SOCKADDR_ARG	__const struct sockaddr *

#define __ptr_t void *
#define __pid_t pid_t

/* Test if longjmp to JMPBUF would unwind the frame
   containing a local variable at ADDRESS.  */

/* XXXX check this for FreeBSD */
/* i386 only */
#define JB_SP	2
#define _JMPBUF_UNWINDS(jmpbuf, address) \
  ((void *) (address) < (void *) ((int *)(jmpbuf[0]._jb[JB_SP]))[1])

#define spinlock_t int
#define _SPINLOCK_INITIALIZER 0
#define _SPINLOCK(x) __pthread_acquire(x)
#define _SPINUNLOCK(x) *(x) = 0
/*#define TEST_FOR_COMPARE_AND_SWAP*/

#define __set_errno(val) errno = (val)

#define DEFAULT_PRIORITY 20

void	__libc_longjmp __P((jmp_buf, int)) __dead2;
void	__libc_siglongjmp __P((sigjmp_buf, int)) __dead2;

int	_gettimeofday __P((struct timeval *, struct timezone *));
pid_t	_getpid __P((void));
int	_sigaction __P((int, const struct sigaction *, struct sigaction *));
int	_poll __P((struct pollfd *_pfd, unsigned _nfds, int _timeout));

#include "clone.h"