1 /*
2  * Copyright (c) 1997, 1998, 1999, 2000, 2001, 2004, 2008, 2009, 2010, 2011,
3  *               2012, 2013
4  *      Inferno Nettverk A/S, Norway.  All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. The above copyright notice, this list of conditions and the following
10  *    disclaimer must appear in all copies of the software, derivative works
11  *    or modified versions, and any portions thereof, aswell as in all
12  *    supporting documentation.
13  * 2. All advertising materials mentioning features or use of this software
14  *    must display the following acknowledgement:
15  *      This product includes software developed by
16  *      Inferno Nettverk A/S, Norway.
17  * 3. The name of the author may not be used to endorse or promote products
18  *    derived from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30  *
31  * Inferno Nettverk A/S requests users of this software to return to
32  *
33  *  Software Distribution Coordinator  or  sdc@inet.no
34  *  Inferno Nettverk A/S
35  *  Oslo Research Park
36  *  Gaustadall�en 21
37  *  NO-0349 Oslo
38  *  Norway
39  *
40  * any improvements or extensions that they make and grant Inferno Nettverk A/S
41  * the rights to redistribute these changes.
42  *
43  */
44 
45 /* $Id: symbols.h,v 1.17 2013/10/27 15:24:41 karls Exp $ */
46 
47 #ifndef LIBRARY_PATH
48 #define LIBRARY_PATH ""
49 #endif /* !LIBRARY_PATH */
50 
51 #ifndef LIBRARY_LIBC
52 #define LIBRARY_LIBC                        __CONCAT(LIBRARY_PATH, "libc.so")
53 #endif /* !LIBRARY_LIBC */
54 
55 #if HAVE_NO_SYMBOL_UNDERSCORE
56 #define SYMBOLPREFIX ""
57 #else
58 #define SYMBOLPREFIX "_"
59 #endif /* HAVE_NO_SYMBOL_UNDERSCORE */
60 
61 #define SYMBOL_ACCEPT          SYMBOLPREFIX "accept"
62 #define SYMBOL_BIND            SYMBOLPREFIX "bind"
63 #define SYMBOL_BINDRESVPORT    SYMBOLPREFIX "bindresvport"
64 #define SYMBOL_CONNECT         SYMBOLPREFIX "connect"
65 #define SYMBOL_FREEHOSTENT     SYMBOLPREFIX "freehostent"
66 #define SYMBOL_GETADDRINFO     SYMBOLPREFIX "getaddrinfo"
67 #define SYMBOL_GETNAMEINFO     SYMBOLPREFIX "getnameinfo"
68 #define SYMBOL_GETHOSTBYADDR   SYMBOLPREFIX "gethostbyaddr"
69 #define SYMBOL_GETHOSTBYNAME   SYMBOLPREFIX "gethostbyname"
70 #define SYMBOL_GETHOSTBYNAME2  SYMBOLPREFIX "gethostbyname2"
71 #define SYMBOL_GETIPNODEBYNAME SYMBOLPREFIX "getipnodebyname"
72 #define SYMBOL_GETPEERNAME     SYMBOLPREFIX "getpeername"
73 #define SYMBOL_GETSOCKNAME     SYMBOLPREFIX "getsockname"
74 #define SYMBOL_GETSOCKOPT      SYMBOLPREFIX "getsockopt"
75 #define SYMBOL_LISTEN          SYMBOLPREFIX "listen"
76 #define SYMBOL_READ            SYMBOLPREFIX "read"
77 #define SYMBOL_READV           SYMBOLPREFIX "readv"
78 #define SYMBOL_RECV            SYMBOLPREFIX "recv"
79 #define SYMBOL_RECVFROM        SYMBOLPREFIX "recvfrom"
80 #define SYMBOL_RECVMSG         SYMBOLPREFIX "recvmsg"
81 #define SYMBOL_RRESVPORT       SYMBOLPREFIX "rresvport"
82 #define SYMBOL_SEND            SYMBOLPREFIX "send"
83 #define SYMBOL_SENDMSG         SYMBOLPREFIX "sendmsg"
84 #define SYMBOL_SENDTO          SYMBOLPREFIX "sendto"
85 #define SYMBOL_WRITE           SYMBOLPREFIX "write"
86 #define SYMBOL_WRITEV          SYMBOLPREFIX "writev"
87 
88 #ifndef LIBRARY_ACCEPT
89 #define LIBRARY_ACCEPT                      LIBRARY_LIBC
90 #endif /* !LIBRARY_ACCEPT */
91 
92 #ifndef LIBRARY_BIND
93 #define LIBRARY_BIND                        LIBRARY_LIBC
94 #endif /* !LIBRARY_BIND */
95 
96 #ifndef LIBRARY_BINDRESVPORT
97 #define LIBRARY_BINDRESVPORT                LIBRARY_LIBC
98 #endif /* !LIBRARY_BINDRESVPORT */
99 
100 #ifndef LIBRARY_CONNECT
101 #define LIBRARY_CONNECT                     LIBRARY_LIBC
102 #endif /* !LIBRARY_CONNECT */
103 
104 #ifndef LIBRARY_GETHOSTBYADDR
105 #define LIBRARY_GETHOSTBYADDR               LIBRARY_LIBC
106 #endif /* !LIBRARY_GETHOSTBYADDR */
107 
108 #ifndef LIBRARY_GETHOSTBYNAME
109 #define LIBRARY_GETHOSTBYNAME               LIBRARY_LIBC
110 #endif /* !LIBRARY_GETHOSTBYNAME */
111 
112 #ifndef LIBRARY_GETHOSTBYNAME2
113 #define LIBRARY_GETHOSTBYNAME2              LIBRARY_LIBC
114 #endif /* !LIBRARY_GETHOSTBYNAME2 */
115 
116 #ifndef LIBRARY_GETADDRINFO
117 #define LIBRARY_GETADDRINFO                 LIBRARY_LIBC
118 #endif /* !LIBRARY_GETADDRINFO */
119 
120 #ifndef LIBRARY_GETNAMEINFO
121 #define LIBRARY_GETNAMEINFO                 LIBRARY_LIBC
122 #endif /* !LIBRARY_GETNAMEINFO */
123 
124 #ifndef LIBRARY_GETIPNODEBYNAME
125 #define LIBRARY_GETIPNODEBYNAME             LIBRARY_LIBC
126 #endif /* !LIBRARY_GETIPNODEBYNAME */
127 
128 #ifndef LIBRARY_FREEHOSTENT
129 #define LIBRARY_FREEHOSTENT                 LIBRARY_LIBC
130 #endif /* !LIBRARY_FREEHOSTENT */
131 
132 #ifndef LIBRARY_GETPEERNAME
133 #define LIBRARY_GETPEERNAME                 LIBRARY_LIBC
134 #endif /* !LIBRARY_GETPEERNAME */
135 
136 #ifndef LIBRARY_GETSOCKNAME
137 #define LIBRARY_GETSOCKNAME                 LIBRARY_LIBC
138 #endif /* !LIBRARY_GETSOCKNAME */
139 
140 #ifndef LIBRARY_GETSOCKOPT
141 #define LIBRARY_GETSOCKOPT                  LIBRARY_LIBC
142 #endif /* !LIBRARY_GETSOCKOPT */
143 
144 #ifndef LIBRARY_LISTEN
145 #define LIBRARY_LISTEN                      LIBRARY_LIBC
146 #endif /* !LIBRARY_LISTEN */
147 
148 #ifndef LIBRARY_READ
149 #define LIBRARY_READ                        LIBRARY_LIBC
150 #endif /* !LIBRARY_READ */
151 
152 #ifndef LIBRARY_READV
153 #define LIBRARY_READV                       LIBRARY_LIBC
154 #endif /* !LIBRARY_READV */
155 
156 #ifndef LIBRARY_RECV
157 #define LIBRARY_RECV                        LIBRARY_LIBC
158 #endif /* !LIBRARY_RECV */
159 
160 #ifndef LIBRARY_RECVFROM
161 #define LIBRARY_RECVFROM                    LIBRARY_LIBC
162 #endif /* !LIBRARY_RECVFROM */
163 
164 #ifndef LIBRARY_RECVMSG
165 #define LIBRARY_RECVMSG                     LIBRARY_LIBC
166 #endif /* !LIBRARY_RECVMSG */
167 
168 #ifndef LIBRARY_RRESVPORT
169 #define LIBRARY_RRESVPORT                   LIBRARY_LIBC
170 #endif /* !LIBRARY_RRESVPORT */
171 
172 #ifndef LIBRARY_SEND
173 #define LIBRARY_SEND                        LIBRARY_LIBC
174 #endif /* !LIBRARY_SEND */
175 
176 #ifndef LIBRARY_SENDMSG
177 #define LIBRARY_SENDMSG                     LIBRARY_LIBC
178 #endif /* !LIBRARY_SENDMSG */
179 
180 #ifndef LIBRARY_SENDTO
181 #define LIBRARY_SENDTO                      LIBRARY_LIBC
182 #endif /* !LIBRARY_SENDTO */
183 
184 #ifndef LIBRARY_WRITE
185 #define LIBRARY_WRITE                       LIBRARY_LIBC
186 #endif /* !LIBRARY_WRITE */
187 
188 #ifndef LIBRARY_WRITEV
189 #define LIBRARY_WRITEV                      LIBRARY_LIBC
190 #endif /* !LIBRARY_WRITEV */
191 
192 
193 /*
194  * workaround for lacking preload support inside libc on linux
195  */
196 
197 #if HAVE_GSSAPI && HAVE_LINUX_GLIBC_WORKAROUND
198 
199 #define SYMBOL_GETC            SYMBOLPREFIX "getc"
200 #define SYMBOL_FGETC           SYMBOLPREFIX "fgetc"
201 #define SYMBOL_GETS            SYMBOLPREFIX "gets"
202 #define SYMBOL_FGETS           SYMBOLPREFIX "fgets"
203 #define SYMBOL_PUTC            SYMBOLPREFIX "putc"
204 #define SYMBOL_FPUTC           SYMBOLPREFIX "fputc"
205 #define SYMBOL_PUTS            SYMBOLPREFIX "puts"
206 #define SYMBOL_FPUTS           SYMBOLPREFIX "fputs"
207 #define SYMBOL_FFLUSH          SYMBOLPREFIX "fflush"
208 #define SYMBOL_FCLOSE          SYMBOLPREFIX "fclose"
209 #define SYMBOL_PRINTF          SYMBOLPREFIX "printf"
210 #define SYMBOL_VPRINTF         SYMBOLPREFIX "vprintf"
211 #define SYMBOL_FPRINTF         SYMBOLPREFIX "fprintf"
212 #define SYMBOL_VFPRINTF        SYMBOLPREFIX "vfprintf"
213 #define SYMBOL_FWRITE          SYMBOLPREFIX "fwrite"
214 #define SYMBOL_FREAD           SYMBOLPREFIX "fread"
215 
216 #ifndef LIBRARY_GETC
217 #define LIBRARY_GETC                        LIBRARY_LIBC
218 #endif /* !LIBRARY_GETC */
219 
220 #ifndef LIBRARY_FGETC
221 #define LIBRARY_FGETC                       LIBRARY_LIBC
222 #endif /* !LIBRARY_FGETC */
223 
224 #ifndef LIBRARY_GETS
225 #define LIBRARY_GETS                        LIBRARY_LIBC
226 #endif /* !LIBRARY_GETS */
227 
228 #ifndef LIBRARY_FGETS
229 #define LIBRARY_FGETS                       LIBRARY_LIBC
230 #endif /* !LIBRARY_FGETS */
231 
232 #ifndef LIBRARY_PUTC
233 #define LIBRARY_PUTC                        LIBRARY_LIBC
234 #endif /* !LIBRARY_PUTC */
235 
236 #ifndef LIBRARY_FPUTC
237 #define LIBRARY_FPUTC                       LIBRARY_LIBC
238 #endif /* !LIBRARY_FPUTC */
239 
240 #ifndef LIBRARY_PUTS
241 #define LIBRARY_PUTS                        LIBRARY_LIBC
242 #endif /* !LIBRARY_PUTS */
243 
244 #ifndef LIBRARY_FPUTS
245 #define LIBRARY_FPUTS                       LIBRARY_LIBC
246 #endif /* !LIBRARY_FPUTS */
247 
248 #ifndef LIBRARY_FFLUSH
249 #define LIBRARY_FFLUSH                      LIBRARY_LIBC
250 #endif /* !LIBRARY_FFLUSH */
251 
252 #ifndef LIBRARY_FCLOSE
253 #define LIBRARY_FCLOSE                      LIBRARY_LIBC
254 #endif /* !LIBRARY_FCLOSE */
255 
256 #ifndef LIBRARY_PRINTF
257 #define LIBRARY_PRINTF                      LIBRARY_LIBC
258 #endif /* !LIBRARY_PRINTF */
259 
260 #ifndef LIBRARY_VPRINTF
261 #define LIBRARY_VPRINTF                     LIBRARY_LIBC
262 #endif /* !LIBRARY_VPRINTF */
263 
264 #ifndef LIBRARY_FPRINTF
265 #define LIBRARY_FPRINTF                     LIBRARY_LIBC
266 #endif /* !LIBRARY_FPRINTF */
267 
268 #ifndef LIBRARY_VFPRINTF
269 #define LIBRARY_VFPRINTF                    LIBRARY_LIBC
270 #endif /* !LIBRARY_VFPRINTF */
271 
272 #ifndef LIBRARY_FWRITE
273 #define LIBRARY_FWRITE                      LIBRARY_LIBC
274 #endif /* !LIBRARY_FWRITE */
275 
276 #ifndef LIBRARY_FREAD
277 #define LIBRARY_FREAD                       LIBRARY_LIBC
278 #endif /* !LIBRARY_FREAD */
279 
280 #if HAVE___FPRINTF_CHK
281 #define SYMBOL___FPRINTF_CHK   SYMBOLPREFIX "__fprintf_chk"
282 #endif /* HAVE___FPRINTF_CHK */
283 
284 #if HAVE___VFPRINTF_CHK
285 #define SYMBOL___VFPRINTF_CHK  SYMBOLPREFIX "__vfprintf_chk"
286 #endif /* HAVE___VFPRINTF_CHK */
287 
288 #if HAVE___READ_CHK
289 #define SYMBOL___READ_CHK  SYMBOLPREFIX "__read_chk"
290 #endif /* HAVE___READ_CHK */
291 
292 #if HAVE__IO_GETC
293 #define SYMBOL__IO_GETC        SYMBOLPREFIX "_IO_getc"
294 #endif /* HAVE__IO_GETC */
295 
296 #if HAVE__IO_PUTC
297 #define SYMBOL__IO_PUTC        SYMBOLPREFIX "_IO_putc"
298 #endif /* HAVE__IO_PUTC */
299 
300 #if HAVE___FPRINTF_CHK
301 #ifndef LIBRARY___FPRINTF_CHK
302 #define LIBRARY___FPRINTF_CHK               LIBRARY_LIBC
303 #endif /* !LIBRARY___FPRINTF_CHK */
304 #endif /* HAVE___FPRINTF_CHK */
305 
306 #if HAVE___VFPRINTF_CHK
307 #ifndef LIBRARY___VFPRINTF_CHK
308 #define LIBRARY___VFPRINTF_CHK              LIBRARY_LIBC
309 #endif /* !LIBRARY___VFPRINTF_CHK */
310 #endif /* HAVE___VFPRINTF_CHK */
311 
312 #if HAVE___READ_CHK
313 #ifndef LIBRARY___READ_CHK
314 #define LIBRARY___READ_CHK              LIBRARY_LIBC
315 #endif /* !LIBRARY___ReAD_CHK */
316 #endif /* HAVE___READ_CHK */
317 
318 #if HAVE__IO_GETC
319 #ifndef LIBRARY__IO_GETC
320 #define LIBRARY__IO_GETC                    LIBRARY_LIBC
321 #endif /* !LIBRARY__IO_GETC */
322 #endif /* HAVE__IO_GETC */
323 
324 #if HAVE__IO_PUTC
325 #ifndef LIBRARY__IO_PUTC
326 #define LIBRARY__IO_PUTC                    LIBRARY_LIBC
327 #endif /* !LIBRARY__IO_PUTC */
328 #endif /* HAVE__IO_PUTC */
329 
330 #endif /* HAVE_GSSAPI && HAVE_LINUX_GLIBC_WORKAROUND */
331 
332 
333 /*
334  * additional symbols needed for OSF
335  */
336 
337 #if HAVE_EXTRA_OSF_SYMBOLS
338 
339 #define SYMBOL_EACCEPT                      "_Eaccept"
340 #define SYMBOL_EGETPEERNAME                 "_Egetpeername"
341 #define SYMBOL_EGETSOCKNAME                 "_Egetsockname"
342 #define SYMBOL_EREADV                       "_Ereadv"
343 #define SYMBOL_ERECVFROM                    "_Erecvfrom"
344 #define SYMBOL_ERECVMSG                     "_Erecvmsg"
345 #define SYMBOL_ESENDMSG                     "_Esendmsg"
346 #define SYMBOL_EWRITEV                      "_Ewritev"
347 
348 #ifndef LIBRARY_EACCEPT
349 #define LIBRARY_EACCEPT                     LIBRARY_LIBC
350 #endif /* !LIBRARY_EACCEPT */
351 
352 #ifndef LIBRARY_EGETPEERNAME
353 #define LIBRARY_EGETPEERNAME                LIBRARY_LIBC
354 #endif /* !LIBRARY_EGETPEERNAME */
355 
356 #ifndef LIBRARY_EGETSOCKNAME
357 #define LIBRARY_EGETSOCKNAME                LIBRARY_LIBC
358 #endif /* !LIBRARY_EGETSOCKNAME */
359 
360 #ifndef LIBRARY_EREADV
361 #define LIBRARY_EREADV                      LIBRARY_LIBC
362 #endif /* !LIBRARY_EREADV */
363 
364 #ifndef LIBRARY_ERECVFROM
365 #define LIBRARY_ERECVFROM                   LIBRARY_LIBC
366 #endif /* !LIBRARY_ERECVFROM */
367 
368 #ifndef LIBRARY_ERECVMSG
369 #define LIBRARY_ERECVMSG                    LIBRARY_LIBC
370 #endif /* !LIBRARY_ERECVMSG */
371 
372 #ifndef LIBRARY_ESENDMSG
373 #define LIBRARY_ESENDMSG                    LIBRARY_LIBC
374 #endif /* !LIBRARY_ESENDMSG */
375 
376 #ifndef LIBRARY_EWRITEV
377 #define LIBRARY_EWRITEV                     LIBRARY_LIBC
378 #endif /* !LIBRARY_EWRITEV */
379 
380 /* more OSF functions */
381 
382 #define SYMBOL_NACCEPT                      "naccept"
383 #define SYMBOL_NGETPEERNAME                 "ngetpeername"
384 #define SYMBOL_NGETSOCKNAME                 "ngetsockname"
385 #define SYMBOL_NRECVFROM                    "nrecvfrom"
386 #define SYMBOL_NRECVMSG                     "nrecvmsg"
387 #define SYMBOL_NSENDMSG                     "nsendmsg"
388 
389 #ifndef LIBRARY_NACCEPT
390 #define LIBRARY_NACCEPT                     LIBRARY_LIBC
391 #endif /* !LIBRARY_NACCEPT */
392 
393 #ifndef LIBRARY_NGETPEERNAME
394 #define LIBRARY_NGETPEERNAME                LIBRARY_LIBC
395 #endif /* !LIBRARY_NGETPEERNAME */
396 
397 #ifndef LIBRARY_NGETSOCKNAME
398 #define LIBRARY_NGETSOCKNAME                LIBRARY_LIBC
399 #endif /* !LIBRARY_NGETSOCKNAME */
400 
401 #ifndef LIBRARY_NRECVFROM
402 #define LIBRARY_NRECVFROM                   LIBRARY_LIBC
403 #endif /* !LIBRARY_NRECVFROM */
404 
405 #ifndef LIBRARY_NRECVMSG
406 #define LIBRARY_NRECVMSG                    LIBRARY_LIBC
407 #endif /* !LIBRARY_NRECVMSG */
408 
409 #ifndef LIBRARY_NSENDMSG
410 #define LIBRARY_NSENDMSG                    LIBRARY_LIBC
411 #endif /* !LIBRARY_NSENDMSG */
412 
413 #endif  /* HAVE_EXTRA_OSF_SYMBOLS */
414 
415 
416 /*
417  * additional Solaris functions
418  */
419 
420 #ifdef __sun
421 #define SYMBOL_XNET_BIND                    "__xnet_bind"
422 #define SYMBOL_XNET_CONNECT                 "__xnet_connect"
423 #define SYMBOL_XNET_LISTEN                  "__xnet_listen"
424 #define SYMBOL_XNET_RECVMSG                 "__xnet_recvmsg"
425 #define SYMBOL_XNET_SENDMSG                 "__xnet_sendmsg"
426 #define SYMBOL_XNET_SENDTO                  "__xnet_sendto"
427 #endif /* __sun */
428 
429 
430 /*
431  * additional Darwin symbols
432  */
433 
434 #if HAVE_DARWIN
435 
436 #define SYMBOL_CONNECT_NOCANCEL "connect$NOCANCEL"
437 #define SYMBOL_READ_NOCANCEL "read$NOCANCEL"
438 #define SYMBOL_RECVFROM_NOCANCEL "recvfrom$NOCANCEL"
439 #define SYMBOL_SENDTO_NOCANCEL "sendto$NOCANCEL"
440 #define SYMBOL_WRITE_NOCANCEL "write$NOCANCEL"
441 
442 #endif /* HAVE_DARWIN */
443 
444 
445 /*
446  * pthread functions
447  */
448 
449 #if HAVE_PTHREAD_H
450 
451 #define SYMBOL_PT_INIT         SYMBOLPREFIX "pthread_mutex_init"
452 #define SYMBOL_PT_ATTRINIT     SYMBOLPREFIX "pthread_mutexattr_init"
453 #define SYMBOL_PT_SETTYPE      SYMBOLPREFIX "pthread_mutexattr_settype"
454 #define SYMBOL_PT_LOCK         SYMBOLPREFIX "pthread_mutex_lock"
455 #define SYMBOL_PT_UNLOCK       SYMBOLPREFIX "pthread_mutex_unlock"
456 #define SYMBOL_PT_SELF         SYMBOLPREFIX "pthread_self"
457 
458 #ifndef LIBRARY_PTHREAD
459 #define LIBRARY_PTHREAD                     LIBRARY_LIBC
460 #endif /* !LIBRARY_PTHREAD */
461 
462 #endif /* HAVE_PTHREAD_H */
463