fix prevent violation
[framework/system/dynamic-analysis-probe.git] / probe_socket / libdasocket.c
1 /*
2  *  DA probe
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: 
7  *
8  * Jaewon Lim <jaewon81.lim@samsung.com>
9  * Woojin Jung <woojin2.jung@samsung.com>
10  * Juyoung Kim <j0.kim@samsung.com>
11  * 
12  * This library is free software; you can redistribute it and/or modify it under
13  * the terms of the GNU Lesser General Public License as published by the
14  * Free Software Foundation; either version 2.1 of the License, or (at your option)
15  * any later version.
16  * 
17  * This library is distributed in the hope that it will be useful, but WITHOUT ANY
18  * WARRANTY; without even the implied warranty of MERCHANTABILITY or
19  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
20  * License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public License
23  * along with this library; if not, write to the Free Software Foundation, Inc., 51
24  * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25  *
26  * Contributors:
27  * - S-Core Co., Ltd
28  * 
29  */
30
31 #include <stdio.h>
32 #include <stdlib.h>
33 #include <string.h>
34 #include <dlfcn.h>
35 #include <stdbool.h>
36
37 #include <sys/types.h>
38 #include <sys/socket.h>
39 #include <netdb.h>
40 #include <ifaddrs.h>
41 #include <arpa/inet.h>
42
43 #include <errno.h>
44 #include "daprobe.h"
45 #include "probeinfo.h"
46 #include "dautil.h"
47 #include "dahelper.h"
48 #include "da_socket.h"
49
50 static enum DaOptions _sopt = OPT_FILE;
51
52 int socket(int domain, int type, int protocol)
53 {
54         static int (*socketp)(int domain, int type, int protocol);
55         
56         BEFORE_ORIGINAL_NOFILTER(socket, LIBC);
57
58         ret = socketp(domain, type, protocol);
59         
60         POST_PROBEBLOCK_BEGIN(LC_RESOURCE, VT_INT, ret, "%d, %d, %d", domain, type, protocol);
61         POST_PROBEBLOCK_MIDDLE_SOCK(0, ret, FD_API_OPEN, "");
62         APPEND_LOG_CALLSTACK();
63         POST_PROBEBLOCK_END();
64
65         return ret;
66 }
67
68 int socketpair(int domain, int type, int protocol,int socket_vector[2])
69 {
70         static int (*socketpairp)(int domain, int type, int protocol,int socket_vector[2]);
71         
72         BEFORE_ORIGINAL_NOFILTER(socketpair, LIBC);
73         
74         ret = socketpairp(domain, type, protocol, socket_vector);
75         
76         POST_PROBEBLOCK_BEGIN(LC_RESOURCE, VT_INT, ret,
77                         "%d, %d, %d, %p", domain, type, protocol, socket_vector);
78         log.length += sprintf(log.data + log.length, "`,%u`,%d/%d`,%d`,%d`,0`,%s",
79                         0, socket_vector[0], socket_vector[1], FD_SOCKET, FD_API_OPEN, "");
80         APPEND_LOG_CALLSTACK();
81         POST_PROBEBLOCK_END();
82         
83         return ret;
84 }
85
86 int shutdown(int socket, int how)
87 {
88         static int (*shutdownp)(int socket, int how);
89         
90         BEFORE_ORIGINAL_NOFILTER(shutdown, LIBC);
91         
92         ret = shutdownp(socket, how);
93         
94         AFTER_ORIGINAL_SOCK(0, socket, FD_API_OTHER, "%d, %d", socket, how);
95
96         return ret;
97 }
98
99 int bind(int socket, const struct sockaddr *address, socklen_t address_len)
100 {
101         static int (*bindp)(int socket, const struct sockaddr *address, socklen_t address_len);
102         
103         BEFORE_ORIGINAL(bind, LIBC);
104         
105         ret = bindp(socket, address, address_len);
106
107         AFTER_ORIGINAL_SOCK(0, socket, FD_API_MANAGE,
108                         "%d, %p, %d", socket, address, address_len);
109         
110         return ret;
111 }
112
113 int listen(int socket, int backlog)
114 {
115         static int (*listenp)(int socket, int backlog);
116         
117         BEFORE_ORIGINAL(listen, LIBC);
118         
119         ret = listenp(socket, backlog);
120         
121         AFTER_ORIGINAL_SOCK(0, socket, FD_API_MANAGE, "%d, %d", socket, backlog);
122
123         return ret;
124 }
125
126 int accept(int socket, struct sockaddr *address, socklen_t *address_len)
127 {
128         static int (*acceptp)(int socket, struct sockaddr *address, socklen_t *address_len);
129         
130         BEFORE_ORIGINAL_NOFILTER(accept, LIBC);
131         
132         ret = acceptp(socket, address, address_len);
133         
134         AFTER_ORIGINAL_SOCK(0, socket, FD_API_MANAGE,
135                         "%d, %p, %p", socket, address, address_len);
136         
137         return ret;
138 }
139
140 int accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags)
141 {
142         static int (*accept4p)(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags);
143         
144         BEFORE_ORIGINAL_NOFILTER(accept4, LIBC);
145         
146         ret = accept4p(sockfd, addr, addrlen, flags);
147         
148         AFTER_ORIGINAL_SOCK(0, sockfd, FD_API_MANAGE,
149                         "%d, %p, %p, %d", sockfd, addr, addrlen, flags);
150
151         return ret;
152 }
153
154 int connect(int socket, const struct sockaddr *address, socklen_t address_len)
155 {
156         static int (*connectp)(int socket, const struct sockaddr *address, socklen_t address_len);
157         
158         BEFORE_ORIGINAL(connect, LIBC);
159         
160         ret = connectp(socket, address, address_len);
161         
162         AFTER_ORIGINAL_SOCK(address_len, socket, FD_API_MANAGE,
163                         "%d, %p, %d", socket, address, address_len);
164         
165         return ret;
166 }
167
168 int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout)
169 {
170         static int (*selectp)(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
171         
172         BEFORE_ORIGINAL(select, LIBC);
173         
174         ret = selectp(nfds, readfds, writefds,exceptfds, timeout);
175         
176         AFTER_ORIGINAL_SOCK(0, nfds, FD_API_MANAGE,
177                         "%d, %p, %p, %p, %p", nfds, readfds, writefds, exceptfds, timeout);
178                         
179         return ret;
180 }
181
182 int pselect(int nfds, fd_set *readfds, fd_set *writefds,fd_set *exceptfds, const struct timespec *ntimeout, const sigset_t *sigmask)
183 {
184         static int (*pselectp)(int nfds, fd_set *readfds, fd_set *writefds,fd_set *exceptfds, const struct timespec *ntimeout, const sigset_t *sigmask);
185
186         BEFORE_ORIGINAL(pselect, LIBC);
187         
188         ret = pselectp(nfds, readfds, writefds,exceptfds, ntimeout, sigmask);
189         
190         AFTER_ORIGINAL_SOCK(0, nfds, FD_API_MANAGE,     "%d, %p, %p, %p, %p, %p",
191                         nfds, readfds, writefds, exceptfds, ntimeout, sigmask);
192  
193         return ret;
194 }
195
196 ssize_t send(int socket, const void *message, size_t length, int flags)
197 {
198         static ssize_t (*sendp)(int socket, const void *message, size_t length, int flags);
199         ssize_t sret;
200  
201         BEFORE_ORIGINAL(send, LIBC);
202         
203         sret = sendp(socket, message, length, flags);
204         
205         AFTER_ORIGINAL_SOCK_RET(VT_SSIZE_T, sret, sret, socket, FD_API_SEND,
206                         "%d, %p, %u, %d", socket, message, length, flags);
207         
208         return sret;
209 }
210
211 ssize_t sendmsg(int socket, const struct msghdr *message, int flags)
212 {
213         static ssize_t (*sendmsgp)(int socket, const struct msghdr *message, int flags);
214         ssize_t sret;
215  
216         BEFORE_ORIGINAL(sendmsg, LIBC);
217         
218         sret = sendmsgp(socket, message, flags);
219         
220         AFTER_ORIGINAL_SOCK_RET(VT_SSIZE_T, sret, sret, socket, FD_API_SEND,
221                         "%d, %p, %d", socket, message, flags);
222  
223         return sret;
224 }
225
226 ssize_t sendto(int socket, const void *message, size_t length, int flags,const struct sockaddr *dest_addr, socklen_t dest_len)
227 {
228         static ssize_t (*sendtop)(int socket, const void *message, size_t length, int flags,const struct sockaddr *dest_addr, socklen_t dest_len);
229         ssize_t sret;
230  
231         BEFORE_ORIGINAL(sendto, LIBC);
232         
233         sret = sendtop(socket, message, length, flags, dest_addr, dest_len);
234         
235         AFTER_ORIGINAL_SOCK_RET(VT_SSIZE_T, sret, sret, socket, FD_API_SEND,
236                         "%d, %p, %u, %d, %p, %d", socket, message, length, flags, dest_addr, dest_len);
237  
238         return sret;
239 }
240
241 ssize_t recv(int socket, void *buffer, size_t length, int flags)
242 {
243         static ssize_t (*recvp)(int socket, void *buffer, size_t length, int flags);
244         ssize_t sret;
245  
246         BEFORE_ORIGINAL(recv, LIBC);
247
248         sret = recvp(socket, buffer, length, flags);
249         
250         AFTER_ORIGINAL_SOCK_RET(VT_SSIZE_T, sret, sret, socket, FD_API_RECEIVE,
251                         "%d, %p, %u, %d", socket, buffer, length, flags);
252         
253         return sret;
254 }
255
256 ssize_t recvfrom(int socket, void *buffer, size_t length, int flags, struct sockaddr *address, socklen_t *address_len)
257 {
258         static ssize_t (*recvfromp)(int socket, void *buffer, size_t length, int flags, struct sockaddr *address, socklen_t *address_len);
259         ssize_t sret;
260
261         BEFORE_ORIGINAL(recvfrom, LIBC);
262         
263         sret = recvfromp(socket, buffer, length, flags, address, address_len);
264         
265         AFTER_ORIGINAL_SOCK_RET(VT_SSIZE_T, sret, sret, socket, FD_API_RECEIVE,
266                         "%d, %p, %u, %d, %p, %p", socket, buffer, length, flags, address, address_len);
267
268         return sret;
269 }
270
271 ssize_t recvmsg(int socket, struct msghdr *message, int flags)
272 {
273         static ssize_t (*recvmsgp)(int socket, struct msghdr *message, int flags);
274         ssize_t sret;
275  
276         BEFORE_ORIGINAL(recvmsg, LIBC);
277         
278         sret = recvmsgp(socket, message, flags);
279                 
280         AFTER_ORIGINAL_SOCK_RET(VT_SSIZE_T, sret, sret, socket, FD_API_RECEIVE,
281                         "%d, %p, %d", socket, message, flags);
282
283         return sret;
284 }
285
286 uint32_t htonl(uint32_t hostlong)
287 {
288         static uint32_t (*htonlp)(uint32_t hostlong);
289         uint32_t uret;
290  
291         BEFORE_ORIGINAL(htonl, LIBC);
292         
293         uret = htonlp(hostlong);
294                         
295         AFTER_ORIGINAL_NOSOCK_RET(VT_UINT32_T, uret, 0, FD_API_OTHER, "%u", hostlong); 
296  
297         return uret;
298 }
299
300 uint16_t htons(uint16_t hostshort)
301 {
302         static uint16_t (*htonsp)(uint16_t hostshort);
303         uint16_t uret;
304  
305         BEFORE_ORIGINAL(htons, LIBC);
306         
307         uret = htonsp(hostshort);
308                                 
309         AFTER_ORIGINAL_NOSOCK_RET(VT_UINT16_T, uret, 0, FD_API_OTHER, "%u", hostshort); 
310  
311         return uret;
312 }
313
314 uint32_t ntohl(uint32_t netlong)
315 {
316         static uint32_t (*ntohlp)(uint32_t netlong);
317         uint32_t uret;
318  
319         BEFORE_ORIGINAL(ntohl, LIBC);
320         
321         uret = ntohlp(netlong);
322                                 
323         AFTER_ORIGINAL_NOSOCK_RET(VT_UINT32_T, uret, 0, FD_API_OTHER, "%u", netlong); 
324
325         return uret;
326 }
327
328 uint16_t ntohs(uint16_t netshort)
329 {
330         static uint16_t (*ntohsp)(uint16_t netshort);
331         uint16_t uret;
332  
333         BEFORE_ORIGINAL(ntohs, LIBC);
334         
335         uret = ntohsp(netshort);
336                                 
337         AFTER_ORIGINAL_NOSOCK_RET(VT_UINT16_T, uret, 0, FD_API_OTHER, "%u", netshort); 
338
339         return uret;
340 }
341
342 #if 0
343 uint16_t htobe16(uint16_t host_16bits)
344 {
345         static uint16_t (*htobe16p)(uint16_t host_16bits);
346         uint16_t uret;
347  
348         BEFORE_ORIGINAL(htobe16, LIBC);
349         
350         uret = htobe16p(host_16bits);
351                                 
352         AFTER_ORIGINAL_NOSOCK_RET(VT_UINT16_T, uret, 0, FD_API_OTHER, "%u", host_16bits); 
353
354         return uret;
355 }
356
357 uint16_t htole16(uint16_t host_16bits)
358 {
359         static uint16_t (*htole16p)(uint16_t host_16bits);
360         uint16_t uret;
361  
362         BEFORE_ORIGINAL(htole16, LIBC);
363         
364         uret = htole16p(host_16bits);
365                                 
366         AFTER_ORIGINAL_NOSOCK_RET(VT_UINT16_T, uret, 0, FD_API_OTHER, "%u", host_16bits); 
367
368         return uret;
369 }
370
371 uint16_t be16toh(uint16_t big_endian_16bits)
372 {
373         static uint16_t (*be16tohp)(uint16_t big_endian_16bits);
374         uint16_t uret;
375  
376         BEFORE_ORIGINAL(be16toh, LIBC);
377         
378         uret = be16tohp(big_endian_16bits);
379                                 
380         AFTER_ORIGINAL_NOSOCK_RET(VT_UINT16_T, uret, 0, FD_API_OTHER,
381                         "%u", big_endian_16bits); 
382  
383         return uret;
384 }
385
386 uint16_t le16toh(uint16_t little_endian_16bits)
387 {
388         static uint16_t (*le16tohp)(uint16_t little_endian_16bits);
389         uint16_t uret;
390  
391         BEFORE_ORIGINAL(le16toh, LIBC);
392         
393         uret = le16tohp(little_endian_16bits);
394                                 
395         AFTER_ORIGINAL_NOSOCK_RET(VT_UINT16_T, uret, 0, FD_API_OTHER,
396                         "%u", little_endian_16bits); 
397  
398         return uret;
399 }
400
401 uint32_t htobe32(uint32_t host_32bits)
402 {
403         static uint32_t (*htobe32p)(uint32_t host_32bits);
404         uint32_t uret;
405  
406         BEFORE_ORIGINAL(htobe32, LIBC);
407
408         uret = htobe32p(host_32bits);
409  
410         AFTER_ORIGINAL_NOSOCK_RET(VT_UINT32_T, uret, 0, FD_API_OTHER,
411                         "%u", host_32bits); 
412
413         return uret;
414 }
415
416 uint32_t htole32(uint32_t host_32bits)
417 {
418         static uint32_t (*htole32p)(uint32_t host_32bits);
419         uint32_t uret;
420  
421         BEFORE_ORIGINAL(htole32, LIBC);
422
423         uret = htole32p(host_32bits);
424  
425         AFTER_ORIGINAL_NOSOCK_RET(VT_UINT32_T, uret, 0, FD_API_OTHER,
426                         "%u", host_32bits); 
427
428         return uret;
429 }
430
431 uint32_t be32toh(uint32_t big_endian_32bits)
432 {
433         static uint32_t (*be32tohp)(uint32_t big_endian_32bits);
434         uint32_t uret;
435  
436         BEFORE_ORIGINAL(be32toh, LIBC);
437
438         uret = be32tohp(big_endian_32bits);
439  
440         AFTER_ORIGINAL_NOSOCK_RET(VT_UINT32_T, uret, 0, FD_API_OTHER,
441                         "%u", big_endian_32bits); 
442
443         return uret;
444 }
445
446 uint32_t le32toh(uint32_t little_endian_32bits)
447 {
448         static uint32_t (*le32tohp)(uint32_t little_endian_32bits);
449         uint32_t uret;
450  
451         BEFORE_ORIGINAL(le32toh, LIBC);
452
453         uret = le32tohp(little_endian_32bits);
454  
455         AFTER_ORIGINAL_NOSOCK_RET(VT_UINT32_T, uret, 0, FD_API_OTHER,
456                         "%u", little_endian_32bits); 
457
458         return uret;
459 }
460
461 uint64_t htobe64(uint64_t host_64bits)
462 {
463         static uint64_t (*htobe64p)(uint64_t host_64bits);
464         uint64_t uret;
465
466         BEFORE_ORIGINAL(htobe64, LIBC);
467
468         uret = htobe64p(host_64bits);
469  
470         AFTER_ORIGINAL_NOSOCK_RET(VT_UINT64_T, uret, 0, FD_API_OTHER,
471                         "%u", host_64bits); 
472
473         return uret;
474 }
475
476 uint64_t htole64(uint64_t host_64bits)
477 {
478         static uint64_t (*htole64p)(uint64_t host_64bits);
479         uint64_t uret;
480  
481         BEFORE_ORIGINAL(htole64, LIBC);
482
483         uret = htole64p(host_64bits);
484  
485         AFTER_ORIGINAL_NOSOCK_RET(VT_UINT64_T, uret, 0, FD_API_OTHER,
486                         "%u", host_64bits); 
487
488         return uret;
489 }
490
491 uint64_t be64toh(uint64_t big_endian_64bits)
492 {
493         static uint64_t (*be64tohp)(uint64_t big_endian_64bits);
494         uint64_t uret;
495  
496         BEFORE_ORIGINAL(be64toh, LIBC);
497
498         uret = be64tohp(big_endian_64bits);
499  
500         AFTER_ORIGINAL_NOSOCK_RET(VT_UINT64_T, uret, 0, FD_API_OTHER,
501                         "%u", big_endian_64bits); 
502
503         return uret;
504 }
505
506 uint64_t le64toh(uint64_t little_endian_64bits)
507 {
508         static uint64_t (*le64tohp)(uint64_t little_endian_64bits);
509         uint64_t uret;
510  
511         BEFORE_ORIGINAL(le64toh, LIBC);
512
513         uret = le64tohp(little_endian_64bits);
514  
515         AFTER_ORIGINAL_NOSOCK_RET(VT_UINT64_T, uret, 0, FD_API_OTHER,
516                         "%u", little_endian_64bits); 
517
518         return uret;
519 }
520 #endif
521
522 #if 1
523 int inet_aton(const char *cp, struct in_addr *inp)
524 {
525         static int (*inet_atonp)(const char *cp, struct in_addr *inp);
526
527         BEFORE_ORIGINAL(inet_aton, LIBC);
528         
529         ret = inet_atonp(cp,inp);
530
531         AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %p", cp, inp);
532  
533         return ret;
534 }
535
536 in_addr_t inet_addr(const char *cp)
537 {
538         static in_addr_t (*inet_addrp)(const char *cp);
539         in_addr_t iret;
540  
541         BEFORE_ORIGINAL(inet_addr, LIBC);
542  
543         iret = inet_addrp(cp);
544         
545         AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, iret, 0, FD_API_OTHER, "%p", cp);
546         
547         return iret;
548 }
549
550 in_addr_t inet_network(const char *cp)
551 {
552         static in_addr_t (*inet_networkp)(const char *cp);
553         in_addr_t iret;
554  
555         BEFORE_ORIGINAL(inet_network, LIBC);
556  
557         iret = inet_networkp(cp);
558  
559         AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, iret, 0, FD_API_OTHER, "%p", cp);
560
561         return iret;
562 }
563
564 char *inet_ntoa(struct in_addr in)
565 {
566         static char * (*inet_ntoap)(struct in_addr in);
567         char* sret;
568  
569         BEFORE_ORIGINAL(inet_ntoa, LIBC);
570  
571         sret = inet_ntoap(in);
572
573         AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, sret, 0, FD_API_OTHER, "%u", in.s_addr);
574  
575         return sret;
576 }
577
578 #if 0
579 struct in_addr inet_makeaddr(int net, int host)
580 {
581         static struct in_addr (*inet_makeaddrp)(int net, int host);
582         struct in_addr iret;
583  
584         BEFORE_ORIGINAL(inet_makeaddr, LIBC);
585  
586         iret = inet_makeaddrp(net,host);
587  
588         AFTER_ORIGINAL_NOSOCK_RET(VT_UINT32_T, iret.s_addr, 0, FD_API_OTHER,
589                         "%d, %d", net, host);
590
591         return iret;
592 }
593 #endif
594
595 in_addr_t inet_lnaof(struct in_addr in)
596 {
597         static in_addr_t (*inet_lnaofp)(struct in_addr in);
598         in_addr_t iret;
599  
600         BEFORE_ORIGINAL(inet_lnaof, LIBC);
601  
602         iret = inet_lnaofp(in);
603
604         AFTER_ORIGINAL_NOSOCK_RET(VT_UINT32_T, iret, 0, FD_API_OTHER, "%u", in.s_addr);
605  
606         return iret;
607 }
608
609 in_addr_t inet_netof(struct in_addr in)
610 {
611         static in_addr_t (*inet_netofp)(struct in_addr in);
612         in_addr_t iret;
613  
614         BEFORE_ORIGINAL(inet_netof, LIBC);
615  
616         iret = inet_netofp(in);
617
618         AFTER_ORIGINAL_NOSOCK_RET(VT_UINT32_T, iret, 0, FD_API_OTHER, "%u", in.s_addr);
619  
620         return iret;
621 }
622
623 const char *inet_ntop(int af, const void *src, char *dst, socklen_t size)
624 {
625         static const char* (*inet_ntopp)(int af, const void *src, char *dst, socklen_t size);
626         const char* cret;
627  
628         BEFORE_ORIGINAL(inet_ntop, LIBC);
629  
630         cret = inet_ntopp(af, src, dst, size);
631
632         AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, cret, size, FD_API_OTHER,
633                         "%d, %p, %p, %d", af, src, dst, size);
634  
635         return cret;
636 }
637
638 int inet_pton(int af, const char *src, void *dst)
639 {
640         static int (*inet_ptonp)(int af, const char *src, void *dst);
641  
642         BEFORE_ORIGINAL(inet_pton, LIBC);
643  
644         ret = inet_ptonp(af, src, dst);
645
646         AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%d, %p, %p", af, src, dst);
647  
648         return ret;
649 }
650
651 int getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res)
652 {
653         static int (*getaddrinfop)(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res);
654  
655         BEFORE_ORIGINAL_NOFILTER(getaddrinfo, LIBC);
656  
657         ret = getaddrinfop(node, service, hints, res);
658
659         AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %p, %p, %p", node, service, hints, res);
660
661         return ret;
662 }
663
664 void freeaddrinfo(struct addrinfo *res)
665 {
666         static void (*freeaddrinfop)(struct addrinfo *res);
667
668         BEFORE_ORIGINAL_NOFILTER(freeaddrinfo, LIBC);
669  
670         freeaddrinfop(res);
671
672         AFTER_ORIGINAL_NOSOCK_RET(VT_NULL, NULL, 0, FD_API_OTHER, "%p", res);
673 }
674
675 const char *gai_strerror(int errcode)
676 {
677         static const char * (*gai_strerrorp)(int errcode);
678         const char * cret;
679  
680         BEFORE_ORIGINAL(gai_strerror, LIBC);
681  
682         cret = gai_strerrorp(errcode);
683
684         AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, cret, 0, FD_API_OTHER, "%d", errcode);
685
686         return cret;
687 }
688
689 int gai_suspend(const struct gaicb* const list[], int nitems, const struct timespec *timeout)
690 {
691         static int (*gai_suspendp)(const struct gaicb* const list[], int nitems, const struct timespec *timeout);
692
693         BEFORE_ORIGINAL(gai_suspend, LIBC);
694  
695         ret = gai_suspendp(list,nitems,timeout);
696
697         AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %d, %p", list, nitems, timeout);
698
699         return ret;
700 }
701
702 int gai_error(struct gaicb *req)
703 {
704         static int (*gai_errorp)(struct gaicb *req);
705  
706         BEFORE_ORIGINAL(gai_error, LIBC);
707  
708         ret = gai_errorp(req);
709
710         AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p", req);
711  
712         return ret;
713 }
714
715 int gai_cancel(struct gaicb *req)
716 {
717         static int (*gai_cancelp)(struct gaicb *req);
718  
719         BEFORE_ORIGINAL(gai_cancel, LIBC);
720  
721         ret = gai_cancelp(req);
722
723         AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p", req);
724  
725         return ret;
726 }
727
728 int getaddrinfo_a(int mode, struct gaicb *list[], int nitems, struct sigevent *sevp)
729 {
730         static int (*getaddrinfo_ap)(int mode, struct gaicb *list[], int nitems, struct sigevent *sevp);
731  
732         BEFORE_ORIGINAL(getaddrinfo_a, LIBC);
733  
734         ret = getaddrinfo_ap(mode, list,nitems, sevp);
735
736         AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%d, %p, %d, %p", mode, list, nitems, sevp);
737  
738         return ret;
739 }
740 #endif
741
742 int getsockopt(int socket, int level, int option_name, void *option_value, socklen_t *option_len)
743 {
744         static int (*getsockoptp)(int socket, int level, int option_name, void *option_value, socklen_t *option_len);
745  
746         BEFORE_ORIGINAL(getsockopt, LIBC);
747  
748         ret = getsockoptp(socket, level, option_name, option_value, option_len);
749
750         AFTER_ORIGINAL_SOCK(0, socket, FD_API_OPTION, "%d, %d, %d, %p, %p",
751                         socket, level, option_name, option_value, option_len);
752  
753         return ret;
754 }
755
756 int setsockopt(int socket, int level, int option_name, const void *option_value, socklen_t option_len)
757 {
758         static int (*setsockoptp)(int socket, int level, int option_name, const void *option_value, socklen_t option_len);
759  
760         BEFORE_ORIGINAL(setsockopt, LIBC);
761
762         ret = setsockoptp(socket, level, option_name, option_value, option_len);
763
764         AFTER_ORIGINAL_SOCK(option_len, socket, FD_API_OPTION, "%d, %d, %d, %p, %d",
765                         socket, level, option_name, option_value, option_len);
766
767         return ret;
768 }
769
770 #if 1
771 int getsockname(int sockfd, struct sockaddr *addr, socklen_t *addrlen )
772 {
773         static int (*getsocknamep)(int sockfd, struct sockaddr *addr, socklen_t *addrlen );
774  
775         BEFORE_ORIGINAL(getsockname, LIBC);
776  
777         ret = getsocknamep(sockfd, addr, addrlen);
778
779         AFTER_ORIGINAL_SOCK(0, sockfd, FD_API_OTHER, "%d, %p, %p", sockfd, addr, addrlen);
780
781         return ret;
782 }
783
784 int getdomainname(char *name, size_t len)
785 {
786         static int (*getdomainnamep)(char *name, size_t len);
787  
788         BEFORE_ORIGINAL(getdomainname, LIBC);
789  
790         ret = getdomainnamep(name, len);
791
792         AFTER_ORIGINAL_NOSOCK(len, FD_API_OTHER, "%p, %u", name, len);
793
794         return ret;
795 }
796
797 int setdomainname(const char *name, size_t len)
798 {
799         static int (*setdomainnamep)(const char *name, size_t len);
800  
801         BEFORE_ORIGINAL(setdomainname, LIBC);
802  
803         ret = setdomainnamep(name, len);
804
805         AFTER_ORIGINAL_NOSOCK(len, FD_API_OTHER, "%p, %u", name, len);
806  
807         return ret;
808 }
809
810 int gethostname(char *name, size_t len)
811 {
812         static int (*gethostnamep)(char *name, size_t len);
813  
814         BEFORE_ORIGINAL(gethostname, LIBC);
815  
816         ret = gethostnamep(name, len);
817
818         AFTER_ORIGINAL_NOSOCK(len, FD_API_OTHER, "%p, %u", name, len);
819  
820         return ret;
821 }
822
823 int sethostname(const char *name, size_t len)
824 {
825         static int (*sethostnamep)(const char *name, size_t len);
826  
827         BEFORE_ORIGINAL(sethostname, LIBC);
828  
829         ret = sethostnamep(name, len);
830
831         AFTER_ORIGINAL_NOSOCK(len, FD_API_OTHER, "%p, %u", name, len);
832  
833         return ret;
834 }
835
836 int getpeername(int s, struct sockaddr *addr, socklen_t *len)
837 {
838         static int (*getpeernamep)(int s, struct sockaddr *addr, socklen_t *len);
839
840         BEFORE_ORIGINAL(getpeername, LIBC);
841  
842         ret = getpeernamep(s, addr, len);
843
844         AFTER_ORIGINAL_SOCK(0, s, FD_API_OTHER, "%d, %p, %p", s, addr, len);
845  
846         return ret;
847 }
848
849 int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, socklen_t hostlen, char *serv, socklen_t servlen, unsigned int flags)
850 {
851         static int (*getnameinfop)(const struct sockaddr *sa, socklen_t salen, char *host, socklen_t hostlen, char *serv, socklen_t servlen, unsigned int flags);
852  
853         BEFORE_ORIGINAL(getnameinfo, LIBC);
854  
855         ret = getnameinfop(sa, salen,host, hostlen, serv, servlen, flags);
856
857         AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %d, %p, %u, %p, %u, %d",
858                         sa, salen, host, hostlen, serv, servlen, flags);
859  
860         return ret;
861 }
862
863 struct hostent *gethostbyname(const char *name)
864 {
865         static struct hostent * (*gethostbynamep)(const char *name);
866         struct hostent* pret;
867  
868         BEFORE_ORIGINAL(gethostbyname, LIBC);
869
870         pret = gethostbynamep(name);
871
872         AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, pret, 0, FD_API_OTHER, "%p", name);
873
874         return pret;
875 }
876
877 struct hostent *gethostbyaddr(const void *addr, socklen_t len, int type)
878 {
879         static struct hostent * (*gethostbyaddrp)(const void *addr, socklen_t len, int type);
880         struct hostent* pret;
881  
882         BEFORE_ORIGINAL(gethostbyaddr, LIBC);
883  
884         pret = gethostbyaddrp(addr, len, type);
885
886         AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, pret, 0, FD_API_OTHER,
887                         "%p, %d, %d", addr, len, type);
888
889         return pret;
890 }
891
892 void sethostent(int stayopen)
893 {
894         static void (*sethostentp)(int stayopen);
895
896         BEFORE_ORIGINAL(sethostent, LIBC);
897  
898         sethostentp(stayopen);
899  
900         AFTER_ORIGINAL_NOSOCK_RET(VT_NULL, NULL, 0, FD_API_OTHER, "%d", stayopen);
901 }
902
903 void endhostent(void)
904 {
905         static void (*endhostentp)(void);
906
907         BEFORE_ORIGINAL(endhostent, LIBC);
908
909         endhostentp();
910  
911         AFTER_ORIGINAL_NOSOCK_RET(VT_NULL, NULL, 0, FD_API_OTHER, "%s", "");
912 }
913
914 void herror(const char *s)
915 {
916         static void (*herrorp)(const char *s);
917
918         BEFORE_ORIGINAL(herror, LIBC);
919  
920         herrorp(s);
921  
922         AFTER_ORIGINAL_NOSOCK_RET(VT_NULL, NULL, 0, FD_API_OTHER, "%p", s);
923 }
924
925 const char *hstrerror(int err)
926 {
927         static const char* (*hstrerrorp)(int err);
928         const char* cret;
929  
930         BEFORE_ORIGINAL(hstrerror, LIBC);
931  
932         cret = hstrerrorp(err);
933
934         AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, cret, 0, FD_API_OTHER, "%d", err);
935
936         return cret;
937 }
938
939 struct hostent *gethostent(void)
940 {
941         static struct hostent* (*gethostentp)(void);
942         struct hostent* pret;
943  
944         BEFORE_ORIGINAL(gethostent, LIBC);
945  
946         pret = gethostentp();
947
948         AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, pret, 0, FD_API_OTHER, "%s", "");
949
950         return pret;
951 }
952
953 struct hostent *gethostbyname2(const char *name, int af)
954 {
955         static struct hostent * (*gethostbyname2p)(const char *name, int af);
956         struct hostent* pret;
957  
958         BEFORE_ORIGINAL(gethostbyname2, LIBC);
959  
960         pret = gethostbyname2p(name, af);
961
962         AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, pret, 0, FD_API_OTHER, "%p, %d", name, af);
963
964         return pret;
965 }
966
967 int gethostent_r(struct hostent *rret, char *buf, size_t buflen, struct hostent **result, int *h_errnop)
968 {
969         static int (*gethostent_rp)(struct hostent *rret, char *buf, size_t buflen, struct hostent **result, int *h_errnop);
970  
971         BEFORE_ORIGINAL(gethostent_r, LIBC);
972         
973         ret = gethostent_rp(rret, buf, buflen, result, h_errnop);
974  
975         AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %p, %u, %p, %p",
976                         rret, buf, buflen, result, h_errnop);
977
978         return ret;
979 }
980
981 int gethostbyaddr_r(const void *addr, socklen_t len, int type, struct hostent *rret, char *buf, size_t buflen, struct hostent **result, int *h_errnop)
982 {
983         static int (*gethostbyaddr_rp)(const void *addr, socklen_t len, int type, struct hostent *rret, char *buf, size_t buflen, struct hostent **result, int *h_errnop);
984
985         BEFORE_ORIGINAL(gethostbyaddr_r, LIBC);
986
987         ret = gethostbyaddr_rp(addr, len, type, rret, buf, buflen, result, h_errnop);
988  
989         AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %d, %d, %p, %p, %u, %p, %p",
990                         addr, len, type, rret, buf, buflen, result, h_errnop);
991
992         return ret;
993 }
994
995 int gethostbyname_r(const char *name, struct hostent *rret, char *buf, size_t buflen, struct hostent **result, int *h_errnop)
996 {
997         static int (*gethostbyname_rp)(const char *name, struct hostent *rret, char *buf, size_t buflen, struct hostent **result, int *h_errnop);
998  
999         BEFORE_ORIGINAL(gethostbyname_r, LIBC);
1000
1001         ret = gethostbyname_rp(name, rret, buf, buflen, result, h_errnop);
1002
1003         AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %p, %p, %u, %p, %p",
1004                         name, rret, buf, buflen, result, h_errnop);
1005
1006         return ret;
1007 }
1008
1009 int gethostbyname2_r(const char *name, int af, struct hostent *rret, char *buf, size_t buflen, struct hostent **result, int *h_errnop)
1010 {
1011         static int (*gethostbyname2_rp)(const char *name, int af, struct hostent *rret, char *buf, size_t buflen, struct hostent **result, int *h_errnop);
1012  
1013         BEFORE_ORIGINAL(gethostbyname2_r, LIBC);
1014  
1015         ret = gethostbyname2_rp(name, af, rret, buf, buflen, result, h_errnop);
1016
1017         AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %d, %p, %p, %u, %p, %p",
1018                         name, af, rret, buf, buflen, result, h_errnop);
1019  
1020         return ret;
1021 }
1022
1023 struct servent *getservbyname(const char *name, const char *proto)
1024 {
1025         static struct servent * (*getservbynamep)(const char *name, const char *proto);
1026         struct servent* pret;
1027  
1028         BEFORE_ORIGINAL(getservbyname, LIBC);
1029  
1030         pret = getservbynamep(name, proto);
1031
1032         AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, pret, 0, FD_API_OTHER, "%p, %p", name, proto);
1033
1034         return pret;
1035 }
1036
1037 void setservent(int stayopen)
1038 {
1039         static void (*setserventp)(int stayopen);
1040
1041         BEFORE_ORIGINAL(setservent, LIBC);
1042  
1043         setserventp(stayopen);
1044  
1045         AFTER_ORIGINAL_NOSOCK_RET(VT_NULL, NULL, 0, FD_API_OTHER, "%d", stayopen);
1046 }
1047
1048 void endservent(void)
1049 {
1050         static void (*endserventp)(void);
1051
1052         BEFORE_ORIGINAL(endservent, LIBC);
1053  
1054         endserventp();
1055  
1056         AFTER_ORIGINAL_NOSOCK_RET(VT_NULL, NULL, 0, FD_API_OTHER, "%s", "");
1057 }
1058
1059 struct servent *getservent(void)
1060 {
1061         static struct servent * (*getserventp)(void);
1062         struct servent* pret;
1063  
1064         BEFORE_ORIGINAL(getservent, LIBC);
1065  
1066         pret = getserventp();
1067         
1068         AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, pret, 0, FD_API_OTHER, "%s", "");
1069
1070         return pret;
1071 }
1072
1073 struct servent *getservbyport(int port, const char *proto)
1074 {
1075         static struct servent * (*getservbyportp)(int port, const char *proto);
1076         struct servent* pret;
1077  
1078         BEFORE_ORIGINAL(getservbyport, LIBC);
1079  
1080         pret = getservbyportp(port, proto);
1081
1082         AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, pret, 0, FD_API_OTHER, "%d, %p", port, proto);
1083
1084         return pret;
1085 }
1086
1087 int getservent_r(struct servent *result_buf, char *buf, size_t buflen, struct servent **result)
1088 {
1089         static int (*getservent_rp)(struct servent *result_buf, char *buf, size_t buflen, struct servent **result);
1090  
1091         BEFORE_ORIGINAL(getservent_r, LIBC);
1092  
1093         ret = getservent_rp(result_buf, buf, buflen, result);
1094
1095         AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %p, %u, %p",
1096                         result_buf, buf, buflen, result);
1097
1098         return ret;
1099 }
1100
1101 int getservbyname_r(const char *name, const char *proto, struct servent *result_buf, char *buf, size_t buflen, struct servent **result)
1102 {
1103         static int (*getservbyname_rp)(const char *name, const char *proto, struct servent *result_buf, char *buf, size_t buflen, struct servent **result);
1104  
1105         BEFORE_ORIGINAL(getservbyname_r, LIBC);
1106  
1107         ret = getservbyname_rp(name, proto, result_buf, buf, buflen, result);
1108
1109         AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %p, %p, %p, %u, %p",
1110                         name, proto, result_buf, buf, buflen, result);
1111
1112         return ret;
1113 }
1114
1115 int getservbyport_r(int port, const char *proto, struct servent *result_buf, char *buf, size_t buflen, struct servent **result)
1116 {
1117         static int (*getservbyport_rp)(int port, const char *proto, struct servent *result_buf, char *buf, size_t buflen, struct servent **result);
1118  
1119         BEFORE_ORIGINAL(getservbyport_r, LIBC);
1120  
1121         ret = getservbyport_rp(port, proto, result_buf, buf, buflen, result);
1122         
1123         AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%d, %p, %p, %p, %u, %p",
1124                         port, proto, result_buf, buf, buflen, result);
1125
1126         return ret;
1127 }
1128
1129 struct netent* getnetent(void)
1130 {
1131         static struct netent * (*getnetentp)(void);
1132         struct netent* pret;
1133  
1134         BEFORE_ORIGINAL(getnetent, LIBC);
1135  
1136         pret = getnetentp();
1137
1138         AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, pret, 0, FD_API_OTHER, "%s", "");
1139
1140         return pret;
1141 }
1142
1143 struct netent *getnetbyname(const char *name)
1144 {
1145         static struct netent * (*getnetbynamep)(const char *name);
1146         struct netent* pret;
1147  
1148         BEFORE_ORIGINAL(getnetbyname, LIBC);
1149  
1150         pret = getnetbynamep(name);
1151
1152         AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, pret, 0, FD_API_OTHER, "%p", name);
1153  
1154         return pret;
1155 }
1156
1157 struct netent *getnetbyaddr(uint32_t net, int type)
1158 {
1159         static struct netent * (*getnetbyaddrp)(uint32_t net, int type);
1160         struct netent * pret;
1161  
1162         BEFORE_ORIGINAL(getnetbyaddr, LIBC);
1163
1164         pret = getnetbyaddrp(net, type);
1165
1166         AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, pret, 0, FD_API_OTHER, "%u, %d", net, type);
1167
1168         return pret;
1169 }
1170
1171 void setnetent(int stayopen)
1172 {
1173         static void (*setnetentp)(int stayopen);
1174
1175         BEFORE_ORIGINAL(setnetent, LIBC);
1176  
1177         setnetentp(stayopen);
1178  
1179         AFTER_ORIGINAL_NOSOCK_RET(VT_NULL, NULL, 0, FD_API_OTHER, "%d", stayopen);
1180 }
1181
1182 void endnetent(void)
1183 {
1184         static void (*endnetentp)(void);
1185
1186         BEFORE_ORIGINAL(endnetent, LIBC);
1187  
1188         endnetentp();
1189  
1190         AFTER_ORIGINAL_NOSOCK_RET(VT_NULL, NULL, 0, FD_API_OTHER, "%s", "");
1191 }
1192
1193 int getnetent_r(struct netent *result_buf, char *buf, size_t buflen, struct netent **result, int *h_errnop)
1194 {
1195         static int (*getnetent_rp)(struct netent *result_buf, char *buf, size_t buflen, struct netent **result, int *h_errnop);
1196  
1197         BEFORE_ORIGINAL(getnetent_r, LIBC);
1198  
1199         ret = getnetent_rp(result_buf, buf, buflen, result, h_errnop);
1200
1201         AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %p, %u, %p, %p",
1202                         result_buf, buf, buflen, result, h_errnop);
1203
1204         return ret;
1205 }
1206
1207 int getnetbyname_r(const char *name, struct netent *result_buf, char *buf, size_t buflen, struct netent **result, int *h_errnop)
1208 {
1209         static int (*getnetbyname_rp)(const char *name, struct netent *result_buf, char *buf, size_t buflen, struct netent **result, int *h_errnop);
1210  
1211         BEFORE_ORIGINAL(getnetbyname_r, LIBC);
1212  
1213         ret = getnetbyname_rp(name,result_buf, buf, buflen, result, h_errnop);
1214
1215         AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %p, %p, %u, %p, %p",
1216                         name, result_buf, buf, buflen, result, h_errnop);
1217
1218         return ret;
1219 }
1220
1221 int getnetbyaddr_r(uint32_t net, int type, struct netent *result_buf, char *buf, size_t buflen, struct netent **result, int *h_errnop)
1222 {
1223         static int (*getnetbyaddr_rp)(uint32_t net, int type, struct netent *result_buf, char *buf, size_t buflen, struct netent **result, int *h_errnop);
1224  
1225         BEFORE_ORIGINAL(getnetbyaddr_r, LIBC);
1226  
1227         ret = getnetbyaddr_rp(net, type, result_buf, buf, buflen, result, h_errnop);
1228
1229         AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%u, %d, %p, %p, %u, %p, %p",
1230                         net, type, result_buf, buf, buflen, result, h_errnop);
1231
1232         return ret;
1233 }
1234
1235 struct protoent *getprotoent(void)
1236 {
1237         static struct protoent * (*getprotoentp)(void);
1238         struct protoent * pret;
1239  
1240         BEFORE_ORIGINAL(getprotoent, LIBC);
1241  
1242         pret = getprotoentp();
1243
1244         AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, pret, 0, FD_API_OTHER, "%s", "");
1245  
1246         return pret;
1247 }
1248
1249 struct protoent *getprotobyname(const char *name)
1250 {
1251         static struct protoent * (*getprotobynamep)(const char *name);
1252         struct protoent * pret;
1253  
1254         BEFORE_ORIGINAL(getprotobyname, LIBC);
1255  
1256         pret = getprotobynamep(name);
1257
1258         AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, pret, 0, FD_API_OTHER, "%p", name);
1259
1260         return pret;
1261 }
1262
1263 struct protoent *getprotobynumber(int proto)
1264 {
1265         static struct protoent * (*getprotobynumberp)(int proto);
1266         struct protoent * pret;
1267  
1268         BEFORE_ORIGINAL(getprotobynumber, LIBC);
1269  
1270         pret = getprotobynumberp(proto);
1271
1272         AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, pret, 0, FD_API_OTHER, "%d", proto);
1273
1274         return pret;
1275 }
1276
1277 void setprotoent(int stayopen)
1278 {
1279         static void (*setprotoentp)(int stayopen);
1280
1281         BEFORE_ORIGINAL(setprotoent, LIBC);
1282  
1283         setprotoentp(stayopen);
1284  
1285         AFTER_ORIGINAL_NOSOCK_RET(VT_NULL, NULL, 0, FD_API_OTHER, "%d", stayopen);
1286 }
1287
1288 void endprotoent(void)
1289 {
1290         static void (*endprotoentp)(void);
1291
1292         BEFORE_ORIGINAL(endprotoent, LIBC);
1293  
1294         endprotoentp();
1295  
1296         AFTER_ORIGINAL_NOSOCK_RET(VT_NULL, NULL, 0, FD_API_OTHER, "%s", "");
1297 }
1298
1299 int getprotoent_r(struct protoent *result_buf, char *buf, size_t buflen, struct protoent **result)
1300 {
1301         static int (*getprotoent_rp)(struct protoent *result_buf, char *buf, size_t buflen, struct protoent **result);
1302  
1303         BEFORE_ORIGINAL(getprotoent_r, LIBC);
1304  
1305         ret = getprotoent_rp(result_buf, buf, buflen, result);
1306
1307         AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %p, %u, %p",
1308                         result_buf, buf, buflen, result);
1309
1310         return ret;
1311 }
1312
1313 int getprotobyname_r(const char *name, struct protoent *result_buf, char *buf, size_t buflen, struct protoent **result)
1314 {
1315         static int (*getprotobyname_rp)(const char *name, struct protoent *result_buf, char *buf, size_t buflen, struct protoent **result);
1316  
1317         BEFORE_ORIGINAL(getprotobyname_r, LIBC);
1318  
1319         ret = getprotobyname_rp(name, result_buf, buf, buflen, result);
1320
1321         AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %p, %p, %u, %p",
1322                         name, result_buf, buf, buflen, result);
1323
1324         return ret;
1325 }
1326
1327 int getprotobynumber_r(int proto, struct protoent *result_buf, char *buf, size_t buflen, struct protoent **result)
1328 {
1329         static int (*getprotobynumber_rp)(int proto, struct protoent *result_buf, char *buf, size_t buflen, struct protoent **result);
1330  
1331         BEFORE_ORIGINAL(getprotobynumber_r, LIBC);
1332  
1333         ret = getprotobynumber_rp(proto, result_buf, buf, buflen, result);
1334
1335         AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%d, %p, %p, %u, %p",
1336                         proto, result_buf, buf, buflen, result);
1337
1338         return ret;
1339 }
1340
1341 unsigned int if_nametoindex (__const char *__ifname)
1342 {
1343         static unsigned int (*if_nametoindexp)(__const char *__ifname);
1344         unsigned int uret;
1345  
1346         BEFORE_ORIGINAL(if_nametoindex, LIBC);
1347  
1348         uret = if_nametoindexp(__ifname);
1349
1350         AFTER_ORIGINAL_NOSOCK_RET(VT_UINT, uret, 0, FD_API_OTHER, "%p", __ifname);
1351  
1352         return uret;
1353 }
1354
1355 char *if_indextoname (unsigned int __ifindex, char *__ifname)
1356 {
1357         static char * (*if_indextonamep)(unsigned int __ifindex, char *__ifname);
1358         char * cret;
1359         
1360         BEFORE_ORIGINAL(if_indextoname, LIBC);
1361  
1362         cret = if_indextonamep(__ifindex, __ifname);
1363  
1364         AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, cret, 0, FD_API_OTHER,
1365                         "%u, %p", __ifindex, __ifname);
1366
1367         return cret;
1368 }
1369
1370 struct if_nameindex *if_nameindex (void)
1371 {
1372         static struct if_nameindex * (*if_nameindexp)(void);
1373         struct if_nameindex * pret;
1374  
1375         BEFORE_ORIGINAL_NOFILTER(if_nameindex, LIBC);
1376         
1377         pret = if_nameindexp();
1378  
1379         AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, pret, 0, FD_API_OTHER, "%s", "");
1380
1381         return pret;
1382 }
1383
1384 void if_freenameindex (struct if_nameindex *__ptr)
1385 {
1386         static void (*if_freenameindexp)(struct if_nameindex *__ptr);
1387
1388         BEFORE_ORIGINAL_NOFILTER(if_freenameindex, LIBC);
1389  
1390         if_freenameindexp(__ptr);
1391  
1392         AFTER_ORIGINAL_NOSOCK_RET(VT_NULL, NULL, 0, FD_API_OTHER, "%p", __ptr);
1393 }
1394
1395 int getifaddrs(struct ifaddrs **ifap)
1396 {
1397         static int (*getifaddrsp)(struct ifaddrs **ifap);
1398  
1399         BEFORE_ORIGINAL_NOFILTER(getifaddrs, LIBC);
1400  
1401         ret = getifaddrsp(ifap);
1402
1403         AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p", ifap);
1404  
1405         return ret;
1406 }
1407
1408 void freeifaddrs(struct ifaddrs *ifa)
1409 {
1410         static void (*freeifaddrsp)(struct ifaddrs *ifa);
1411
1412         BEFORE_ORIGINAL_NOFILTER(freeifaddrs, LIBC);
1413  
1414         freeifaddrsp(ifa);
1415  
1416         AFTER_ORIGINAL_NOSOCK_RET(VT_NULL, NULL, 0, FD_API_OTHER, "%p", ifa);
1417 }
1418
1419 #if 0
1420 int poll(struct pollfd *ufds, unsigned int nfds, int timeout)
1421 {
1422         static int (*pollp)(struct pollfd *ufds, unsigned int nfds, int timeout);
1423  
1424         BEFORE_ORIGINAL(poll, LIBC);
1425  
1426         ret = pollp(ufds, nfds, timeout);
1427
1428         AFTER_ORIGINAL_NOSOCK(timeout, FD_API_OTHER, "%p, %u, %d", ufds, nfds, timeout);
1429
1430         return ret;
1431 }
1432
1433 int ppoll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout_ts, const sigset_t *sigmask)
1434 {
1435         static int (*ppollp)(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout_ts, const sigset_t *sigmask);
1436  
1437         BEFORE_ORIGINAL(ppoll, LIBC);
1438  
1439         ret = ppollp(fds, nfds, timeout_ts, sigmask);
1440
1441         AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %lu, %p, %p",
1442                         fds, nfds, timeout_ts, sigmask);
1443
1444         return ret;
1445 }
1446 #endif
1447
1448 #endif