4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
8 * Jaewon Lim <jaewon81.lim@samsung.com>
9 * Woojin Jung <woojin2.jung@samsung.com>
10 * Juyoung Kim <j0.kim@samsung.com>
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)
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.
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
37 #include <sys/types.h>
38 #include <sys/socket.h>
41 #include <arpa/inet.h>
45 #include "probeinfo.h"
48 #include "da_socket.h"
50 static enum DaOptions _sopt = OPT_FILE;
52 int socket(int domain, int type, int protocol)
54 static int (*socketp)(int domain, int type, int protocol);
56 BEFORE_ORIGINAL_NOFILTER(socket, LIBC);
58 ret = socketp(domain, type, protocol);
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();
68 int socketpair(int domain, int type, int protocol,int socket_vector[2])
70 static int (*socketpairp)(int domain, int type, int protocol,int socket_vector[2]);
72 BEFORE_ORIGINAL_NOFILTER(socketpair, LIBC);
74 ret = socketpairp(domain, type, protocol, socket_vector);
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();
86 int shutdown(int socket, int how)
88 static int (*shutdownp)(int socket, int how);
90 BEFORE_ORIGINAL_NOFILTER(shutdown, LIBC);
92 ret = shutdownp(socket, how);
94 AFTER_ORIGINAL_SOCK(0, socket, FD_API_OTHER, "%d, %d", socket, how);
99 int bind(int socket, const struct sockaddr *address, socklen_t address_len)
101 static int (*bindp)(int socket, const struct sockaddr *address, socklen_t address_len);
103 BEFORE_ORIGINAL(bind, LIBC);
105 ret = bindp(socket, address, address_len);
107 AFTER_ORIGINAL_SOCK(0, socket, FD_API_MANAGE,
108 "%d, %p, %d", socket, address, address_len);
113 int listen(int socket, int backlog)
115 static int (*listenp)(int socket, int backlog);
117 BEFORE_ORIGINAL(listen, LIBC);
119 ret = listenp(socket, backlog);
121 AFTER_ORIGINAL_SOCK(0, socket, FD_API_MANAGE, "%d, %d", socket, backlog);
126 int accept(int socket, struct sockaddr *address, socklen_t *address_len)
128 static int (*acceptp)(int socket, struct sockaddr *address, socklen_t *address_len);
130 BEFORE_ORIGINAL_NOFILTER(accept, LIBC);
132 ret = acceptp(socket, address, address_len);
134 AFTER_ORIGINAL_SOCK(0, socket, FD_API_MANAGE,
135 "%d, %p, %p", socket, address, address_len);
140 int accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags)
142 static int (*accept4p)(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags);
144 BEFORE_ORIGINAL_NOFILTER(accept4, LIBC);
146 ret = accept4p(sockfd, addr, addrlen, flags);
148 AFTER_ORIGINAL_SOCK(0, sockfd, FD_API_MANAGE,
149 "%d, %p, %p, %d", sockfd, addr, addrlen, flags);
154 int connect(int socket, const struct sockaddr *address, socklen_t address_len)
156 static int (*connectp)(int socket, const struct sockaddr *address, socklen_t address_len);
158 BEFORE_ORIGINAL(connect, LIBC);
160 ret = connectp(socket, address, address_len);
162 AFTER_ORIGINAL_SOCK(address_len, socket, FD_API_MANAGE,
163 "%d, %p, %d", socket, address, address_len);
168 int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout)
170 static int (*selectp)(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
172 BEFORE_ORIGINAL(select, LIBC);
174 ret = selectp(nfds, readfds, writefds,exceptfds, timeout);
176 AFTER_ORIGINAL_SOCK(0, nfds, FD_API_MANAGE,
177 "%d, %p, %p, %p, %p", nfds, readfds, writefds, exceptfds, timeout);
182 int pselect(int nfds, fd_set *readfds, fd_set *writefds,fd_set *exceptfds, const struct timespec *ntimeout, const sigset_t *sigmask)
184 static int (*pselectp)(int nfds, fd_set *readfds, fd_set *writefds,fd_set *exceptfds, const struct timespec *ntimeout, const sigset_t *sigmask);
186 BEFORE_ORIGINAL(pselect, LIBC);
188 ret = pselectp(nfds, readfds, writefds,exceptfds, ntimeout, sigmask);
190 AFTER_ORIGINAL_SOCK(0, nfds, FD_API_MANAGE, "%d, %p, %p, %p, %p, %p",
191 nfds, readfds, writefds, exceptfds, ntimeout, sigmask);
196 ssize_t send(int socket, const void *message, size_t length, int flags)
198 static ssize_t (*sendp)(int socket, const void *message, size_t length, int flags);
201 BEFORE_ORIGINAL(send, LIBC);
203 sret = sendp(socket, message, length, flags);
205 AFTER_ORIGINAL_SOCK_RET(VT_SSIZE_T, sret, sret, socket, FD_API_SEND,
206 "%d, %p, %u, %d", socket, message, length, flags);
211 ssize_t sendmsg(int socket, const struct msghdr *message, int flags)
213 static ssize_t (*sendmsgp)(int socket, const struct msghdr *message, int flags);
216 BEFORE_ORIGINAL(sendmsg, LIBC);
218 sret = sendmsgp(socket, message, flags);
220 AFTER_ORIGINAL_SOCK_RET(VT_SSIZE_T, sret, sret, socket, FD_API_SEND,
221 "%d, %p, %d", socket, message, flags);
226 ssize_t sendto(int socket, const void *message, size_t length, int flags,const struct sockaddr *dest_addr, socklen_t dest_len)
228 static ssize_t (*sendtop)(int socket, const void *message, size_t length, int flags,const struct sockaddr *dest_addr, socklen_t dest_len);
231 BEFORE_ORIGINAL(sendto, LIBC);
233 sret = sendtop(socket, message, length, flags, dest_addr, dest_len);
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);
241 ssize_t recv(int socket, void *buffer, size_t length, int flags)
243 static ssize_t (*recvp)(int socket, void *buffer, size_t length, int flags);
246 BEFORE_ORIGINAL(recv, LIBC);
248 sret = recvp(socket, buffer, length, flags);
250 AFTER_ORIGINAL_SOCK_RET(VT_SSIZE_T, sret, sret, socket, FD_API_RECEIVE,
251 "%d, %p, %u, %d", socket, buffer, length, flags);
256 ssize_t recvfrom(int socket, void *buffer, size_t length, int flags, struct sockaddr *address, socklen_t *address_len)
258 static ssize_t (*recvfromp)(int socket, void *buffer, size_t length, int flags, struct sockaddr *address, socklen_t *address_len);
261 BEFORE_ORIGINAL(recvfrom, LIBC);
263 sret = recvfromp(socket, buffer, length, flags, address, address_len);
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);
271 ssize_t recvmsg(int socket, struct msghdr *message, int flags)
273 static ssize_t (*recvmsgp)(int socket, struct msghdr *message, int flags);
276 BEFORE_ORIGINAL(recvmsg, LIBC);
278 sret = recvmsgp(socket, message, flags);
280 AFTER_ORIGINAL_SOCK_RET(VT_SSIZE_T, sret, sret, socket, FD_API_RECEIVE,
281 "%d, %p, %d", socket, message, flags);
286 uint32_t htonl(uint32_t hostlong)
288 static uint32_t (*htonlp)(uint32_t hostlong);
291 BEFORE_ORIGINAL(htonl, LIBC);
293 uret = htonlp(hostlong);
295 AFTER_ORIGINAL_NOSOCK_RET(VT_UINT32_T, uret, 0, FD_API_OTHER, "%u", hostlong);
300 uint16_t htons(uint16_t hostshort)
302 static uint16_t (*htonsp)(uint16_t hostshort);
305 BEFORE_ORIGINAL(htons, LIBC);
307 uret = htonsp(hostshort);
309 AFTER_ORIGINAL_NOSOCK_RET(VT_UINT16_T, uret, 0, FD_API_OTHER, "%u", hostshort);
314 uint32_t ntohl(uint32_t netlong)
316 static uint32_t (*ntohlp)(uint32_t netlong);
319 BEFORE_ORIGINAL(ntohl, LIBC);
321 uret = ntohlp(netlong);
323 AFTER_ORIGINAL_NOSOCK_RET(VT_UINT32_T, uret, 0, FD_API_OTHER, "%u", netlong);
328 uint16_t ntohs(uint16_t netshort)
330 static uint16_t (*ntohsp)(uint16_t netshort);
333 BEFORE_ORIGINAL(ntohs, LIBC);
335 uret = ntohsp(netshort);
337 AFTER_ORIGINAL_NOSOCK_RET(VT_UINT16_T, uret, 0, FD_API_OTHER, "%u", netshort);
343 uint16_t htobe16(uint16_t host_16bits)
345 static uint16_t (*htobe16p)(uint16_t host_16bits);
348 BEFORE_ORIGINAL(htobe16, LIBC);
350 uret = htobe16p(host_16bits);
352 AFTER_ORIGINAL_NOSOCK_RET(VT_UINT16_T, uret, 0, FD_API_OTHER, "%u", host_16bits);
357 uint16_t htole16(uint16_t host_16bits)
359 static uint16_t (*htole16p)(uint16_t host_16bits);
362 BEFORE_ORIGINAL(htole16, LIBC);
364 uret = htole16p(host_16bits);
366 AFTER_ORIGINAL_NOSOCK_RET(VT_UINT16_T, uret, 0, FD_API_OTHER, "%u", host_16bits);
371 uint16_t be16toh(uint16_t big_endian_16bits)
373 static uint16_t (*be16tohp)(uint16_t big_endian_16bits);
376 BEFORE_ORIGINAL(be16toh, LIBC);
378 uret = be16tohp(big_endian_16bits);
380 AFTER_ORIGINAL_NOSOCK_RET(VT_UINT16_T, uret, 0, FD_API_OTHER,
381 "%u", big_endian_16bits);
386 uint16_t le16toh(uint16_t little_endian_16bits)
388 static uint16_t (*le16tohp)(uint16_t little_endian_16bits);
391 BEFORE_ORIGINAL(le16toh, LIBC);
393 uret = le16tohp(little_endian_16bits);
395 AFTER_ORIGINAL_NOSOCK_RET(VT_UINT16_T, uret, 0, FD_API_OTHER,
396 "%u", little_endian_16bits);
401 uint32_t htobe32(uint32_t host_32bits)
403 static uint32_t (*htobe32p)(uint32_t host_32bits);
406 BEFORE_ORIGINAL(htobe32, LIBC);
408 uret = htobe32p(host_32bits);
410 AFTER_ORIGINAL_NOSOCK_RET(VT_UINT32_T, uret, 0, FD_API_OTHER,
416 uint32_t htole32(uint32_t host_32bits)
418 static uint32_t (*htole32p)(uint32_t host_32bits);
421 BEFORE_ORIGINAL(htole32, LIBC);
423 uret = htole32p(host_32bits);
425 AFTER_ORIGINAL_NOSOCK_RET(VT_UINT32_T, uret, 0, FD_API_OTHER,
431 uint32_t be32toh(uint32_t big_endian_32bits)
433 static uint32_t (*be32tohp)(uint32_t big_endian_32bits);
436 BEFORE_ORIGINAL(be32toh, LIBC);
438 uret = be32tohp(big_endian_32bits);
440 AFTER_ORIGINAL_NOSOCK_RET(VT_UINT32_T, uret, 0, FD_API_OTHER,
441 "%u", big_endian_32bits);
446 uint32_t le32toh(uint32_t little_endian_32bits)
448 static uint32_t (*le32tohp)(uint32_t little_endian_32bits);
451 BEFORE_ORIGINAL(le32toh, LIBC);
453 uret = le32tohp(little_endian_32bits);
455 AFTER_ORIGINAL_NOSOCK_RET(VT_UINT32_T, uret, 0, FD_API_OTHER,
456 "%u", little_endian_32bits);
461 uint64_t htobe64(uint64_t host_64bits)
463 static uint64_t (*htobe64p)(uint64_t host_64bits);
466 BEFORE_ORIGINAL(htobe64, LIBC);
468 uret = htobe64p(host_64bits);
470 AFTER_ORIGINAL_NOSOCK_RET(VT_UINT64_T, uret, 0, FD_API_OTHER,
476 uint64_t htole64(uint64_t host_64bits)
478 static uint64_t (*htole64p)(uint64_t host_64bits);
481 BEFORE_ORIGINAL(htole64, LIBC);
483 uret = htole64p(host_64bits);
485 AFTER_ORIGINAL_NOSOCK_RET(VT_UINT64_T, uret, 0, FD_API_OTHER,
491 uint64_t be64toh(uint64_t big_endian_64bits)
493 static uint64_t (*be64tohp)(uint64_t big_endian_64bits);
496 BEFORE_ORIGINAL(be64toh, LIBC);
498 uret = be64tohp(big_endian_64bits);
500 AFTER_ORIGINAL_NOSOCK_RET(VT_UINT64_T, uret, 0, FD_API_OTHER,
501 "%u", big_endian_64bits);
506 uint64_t le64toh(uint64_t little_endian_64bits)
508 static uint64_t (*le64tohp)(uint64_t little_endian_64bits);
511 BEFORE_ORIGINAL(le64toh, LIBC);
513 uret = le64tohp(little_endian_64bits);
515 AFTER_ORIGINAL_NOSOCK_RET(VT_UINT64_T, uret, 0, FD_API_OTHER,
516 "%u", little_endian_64bits);
523 int inet_aton(const char *cp, struct in_addr *inp)
525 static int (*inet_atonp)(const char *cp, struct in_addr *inp);
527 BEFORE_ORIGINAL(inet_aton, LIBC);
529 ret = inet_atonp(cp,inp);
531 AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %p", cp, inp);
536 in_addr_t inet_addr(const char *cp)
538 static in_addr_t (*inet_addrp)(const char *cp);
541 BEFORE_ORIGINAL(inet_addr, LIBC);
543 iret = inet_addrp(cp);
545 AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, iret, 0, FD_API_OTHER, "%p", cp);
550 in_addr_t inet_network(const char *cp)
552 static in_addr_t (*inet_networkp)(const char *cp);
555 BEFORE_ORIGINAL(inet_network, LIBC);
557 iret = inet_networkp(cp);
559 AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, iret, 0, FD_API_OTHER, "%p", cp);
564 char *inet_ntoa(struct in_addr in)
566 static char * (*inet_ntoap)(struct in_addr in);
569 BEFORE_ORIGINAL(inet_ntoa, LIBC);
571 sret = inet_ntoap(in);
573 AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, sret, 0, FD_API_OTHER, "%u", in.s_addr);
579 struct in_addr inet_makeaddr(int net, int host)
581 static struct in_addr (*inet_makeaddrp)(int net, int host);
584 BEFORE_ORIGINAL(inet_makeaddr, LIBC);
586 iret = inet_makeaddrp(net,host);
588 AFTER_ORIGINAL_NOSOCK_RET(VT_UINT32_T, iret.s_addr, 0, FD_API_OTHER,
589 "%d, %d", net, host);
595 in_addr_t inet_lnaof(struct in_addr in)
597 static in_addr_t (*inet_lnaofp)(struct in_addr in);
600 BEFORE_ORIGINAL(inet_lnaof, LIBC);
602 iret = inet_lnaofp(in);
604 AFTER_ORIGINAL_NOSOCK_RET(VT_UINT32_T, iret, 0, FD_API_OTHER, "%u", in.s_addr);
609 in_addr_t inet_netof(struct in_addr in)
611 static in_addr_t (*inet_netofp)(struct in_addr in);
614 BEFORE_ORIGINAL(inet_netof, LIBC);
616 iret = inet_netofp(in);
618 AFTER_ORIGINAL_NOSOCK_RET(VT_UINT32_T, iret, 0, FD_API_OTHER, "%u", in.s_addr);
623 const char *inet_ntop(int af, const void *src, char *dst, socklen_t size)
625 static const char* (*inet_ntopp)(int af, const void *src, char *dst, socklen_t size);
628 BEFORE_ORIGINAL(inet_ntop, LIBC);
630 cret = inet_ntopp(af, src, dst, size);
632 AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, cret, size, FD_API_OTHER,
633 "%d, %p, %p, %d", af, src, dst, size);
638 int inet_pton(int af, const char *src, void *dst)
640 static int (*inet_ptonp)(int af, const char *src, void *dst);
642 BEFORE_ORIGINAL(inet_pton, LIBC);
644 ret = inet_ptonp(af, src, dst);
646 AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%d, %p, %p", af, src, dst);
651 int getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res)
653 static int (*getaddrinfop)(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res);
655 BEFORE_ORIGINAL_NOFILTER(getaddrinfo, LIBC);
657 ret = getaddrinfop(node, service, hints, res);
659 AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %p, %p, %p", node, service, hints, res);
664 void freeaddrinfo(struct addrinfo *res)
666 static void (*freeaddrinfop)(struct addrinfo *res);
668 BEFORE_ORIGINAL_NOFILTER(freeaddrinfo, LIBC);
672 AFTER_ORIGINAL_NOSOCK_RET(VT_NULL, NULL, 0, FD_API_OTHER, "%p", res);
675 const char *gai_strerror(int errcode)
677 static const char * (*gai_strerrorp)(int errcode);
680 BEFORE_ORIGINAL(gai_strerror, LIBC);
682 cret = gai_strerrorp(errcode);
684 AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, cret, 0, FD_API_OTHER, "%d", errcode);
689 int gai_suspend(const struct gaicb* const list[], int nitems, const struct timespec *timeout)
691 static int (*gai_suspendp)(const struct gaicb* const list[], int nitems, const struct timespec *timeout);
693 BEFORE_ORIGINAL(gai_suspend, LIBC);
695 ret = gai_suspendp(list,nitems,timeout);
697 AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %d, %p", list, nitems, timeout);
702 int gai_error(struct gaicb *req)
704 static int (*gai_errorp)(struct gaicb *req);
706 BEFORE_ORIGINAL(gai_error, LIBC);
708 ret = gai_errorp(req);
710 AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p", req);
715 int gai_cancel(struct gaicb *req)
717 static int (*gai_cancelp)(struct gaicb *req);
719 BEFORE_ORIGINAL(gai_cancel, LIBC);
721 ret = gai_cancelp(req);
723 AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p", req);
728 int getaddrinfo_a(int mode, struct gaicb *list[], int nitems, struct sigevent *sevp)
730 static int (*getaddrinfo_ap)(int mode, struct gaicb *list[], int nitems, struct sigevent *sevp);
732 BEFORE_ORIGINAL(getaddrinfo_a, LIBC);
734 ret = getaddrinfo_ap(mode, list,nitems, sevp);
736 AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%d, %p, %d, %p", mode, list, nitems, sevp);
742 int getsockopt(int socket, int level, int option_name, void *option_value, socklen_t *option_len)
744 static int (*getsockoptp)(int socket, int level, int option_name, void *option_value, socklen_t *option_len);
746 BEFORE_ORIGINAL(getsockopt, LIBC);
748 ret = getsockoptp(socket, level, option_name, option_value, option_len);
750 AFTER_ORIGINAL_SOCK(0, socket, FD_API_OPTION, "%d, %d, %d, %p, %p",
751 socket, level, option_name, option_value, option_len);
756 int setsockopt(int socket, int level, int option_name, const void *option_value, socklen_t option_len)
758 static int (*setsockoptp)(int socket, int level, int option_name, const void *option_value, socklen_t option_len);
760 BEFORE_ORIGINAL(setsockopt, LIBC);
762 ret = setsockoptp(socket, level, option_name, option_value, option_len);
764 AFTER_ORIGINAL_SOCK(option_len, socket, FD_API_OPTION, "%d, %d, %d, %p, %d",
765 socket, level, option_name, option_value, option_len);
771 int getsockname(int sockfd, struct sockaddr *addr, socklen_t *addrlen )
773 static int (*getsocknamep)(int sockfd, struct sockaddr *addr, socklen_t *addrlen );
775 BEFORE_ORIGINAL(getsockname, LIBC);
777 ret = getsocknamep(sockfd, addr, addrlen);
779 AFTER_ORIGINAL_SOCK(0, sockfd, FD_API_OTHER, "%d, %p, %p", sockfd, addr, addrlen);
784 int getdomainname(char *name, size_t len)
786 static int (*getdomainnamep)(char *name, size_t len);
788 BEFORE_ORIGINAL(getdomainname, LIBC);
790 ret = getdomainnamep(name, len);
792 AFTER_ORIGINAL_NOSOCK(len, FD_API_OTHER, "%p, %u", name, len);
797 int setdomainname(const char *name, size_t len)
799 static int (*setdomainnamep)(const char *name, size_t len);
801 BEFORE_ORIGINAL(setdomainname, LIBC);
803 ret = setdomainnamep(name, len);
805 AFTER_ORIGINAL_NOSOCK(len, FD_API_OTHER, "%p, %u", name, len);
810 int gethostname(char *name, size_t len)
812 static int (*gethostnamep)(char *name, size_t len);
814 BEFORE_ORIGINAL(gethostname, LIBC);
816 ret = gethostnamep(name, len);
818 AFTER_ORIGINAL_NOSOCK(len, FD_API_OTHER, "%p, %u", name, len);
823 int sethostname(const char *name, size_t len)
825 static int (*sethostnamep)(const char *name, size_t len);
827 BEFORE_ORIGINAL(sethostname, LIBC);
829 ret = sethostnamep(name, len);
831 AFTER_ORIGINAL_NOSOCK(len, FD_API_OTHER, "%p, %u", name, len);
836 int getpeername(int s, struct sockaddr *addr, socklen_t *len)
838 static int (*getpeernamep)(int s, struct sockaddr *addr, socklen_t *len);
840 BEFORE_ORIGINAL(getpeername, LIBC);
842 ret = getpeernamep(s, addr, len);
844 AFTER_ORIGINAL_SOCK(0, s, FD_API_OTHER, "%d, %p, %p", s, addr, len);
849 int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, socklen_t hostlen, char *serv, socklen_t servlen, unsigned int flags)
851 static int (*getnameinfop)(const struct sockaddr *sa, socklen_t salen, char *host, socklen_t hostlen, char *serv, socklen_t servlen, unsigned int flags);
853 BEFORE_ORIGINAL(getnameinfo, LIBC);
855 ret = getnameinfop(sa, salen,host, hostlen, serv, servlen, flags);
857 AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %d, %p, %u, %p, %u, %d",
858 sa, salen, host, hostlen, serv, servlen, flags);
863 struct hostent *gethostbyname(const char *name)
865 static struct hostent * (*gethostbynamep)(const char *name);
866 struct hostent* pret;
868 BEFORE_ORIGINAL(gethostbyname, LIBC);
870 pret = gethostbynamep(name);
872 AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, pret, 0, FD_API_OTHER, "%p", name);
877 struct hostent *gethostbyaddr(const void *addr, socklen_t len, int type)
879 static struct hostent * (*gethostbyaddrp)(const void *addr, socklen_t len, int type);
880 struct hostent* pret;
882 BEFORE_ORIGINAL(gethostbyaddr, LIBC);
884 pret = gethostbyaddrp(addr, len, type);
886 AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, pret, 0, FD_API_OTHER,
887 "%p, %d, %d", addr, len, type);
892 void sethostent(int stayopen)
894 static void (*sethostentp)(int stayopen);
896 BEFORE_ORIGINAL(sethostent, LIBC);
898 sethostentp(stayopen);
900 AFTER_ORIGINAL_NOSOCK_RET(VT_NULL, NULL, 0, FD_API_OTHER, "%d", stayopen);
903 void endhostent(void)
905 static void (*endhostentp)(void);
907 BEFORE_ORIGINAL(endhostent, LIBC);
911 AFTER_ORIGINAL_NOSOCK_RET(VT_NULL, NULL, 0, FD_API_OTHER, "%s", "");
914 void herror(const char *s)
916 static void (*herrorp)(const char *s);
918 BEFORE_ORIGINAL(herror, LIBC);
922 AFTER_ORIGINAL_NOSOCK_RET(VT_NULL, NULL, 0, FD_API_OTHER, "%p", s);
925 const char *hstrerror(int err)
927 static const char* (*hstrerrorp)(int err);
930 BEFORE_ORIGINAL(hstrerror, LIBC);
932 cret = hstrerrorp(err);
934 AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, cret, 0, FD_API_OTHER, "%d", err);
939 struct hostent *gethostent(void)
941 static struct hostent* (*gethostentp)(void);
942 struct hostent* pret;
944 BEFORE_ORIGINAL(gethostent, LIBC);
946 pret = gethostentp();
948 AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, pret, 0, FD_API_OTHER, "%s", "");
953 struct hostent *gethostbyname2(const char *name, int af)
955 static struct hostent * (*gethostbyname2p)(const char *name, int af);
956 struct hostent* pret;
958 BEFORE_ORIGINAL(gethostbyname2, LIBC);
960 pret = gethostbyname2p(name, af);
962 AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, pret, 0, FD_API_OTHER, "%p, %d", name, af);
967 int gethostent_r(struct hostent *rret, char *buf, size_t buflen, struct hostent **result, int *h_errnop)
969 static int (*gethostent_rp)(struct hostent *rret, char *buf, size_t buflen, struct hostent **result, int *h_errnop);
971 BEFORE_ORIGINAL(gethostent_r, LIBC);
973 ret = gethostent_rp(rret, buf, buflen, result, h_errnop);
975 AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %p, %u, %p, %p",
976 rret, buf, buflen, result, h_errnop);
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)
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);
985 BEFORE_ORIGINAL(gethostbyaddr_r, LIBC);
987 ret = gethostbyaddr_rp(addr, len, type, rret, buf, buflen, result, h_errnop);
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);
995 int gethostbyname_r(const char *name, struct hostent *rret, char *buf, size_t buflen, struct hostent **result, int *h_errnop)
997 static int (*gethostbyname_rp)(const char *name, struct hostent *rret, char *buf, size_t buflen, struct hostent **result, int *h_errnop);
999 BEFORE_ORIGINAL(gethostbyname_r, LIBC);
1001 ret = gethostbyname_rp(name, rret, buf, buflen, result, h_errnop);
1003 AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %p, %p, %u, %p, %p",
1004 name, rret, buf, buflen, result, h_errnop);
1009 int gethostbyname2_r(const char *name, int af, struct hostent *rret, char *buf, size_t buflen, struct hostent **result, int *h_errnop)
1011 static int (*gethostbyname2_rp)(const char *name, int af, struct hostent *rret, char *buf, size_t buflen, struct hostent **result, int *h_errnop);
1013 BEFORE_ORIGINAL(gethostbyname2_r, LIBC);
1015 ret = gethostbyname2_rp(name, af, rret, buf, buflen, result, h_errnop);
1017 AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %d, %p, %p, %u, %p, %p",
1018 name, af, rret, buf, buflen, result, h_errnop);
1023 struct servent *getservbyname(const char *name, const char *proto)
1025 static struct servent * (*getservbynamep)(const char *name, const char *proto);
1026 struct servent* pret;
1028 BEFORE_ORIGINAL(getservbyname, LIBC);
1030 pret = getservbynamep(name, proto);
1032 AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, pret, 0, FD_API_OTHER, "%p, %p", name, proto);
1037 void setservent(int stayopen)
1039 static void (*setserventp)(int stayopen);
1041 BEFORE_ORIGINAL(setservent, LIBC);
1043 setserventp(stayopen);
1045 AFTER_ORIGINAL_NOSOCK_RET(VT_NULL, NULL, 0, FD_API_OTHER, "%d", stayopen);
1048 void endservent(void)
1050 static void (*endserventp)(void);
1052 BEFORE_ORIGINAL(endservent, LIBC);
1056 AFTER_ORIGINAL_NOSOCK_RET(VT_NULL, NULL, 0, FD_API_OTHER, "%s", "");
1059 struct servent *getservent(void)
1061 static struct servent * (*getserventp)(void);
1062 struct servent* pret;
1064 BEFORE_ORIGINAL(getservent, LIBC);
1066 pret = getserventp();
1068 AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, pret, 0, FD_API_OTHER, "%s", "");
1073 struct servent *getservbyport(int port, const char *proto)
1075 static struct servent * (*getservbyportp)(int port, const char *proto);
1076 struct servent* pret;
1078 BEFORE_ORIGINAL(getservbyport, LIBC);
1080 pret = getservbyportp(port, proto);
1082 AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, pret, 0, FD_API_OTHER, "%d, %p", port, proto);
1087 int getservent_r(struct servent *result_buf, char *buf, size_t buflen, struct servent **result)
1089 static int (*getservent_rp)(struct servent *result_buf, char *buf, size_t buflen, struct servent **result);
1091 BEFORE_ORIGINAL(getservent_r, LIBC);
1093 ret = getservent_rp(result_buf, buf, buflen, result);
1095 AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %p, %u, %p",
1096 result_buf, buf, buflen, result);
1101 int getservbyname_r(const char *name, const char *proto, struct servent *result_buf, char *buf, size_t buflen, struct servent **result)
1103 static int (*getservbyname_rp)(const char *name, const char *proto, struct servent *result_buf, char *buf, size_t buflen, struct servent **result);
1105 BEFORE_ORIGINAL(getservbyname_r, LIBC);
1107 ret = getservbyname_rp(name, proto, result_buf, buf, buflen, result);
1109 AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %p, %p, %p, %u, %p",
1110 name, proto, result_buf, buf, buflen, result);
1115 int getservbyport_r(int port, const char *proto, struct servent *result_buf, char *buf, size_t buflen, struct servent **result)
1117 static int (*getservbyport_rp)(int port, const char *proto, struct servent *result_buf, char *buf, size_t buflen, struct servent **result);
1119 BEFORE_ORIGINAL(getservbyport_r, LIBC);
1121 ret = getservbyport_rp(port, proto, result_buf, buf, buflen, result);
1123 AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%d, %p, %p, %p, %u, %p",
1124 port, proto, result_buf, buf, buflen, result);
1129 struct netent* getnetent(void)
1131 static struct netent * (*getnetentp)(void);
1132 struct netent* pret;
1134 BEFORE_ORIGINAL(getnetent, LIBC);
1136 pret = getnetentp();
1138 AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, pret, 0, FD_API_OTHER, "%s", "");
1143 struct netent *getnetbyname(const char *name)
1145 static struct netent * (*getnetbynamep)(const char *name);
1146 struct netent* pret;
1148 BEFORE_ORIGINAL(getnetbyname, LIBC);
1150 pret = getnetbynamep(name);
1152 AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, pret, 0, FD_API_OTHER, "%p", name);
1157 struct netent *getnetbyaddr(uint32_t net, int type)
1159 static struct netent * (*getnetbyaddrp)(uint32_t net, int type);
1160 struct netent * pret;
1162 BEFORE_ORIGINAL(getnetbyaddr, LIBC);
1164 pret = getnetbyaddrp(net, type);
1166 AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, pret, 0, FD_API_OTHER, "%u, %d", net, type);
1171 void setnetent(int stayopen)
1173 static void (*setnetentp)(int stayopen);
1175 BEFORE_ORIGINAL(setnetent, LIBC);
1177 setnetentp(stayopen);
1179 AFTER_ORIGINAL_NOSOCK_RET(VT_NULL, NULL, 0, FD_API_OTHER, "%d", stayopen);
1182 void endnetent(void)
1184 static void (*endnetentp)(void);
1186 BEFORE_ORIGINAL(endnetent, LIBC);
1190 AFTER_ORIGINAL_NOSOCK_RET(VT_NULL, NULL, 0, FD_API_OTHER, "%s", "");
1193 int getnetent_r(struct netent *result_buf, char *buf, size_t buflen, struct netent **result, int *h_errnop)
1195 static int (*getnetent_rp)(struct netent *result_buf, char *buf, size_t buflen, struct netent **result, int *h_errnop);
1197 BEFORE_ORIGINAL(getnetent_r, LIBC);
1199 ret = getnetent_rp(result_buf, buf, buflen, result, h_errnop);
1201 AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %p, %u, %p, %p",
1202 result_buf, buf, buflen, result, h_errnop);
1207 int getnetbyname_r(const char *name, struct netent *result_buf, char *buf, size_t buflen, struct netent **result, int *h_errnop)
1209 static int (*getnetbyname_rp)(const char *name, struct netent *result_buf, char *buf, size_t buflen, struct netent **result, int *h_errnop);
1211 BEFORE_ORIGINAL(getnetbyname_r, LIBC);
1213 ret = getnetbyname_rp(name,result_buf, buf, buflen, result, h_errnop);
1215 AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %p, %p, %u, %p, %p",
1216 name, result_buf, buf, buflen, result, h_errnop);
1221 int getnetbyaddr_r(uint32_t net, int type, struct netent *result_buf, char *buf, size_t buflen, struct netent **result, int *h_errnop)
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);
1225 BEFORE_ORIGINAL(getnetbyaddr_r, LIBC);
1227 ret = getnetbyaddr_rp(net, type, result_buf, buf, buflen, result, h_errnop);
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);
1235 struct protoent *getprotoent(void)
1237 static struct protoent * (*getprotoentp)(void);
1238 struct protoent * pret;
1240 BEFORE_ORIGINAL(getprotoent, LIBC);
1242 pret = getprotoentp();
1244 AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, pret, 0, FD_API_OTHER, "%s", "");
1249 struct protoent *getprotobyname(const char *name)
1251 static struct protoent * (*getprotobynamep)(const char *name);
1252 struct protoent * pret;
1254 BEFORE_ORIGINAL(getprotobyname, LIBC);
1256 pret = getprotobynamep(name);
1258 AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, pret, 0, FD_API_OTHER, "%p", name);
1263 struct protoent *getprotobynumber(int proto)
1265 static struct protoent * (*getprotobynumberp)(int proto);
1266 struct protoent * pret;
1268 BEFORE_ORIGINAL(getprotobynumber, LIBC);
1270 pret = getprotobynumberp(proto);
1272 AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, pret, 0, FD_API_OTHER, "%d", proto);
1277 void setprotoent(int stayopen)
1279 static void (*setprotoentp)(int stayopen);
1281 BEFORE_ORIGINAL(setprotoent, LIBC);
1283 setprotoentp(stayopen);
1285 AFTER_ORIGINAL_NOSOCK_RET(VT_NULL, NULL, 0, FD_API_OTHER, "%d", stayopen);
1288 void endprotoent(void)
1290 static void (*endprotoentp)(void);
1292 BEFORE_ORIGINAL(endprotoent, LIBC);
1296 AFTER_ORIGINAL_NOSOCK_RET(VT_NULL, NULL, 0, FD_API_OTHER, "%s", "");
1299 int getprotoent_r(struct protoent *result_buf, char *buf, size_t buflen, struct protoent **result)
1301 static int (*getprotoent_rp)(struct protoent *result_buf, char *buf, size_t buflen, struct protoent **result);
1303 BEFORE_ORIGINAL(getprotoent_r, LIBC);
1305 ret = getprotoent_rp(result_buf, buf, buflen, result);
1307 AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %p, %u, %p",
1308 result_buf, buf, buflen, result);
1313 int getprotobyname_r(const char *name, struct protoent *result_buf, char *buf, size_t buflen, struct protoent **result)
1315 static int (*getprotobyname_rp)(const char *name, struct protoent *result_buf, char *buf, size_t buflen, struct protoent **result);
1317 BEFORE_ORIGINAL(getprotobyname_r, LIBC);
1319 ret = getprotobyname_rp(name, result_buf, buf, buflen, result);
1321 AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %p, %p, %u, %p",
1322 name, result_buf, buf, buflen, result);
1327 int getprotobynumber_r(int proto, struct protoent *result_buf, char *buf, size_t buflen, struct protoent **result)
1329 static int (*getprotobynumber_rp)(int proto, struct protoent *result_buf, char *buf, size_t buflen, struct protoent **result);
1331 BEFORE_ORIGINAL(getprotobynumber_r, LIBC);
1333 ret = getprotobynumber_rp(proto, result_buf, buf, buflen, result);
1335 AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%d, %p, %p, %u, %p",
1336 proto, result_buf, buf, buflen, result);
1341 unsigned int if_nametoindex (__const char *__ifname)
1343 static unsigned int (*if_nametoindexp)(__const char *__ifname);
1346 BEFORE_ORIGINAL(if_nametoindex, LIBC);
1348 uret = if_nametoindexp(__ifname);
1350 AFTER_ORIGINAL_NOSOCK_RET(VT_UINT, uret, 0, FD_API_OTHER, "%p", __ifname);
1355 char *if_indextoname (unsigned int __ifindex, char *__ifname)
1357 static char * (*if_indextonamep)(unsigned int __ifindex, char *__ifname);
1360 BEFORE_ORIGINAL(if_indextoname, LIBC);
1362 cret = if_indextonamep(__ifindex, __ifname);
1364 AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, cret, 0, FD_API_OTHER,
1365 "%u, %p", __ifindex, __ifname);
1370 struct if_nameindex *if_nameindex (void)
1372 static struct if_nameindex * (*if_nameindexp)(void);
1373 struct if_nameindex * pret;
1375 BEFORE_ORIGINAL_NOFILTER(if_nameindex, LIBC);
1377 pret = if_nameindexp();
1379 AFTER_ORIGINAL_NOSOCK_RET(VT_PTR, pret, 0, FD_API_OTHER, "%s", "");
1384 void if_freenameindex (struct if_nameindex *__ptr)
1386 static void (*if_freenameindexp)(struct if_nameindex *__ptr);
1388 BEFORE_ORIGINAL_NOFILTER(if_freenameindex, LIBC);
1390 if_freenameindexp(__ptr);
1392 AFTER_ORIGINAL_NOSOCK_RET(VT_NULL, NULL, 0, FD_API_OTHER, "%p", __ptr);
1395 int getifaddrs(struct ifaddrs **ifap)
1397 static int (*getifaddrsp)(struct ifaddrs **ifap);
1399 BEFORE_ORIGINAL_NOFILTER(getifaddrs, LIBC);
1401 ret = getifaddrsp(ifap);
1403 AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p", ifap);
1408 void freeifaddrs(struct ifaddrs *ifa)
1410 static void (*freeifaddrsp)(struct ifaddrs *ifa);
1412 BEFORE_ORIGINAL_NOFILTER(freeifaddrs, LIBC);
1416 AFTER_ORIGINAL_NOSOCK_RET(VT_NULL, NULL, 0, FD_API_OTHER, "%p", ifa);
1420 int poll(struct pollfd *ufds, unsigned int nfds, int timeout)
1422 static int (*pollp)(struct pollfd *ufds, unsigned int nfds, int timeout);
1424 BEFORE_ORIGINAL(poll, LIBC);
1426 ret = pollp(ufds, nfds, timeout);
1428 AFTER_ORIGINAL_NOSOCK(timeout, FD_API_OTHER, "%p, %u, %d", ufds, nfds, timeout);
1433 int ppoll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout_ts, const sigset_t *sigmask)
1435 static int (*ppollp)(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout_ts, const sigset_t *sigmask);
1437 BEFORE_ORIGINAL(ppoll, LIBC);
1439 ret = ppollp(fds, nfds, timeout_ts, sigmask);
1441 AFTER_ORIGINAL_NOSOCK(0, FD_API_OTHER, "%p, %lu, %p, %p",
1442 fds, nfds, timeout_ts, sigmask);