4 * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
8 * Hyunjong Park <phjwithyou.park@samsung.com>
9 * Juyoung Kim <j0.kim@samsung.com>
10 * Anastasia Lyupa <a.lyupa@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
28 * - Samsung RnD Institute Russia
37 #include <sys/types.h>
38 #include <sys/socket.h>
39 #include <arpa/inet.h>
45 #include <sys/epoll.h>
47 #include "probeinfo.h"
49 #include "da_socket.h"
52 #include "api_id_mapping.h"
57 static enum DaOptions _sopt = OPT_NETWORK;
59 char* getAddress(const struct sockaddr *sa) {
60 char buff[INET6_ADDRSTRLEN];
61 switch (sa->sa_family) {
63 sprintf(g_address, "%s:%d",
64 inet_ntoa(((struct sockaddr_in*) sa)->sin_addr),
65 (int) ntohs(((struct sockaddr_in*) sa)->sin_port));
68 sprintf(g_address, "%s:%d",
69 inet_ntop(AF_INET6, &(((struct sockaddr_in6 *) sa)->sin6_addr),
71 ntohs(((struct sockaddr_in6*) sa)->sin6_port));
78 int socket(int domain, int type, int protocol) {
79 static int (*socketp)(int domain, int type, int protocol);
80 BEFORE_ORIGINAL_SOCK(socket, LIBC);
81 ret = socketp(domain, type, protocol);
83 AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, ret, SOCKET_API_FD_OPEN, "",
84 0, NO_DESTINATIONINFO, "ddd", domain, type, protocol);
89 int accept(int socket, struct sockaddr *address, socklen_t *address_len) {
91 static int (*acceptp)(int socket, struct sockaddr *address,
92 socklen_t *address_len);
94 BEFORE_ORIGINAL_SOCK(accept, LIBC);
96 char* callAddress = getAddress(address);
97 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START(NULL, OBJ_DUMMY, socket,
98 SOCKET_API_ACCEPT_START, "", 0, address, "dsp",
99 socket, callAddress, address_len);
101 ret = acceptp(socket, address, address_len);
103 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END(ret, OBJ_DUMMY, socket,
104 SOCKET_API_ACCEPT_END, "", 0, address, "dsp",
105 socket, callAddress, address_len);
110 int accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags) {
111 static int (*accept4p)(int sockfd, struct sockaddr *addr,
112 socklen_t *addrlen, int flags);
114 BEFORE_ORIGINAL_SOCK(accept4, LIBC);
115 char* callAddress = getAddress(addr);
117 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START(NULL, OBJ_DUMMY, sockfd,
118 SOCKET_API_ACCEPT_START, "", 0, addr, "dspd",
119 sockfd, callAddress, addrlen, flags);
121 ret = accept4p(sockfd, addr, addrlen, flags);
123 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END(ret, OBJ_DUMMY, sockfd,
124 SOCKET_API_ACCEPT_END, "", 0, addr, "dspd",
125 sockfd, callAddress, addrlen, flags);
130 int connect(int socket, const struct sockaddr *address, socklen_t address_len) {
131 static int (*connectp)(int socket, const struct sockaddr *address,
132 socklen_t address_len);
134 BEFORE_ORIGINAL_SOCK(connect, LIBC);
136 ret = connectp(socket, address, address_len);
138 AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, socket, SOCKET_API_CONNECT,
139 "", 0, address, "dsd",
140 socket, getAddress(address), address_len);
145 int shutdown(int socket, int how) {
146 static int (*shutdownp)(int socket, int how);
148 BEFORE_ORIGINAL_SOCK(shutdown, LIBC);
150 ret = shutdownp(socket, how);
152 AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, socket, SOCKET_API_FD_CLOSE,
153 "", 0, NO_DESTINATIONINFO, "dd", socket, how);
158 int bind(int socket, const struct sockaddr *address, socklen_t address_len) {
159 static int (*bindp)(int socket, const struct sockaddr *address,
160 socklen_t address_len);
162 BEFORE_ORIGINAL_SOCK(bind, LIBC);
164 ret = bindp(socket, address, address_len);
166 AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, socket, SOCKET_API_BIND, "",
168 socket, getAddress(address), address_len);
173 int listen(int socket, int backlog) {
174 static int (*listenp)(int socket, int backlog);
175 BEFORE_ORIGINAL_SOCK(listen, LIBC);
176 ret = listenp(socket, backlog);
178 AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, socket, SOCKET_API_LISTEN, "",
179 0, NO_DESTINATIONINFO, "dd", socket, backlog);
184 ssize_t send(int socket, const void *message, size_t length, int flags) {
185 static ssize_t (*sendp)(int socket, const void *message, size_t length,
188 BEFORE_ORIGINAL_SOCK(send, LIBC);
190 int* messagP = (int*) message;
192 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START(NULL, OBJ_DUMMY, socket,
193 SOCKET_API_SEND_START, "", 0, NO_DESTINATIONINFO, "dpdd",
194 socket, messagP, length, flags);
196 sret = sendp(socket, message, length, flags);
198 int sendMaxSize = SOCKET_SEND_SIZE;
199 char* out = (char*) malloc(sendMaxSize + 5);
203 memcpy(out, message, sendMaxSize + 5);
204 if (sret > sendMaxSize + 5) {
205 out[sendMaxSize] = '.';
206 out[sendMaxSize + 1] = '.';
207 out[sendMaxSize + 2] = '.';
208 out[sendMaxSize + 3] = '\0';
214 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END(sret, OBJ_DUMMY, socket,
215 SOCKET_API_SEND_END, out, sret, NO_DESTINATIONINFO, "dpdd",
216 socket, messagP, length, flags);
221 ssize_t recv(int socket, void *buffer, size_t length, int flags) {
222 static ssize_t (*recvp)(int socket, void *buffer, size_t length, int flags);
225 BEFORE_ORIGINAL_SOCK(recv, LIBC);
227 int* bufferP = (int*) buffer;
229 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START(NULL, OBJ_DUMMY, socket,
230 SOCKET_API_RECV_START, "", 0, NO_DESTINATIONINFO, "dpdd",
231 socket, bufferP, length, flags);
233 sret = recvp(socket, buffer, length, flags);
235 int sendMaxSize = SOCKET_SEND_SIZE;
236 char* out = (char*) malloc(sendMaxSize + 5);
240 memcpy(out, buffer, sendMaxSize + 5);
241 if (sret > sendMaxSize + 5) {
242 out[sendMaxSize] = '.';
243 out[sendMaxSize + 1] = '.';
244 out[sendMaxSize + 2] = '.';
245 out[sendMaxSize + 3] = '\0';
251 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END(sret, OBJ_DUMMY, socket,
252 SOCKET_API_RECV_END, out, sret, NO_DESTINATIONINFO, "dpdd",
253 socket, bufferP, length, flags);
258 ssize_t sendto(int socket, const void *message, size_t length, int flags,
259 const struct sockaddr *dest_addr, socklen_t dest_len) {
260 static ssize_t (*sendtop)(int socket, const void *message, size_t length,
261 int flags, const struct sockaddr *dest_addr, socklen_t dest_len);
264 BEFORE_ORIGINAL_SOCK(sendto, LIBC);
266 int* bufferP = (int*) message;
268 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START(NULL, OBJ_DUMMY, socket,
269 SOCKET_API_SEND_START, "", 0, dest_addr, "dpddpd",
270 socket, bufferP, length, flags, dest_addr, dest_len);
272 sret = sendtop(socket, message, length, flags, dest_addr, dest_len);
274 int sendMaxSize = SOCKET_SEND_SIZE;
275 char* out = (char*) malloc(sendMaxSize + 5);
279 memcpy(out, message, sendMaxSize + 5);
280 if (sret > sendMaxSize + 5) {
281 out[sendMaxSize] = '.';
282 out[sendMaxSize + 1] = '.';
283 out[sendMaxSize + 2] = '.';
284 out[sendMaxSize + 3] = '\0';
290 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END(sret, OBJ_DUMMY, socket,
291 SOCKET_API_SEND_END, out, sret, NO_DESTINATIONINFO, "dpddpd",
292 socket, bufferP, length, flags, dest_addr, dest_len);
297 ssize_t recvfrom(int socket, void *buffer, size_t length, int flags,
298 struct sockaddr *address, socklen_t *address_len) {
299 static ssize_t (*recvfromp)(int socket, void *buffer, size_t length,
300 int flags, struct sockaddr *address, socklen_t *address_len);
303 BEFORE_ORIGINAL_SOCK(recvfrom, LIBC);
305 int* bufferP = (int*) buffer;
307 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START(NULL, OBJ_DUMMY, socket,
308 SOCKET_API_RECV_START, "", 0, NO_DESTINATIONINFO, "dpddpp",
309 socket, bufferP, length, flags, address, address_len);
311 sret = recvfromp(socket, buffer, length, flags, address, address_len);
313 int sendMaxSize = SOCKET_SEND_SIZE;
314 char* out = (char*) malloc(sendMaxSize + 5);
318 memcpy(out, buffer, sendMaxSize + 5);
319 if (sret > sendMaxSize + 5) {
320 out[sendMaxSize] = '.';
321 out[sendMaxSize + 1] = '.';
322 out[sendMaxSize + 2] = '.';
323 out[sendMaxSize + 3] = '\0';
329 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END(sret, OBJ_DUMMY, socket,
330 SOCKET_API_RECV_END, out, sret, NO_DESTINATIONINFO, "dpddpp",
331 socket, bufferP, length, flags, address, address_len);
336 ssize_t recvmsg(int socket, struct msghdr *message, int flags) {
337 static ssize_t (*recvmsgp)(int socket, struct msghdr *message, int flags);
340 BEFORE_ORIGINAL_SOCK(recvmsg, LIBC);
342 int* bufferP = (int*) message->msg_name;
344 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START(NULL, OBJ_DUMMY, socket,
345 SOCKET_API_RECV_START, "", 0, NO_DESTINATIONINFO, "dpd",
346 socket, message, flags);
348 sret = recvmsgp(socket, message, flags);
350 memset(&message, 0, sizeof(message));
353 int sendMaxSize = SOCKET_SEND_SIZE;
354 char* out = (char*) malloc(sendMaxSize + 5);
358 memcpy(out, message, sendMaxSize + 5);
359 if (sret > sendMaxSize + 5) {
360 out[sendMaxSize] = '.';
361 out[sendMaxSize + 1] = '.';
362 out[sendMaxSize + 2] = '.';
363 out[sendMaxSize + 3] = '\0';
369 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END(sret, OBJ_DUMMY, socket,
370 SOCKET_API_RECV_END, out, sret, NO_DESTINATIONINFO, "dpd",
371 socket, bufferP, flags);
376 ssize_t sendmsg(int socket, const struct msghdr *message, int flags) {
377 static ssize_t (*sendmsgp)(int socket, const struct msghdr *message,
381 BEFORE_ORIGINAL_SOCK(sendmsg, LIBC);
383 int* bufferP = (int*) message->msg_name;
385 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START(NULL, OBJ_DUMMY, socket,
386 SOCKET_API_SEND_START, "", 0, NO_DESTINATIONINFO, "dpd",
387 socket, message, flags);
389 sret = sendmsgp(socket, message, flags);
391 memset(&message, 0, sizeof(message));
393 int sendMaxSize = SOCKET_SEND_SIZE;
394 char* out = (char*) malloc(sendMaxSize + 5);
398 memcpy(out, message, sendMaxSize + 5);
399 if (sret > sendMaxSize + 5) {
400 out[sendMaxSize] = '.';
401 out[sendMaxSize + 1] = '.';
402 out[sendMaxSize + 2] = '.';
403 out[sendMaxSize + 3] = '\0';
409 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END(sret, OBJ_DUMMY, socket,
410 SOCKET_API_SEND_END, out, sret, NO_DESTINATIONINFO, "dpd",
411 socket, bufferP, flags);
416 int getsockopt(int socket, int level, int option_name, void *option_value,
417 socklen_t *option_len) {
418 static int (*getsockoptp)(int socket, int level, int option_name,
419 void *option_value, socklen_t *option_len);
421 BEFORE_ORIGINAL_SOCK(getsockopt, LIBC);
423 ret = getsockoptp(socket, level, option_name, option_value, option_len);
425 AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, socket, SOCKET_API_OTHER, "",
426 0, NO_DESTINATIONINFO, "dddpp",
427 socket, level, option_name, option_value, option_len);
432 int setsockopt(int socket, int level, int option_name, const void *option_value,
433 socklen_t option_len) {
434 static int (*setsockoptp)(int socket, int level, int option_name,
435 const void *option_value, socklen_t option_len);
437 BEFORE_ORIGINAL_SOCK(setsockopt, LIBC);
439 ret = setsockoptp(socket, level, option_name, option_value, option_len);
441 AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, socket, SOCKET_API_OTHER, "",
442 0, NO_DESTINATIONINFO, "dddpd",
443 socket, level, option_name, option_value, option_len);
448 int getpeername(int fd, struct sockaddr *addr, socklen_t *len) {
449 static int (*getpeernamep)(int s, struct sockaddr *addr, socklen_t *len);
451 BEFORE_ORIGINAL_SOCK(getpeername, LIBC);
453 ret = getpeernamep(fd, addr, len);
455 AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, fd, SOCKET_API_OTHER, "", 0,
456 getAddress(addr), "dsp", fd, getAddress(addr), len);
460 int getsockname(int sockfd, struct sockaddr *addr, socklen_t *addrlen) {
461 static int (*getsocknamep)(int sockfd, struct sockaddr *addr,
464 BEFORE_ORIGINAL_SOCK(getsockname, LIBC);
466 ret = getsocknamep(sockfd, addr, addrlen);
468 AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, sockfd, SOCKET_API_OTHER, "",
469 0, getAddress(addr), "dsp",
470 sockfd, getAddress(addr), addrlen);
475 int socketpair(int domain, int type, int protocol, int socket_vector[2]) {
476 static int (*socketpairp)(int domain, int type, int protocol,
477 int socket_vector[2]);
479 BEFORE_ORIGINAL_SOCK(socketpair, LIBC);
481 ret = socketpairp(domain, type, protocol, socket_vector);
483 AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, socket_vector[0],
484 SOCKET_API_FD_OPEN, "", 0, NO_DESTINATIONINFO, "ddddd",
485 domain, type, protocol, socket_vector[0], socket_vector[1]);
490 int sockatmark(int __fd) {
491 static int (*sockatmarkp)(int __fd);
493 BEFORE_ORIGINAL_SOCK(sockatmark, LIBC);
495 ret = sockatmarkp(__fd);
497 AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, __fd,
498 SOCKET_API_OTHER, "", 0, NO_DESTINATIONINFO, "d", __fd);
502 int isfdtype(int __fd, int __fdtype) {
503 static int (*isfdtypep)(int __fd, int __fdtype);
505 BEFORE_ORIGINAL_SOCK(isfdtype, LIBC);
507 ret = isfdtypep(__fd, __fdtype);
509 AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, __fd, SOCKET_API_OTHER, "", 0,
510 NO_DESTINATIONINFO, "dd", __fd, __fdtype);
514 int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
515 struct timeval *timeout) {
516 static int (*selectp)(int nfds, fd_set *readfds, fd_set *writefds,
517 fd_set *exceptfds, struct timeval *timeout);
519 BEFORE_ORIGINAL_SOCK(select, LIBC);
521 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START(NULL, OBJ_DUMMY, 0,
522 SOCKET_API_EVENT_START, "", 0, NO_DESTINATIONINFO, "dpppp",
523 nfds, readfds, writefds, exceptfds, timeout);
525 ret = selectp(nfds, readfds, writefds, exceptfds, timeout);
527 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END(ret, OBJ_DUMMY, 0,
528 SOCKET_API_EVENT_END, "", 0, NO_DESTINATIONINFO, "dpppp",
529 nfds, readfds, writefds, exceptfds, timeout);
534 int pselect(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
535 const struct timespec *ntimeout, const sigset_t *sigmask) {
536 static int (*pselectp)(int nfds, fd_set *readfds, fd_set *writefds,
537 fd_set *exceptfds, const struct timespec *ntimeout,
538 const sigset_t *sigmask);
540 BEFORE_ORIGINAL_SOCK(pselect, LIBC);
542 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START(NULL, OBJ_DUMMY, 0,
543 SOCKET_API_EVENT_START, "", 0, NO_DESTINATIONINFO, "dppppp",
544 nfds, readfds, writefds, exceptfds, ntimeout, sigmask);
546 ret = pselectp(nfds, readfds, writefds, exceptfds, ntimeout, sigmask);
548 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END(ret, OBJ_DUMMY, 0,
549 SOCKET_API_EVENT_END, "", 0, NO_DESTINATIONINFO, "dppppp",
550 nfds, readfds, writefds, exceptfds, ntimeout, sigmask);
555 int poll(struct pollfd *fds, nfds_t nfds, int timeout) {
556 static int (*pollp)(struct pollfd *ufds, unsigned int nfds, int timeout);
558 BEFORE_ORIGINAL_SOCK(poll, LIBC);
560 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START(NULL, OBJ_DUMMY, fds->fd,
561 SOCKET_API_EVENT_START, "", 0, NO_DESTINATIONINFO, "pxd",
564 ret = pollp(fds, nfds, timeout);
566 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END(ret, OBJ_DUMMY, fds->fd,
567 SOCKET_API_EVENT_END, "", 0, NO_DESTINATIONINFO, "pxd", fds, nfds, timeout);
572 int ppoll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout_ts,
573 const sigset_t *sigmask) {
574 static int (*ppollp)(struct pollfd *fds, nfds_t nfds,
575 const struct timespec *timeout_ts, const sigset_t *sigmask);
577 BEFORE_ORIGINAL_SOCK(ppoll, LIBC);
579 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START(NULL, OBJ_DUMMY, fds->fd,
580 SOCKET_API_EVENT_START, "", 0, NO_DESTINATIONINFO, "pxpp",
581 fds, nfds, timeout_ts, sigmask);
583 ret = ppollp(fds, nfds, timeout_ts, sigmask);
585 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END(ret, OBJ_DUMMY, fds->fd,
586 SOCKET_API_EVENT_END, "", 0, NO_DESTINATIONINFO, "pxpp",
587 fds, nfds, timeout_ts, sigmask);
592 int epoll_create(int __size) {
593 static int (*epoll_createp)(int __size);
594 BEFORE_ORIGINAL_SOCK(epoll_create, LIBC);
596 ret = epoll_createp(__size);
598 AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, ret, SOCKET_API_FD_OPEN, "",
599 0, NO_DESTINATIONINFO, "d", __size);
603 int epoll_create1(int __flags) {
604 static int (*epoll_create1p)(int __size);
605 BEFORE_ORIGINAL_SOCK(epoll_create1, LIBC);
607 ret = epoll_create1p(__flags);
609 AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, ret, SOCKET_API_FD_OPEN, "",
610 0, NO_DESTINATIONINFO, "d", __flags);
614 int epoll_wait(int __epfd, struct epoll_event *__events, int __maxevents,
616 static int (*epoll_waitp)(int __epfd, struct epoll_event *__events,
617 int __maxevents, int __timeout);
618 BEFORE_ORIGINAL_SOCK(epoll_wait, LIBC);
620 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START(NULL, OBJ_DUMMY, __epfd,
621 SOCKET_API_EVENT_START, "", 0, NO_DESTINATIONINFO, "dpdd",
622 __epfd, __events, __maxevents, __timeout);
624 ret = epoll_waitp(__epfd, __events, __maxevents, __timeout);
626 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END(ret, OBJ_DUMMY, __epfd,
627 SOCKET_API_EVENT_END, "", 0, NO_DESTINATIONINFO, "dpdd",
628 __epfd, __events, __maxevents, __timeout);
633 int epoll_pwait(int __epfd, struct epoll_event *__events, int __maxevents,
634 int __timeout, __const __sigset_t *__ss) {
635 static int (*epoll_pwaitp)(int __epfd, struct epoll_event *__events,
636 int __maxevents, int __timeout, __const __sigset_t *__ss);
637 BEFORE_ORIGINAL_SOCK(epoll_pwait, LIBC);
639 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START(NULL, OBJ_DUMMY, __epfd,
640 SOCKET_API_EVENT_START, "", 0, NO_DESTINATIONINFO, "dpdd %p",
641 __epfd, __events, __maxevents, __timeout, __ss);
643 ret = epoll_pwaitp(__epfd, __events, __maxevents, __timeout, __ss);
645 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END(ret, OBJ_DUMMY, __epfd,
646 SOCKET_API_EVENT_END, "", 0, NO_DESTINATIONINFO, "dpdd %p",
647 __epfd, __events, __maxevents, __timeout, __ss);
652 int epoll_ctl(int __epfd, int __op, int __fd, struct epoll_event *__event) {
653 static int (*epoll_ctlp)(int __epfd, int __op, int __fd,
654 struct epoll_event *__event);
656 BEFORE_ORIGINAL_SOCK(epoll_ctl, LIBC);
658 ret = epoll_ctlp(__epfd, __op, __fd, __event);
660 AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, __fd, SOCKET_API_OTHER, "", 0,
661 NO_DESTINATIONINFO, "dddp", __epfd, __op, __fd, __event);
668 uint32_t htonl(uint32_t hostlong) {
669 static uint32_t (*htonlp)(uint32_t hostlong);
672 BEFORE_ORIGINAL_SOCK(htonl, LIBC);
674 uret = htonlp(hostlong);
676 AFTER_ORIGINAL_LIBC_SOCK(VT_UINT32_T, uret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
677 NO_DESTINATIONINFO, "", "d", hostlong);
682 uint16_t htons(uint16_t hostshort) {
683 static uint16_t (*htonsp)(uint16_t hostshort);
686 BEFORE_ORIGINAL_SOCK(htons, LIBC);
688 uret = htonsp(hostshort);
690 AFTER_ORIGINAL_LIBC_SOCK(VT_UINT16_T, uret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
691 NO_DESTINATIONINFO, "", "d", hostshort);
696 int inet_aton(const char *cp, struct in_addr *inp) {
697 static int (*inet_atonp)(const char *cp, struct in_addr *inp);
699 BEFORE_ORIGINAL_SOCK(inet_aton, LIBC);
701 ret = inet_atonp(cp, inp);
703 AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
704 NO_DESTINATIONINFO, "pp", cp, inp);
709 in_addr_t inet_addr(const char *cp) {
710 static in_addr_t (*inet_addrp)(const char *cp);
713 BEFORE_ORIGINAL_SOCK(inet_addr, LIBC);
715 iret = inet_addrp(cp);
717 AFTER_ORIGINAL_LIBC_SOCK(iret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
718 NO_DESTINATIONINFO, "p", cp);
723 in_addr_t inet_network(const char *cp) {
724 static in_addr_t (*inet_networkp)(const char *cp);
727 BEFORE_ORIGINAL_SOCK(inet_network, LIBC);
729 iret = inet_networkp(cp);
731 AFTER_ORIGINAL_LIBC_SOCK(iret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
732 NO_DESTINATIONINFO, "p", cp);
737 char *inet_ntoa(struct in_addr in) {
738 static char * (*inet_ntoap)(struct in_addr in);
741 BEFORE_ORIGINAL_SOCK(inet_ntoa, LIBC);
743 sret = inet_ntoap(in);
745 AFTER_ORIGINAL_LIBC_SOCK(sret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
746 NO_DESTINATIONINFO, "d", in.s_addr);
751 uint32_t ntohl(uint32_t netlong) {
752 static uint32_t (*ntohlp)(uint32_t netlong);
755 BEFORE_ORIGINAL_SOCK(ntohl, LIBC);
757 uret = ntohlp(netlong);
759 AFTER_ORIGINAL_LIBC_SOCK(VT_UINT32_T, uret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
760 NO_DESTINATIONINFO, "", "d", netlong);
765 uint16_t ntohs(uint16_t netshort) {
766 static uint16_t (*ntohsp)(uint16_t netshort);
769 BEFORE_ORIGINAL_SOCK(ntohs, LIBC);
771 uret = ntohsp(netshort);
773 AFTER_ORIGINAL_LIBC_SOCK(VT_UINT16_T, uret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
774 NO_DESTINATIONINFO, "", "d", netshort);
779 in_addr_t inet_lnaof(struct in_addr in) {
780 static in_addr_t (*inet_lnaofp)(struct in_addr in);
783 BEFORE_ORIGINAL_SOCK(inet_lnaof, LIBC);
785 iret = inet_lnaofp(in);
787 AFTER_ORIGINAL_LIBC_SOCK(VT_UINT32_T, iret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
788 NO_DESTINATIONINFO, "", "d", in.s_addr);
793 in_addr_t inet_netof(struct in_addr in) {
794 static in_addr_t (*inet_netofp)(struct in_addr in);
797 BEFORE_ORIGINAL_SOCK(inet_netof, LIBC);
799 iret = inet_netofp(in);
801 AFTER_ORIGINAL_LIBC_SOCK(VT_UINT32_T, iret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
802 NO_DESTINATIONINFO, "", "d", in.s_addr);
807 const char *inet_ntop(int af, const void *src, char *dst, socklen_t size) {
808 static const char* (*inet_ntopp)(int af, const void *src, char *dst,
812 BEFORE_ORIGINAL_SOCK(inet_ntop, LIBC);
814 cret = inet_ntopp(af, src, dst, size);
816 AFTER_ORIGINAL_LIBC_SOCK(cret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
817 NO_DESTINATIONINFO, "dppd", af, src, dst, size);
822 int inet_pton(int af, const char *src, void *dst) {
823 static int (*inet_ptonp)(int af, const char *src, void *dst);
825 BEFORE_ORIGINAL_SOCK(inet_pton, LIBC);
827 ret = inet_ptonp(af, src, dst);
829 AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
830 NO_DESTINATIONINFO, "dpp", af, src, dst);
835 int getaddrinfo(const char *node, const char *service,
836 const struct addrinfo *hints, struct addrinfo **res) {
837 static int (*getaddrinfop)(const char *node, const char *service,
838 const struct addrinfo *hints, struct addrinfo **res);
840 BEFORE_ORIGINAL_NOFILTER(getaddrinfo, LIBC);
842 ret = getaddrinfop(node, service, hints, res);
844 AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
845 NO_DESTINATIONINFO, "pppp", node, service, hints, res);
850 void freeaddrinfo(struct addrinfo *res) {
851 static void (*freeaddrinfop)(struct addrinfo *res);
853 BEFORE_ORIGINAL_NOFILTER(freeaddrinfo, LIBC);
857 AFTER_ORIGINAL_LIBC_SOCK(NULL, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
858 NO_DESTINATIONINFO, "p", res);
861 const char *gai_strerror(int errcode) {
862 static const char * (*gai_strerrorp)(int errcode);
865 BEFORE_ORIGINAL_SOCK(gai_strerror, LIBC);
867 cret = gai_strerrorp(errcode);
869 AFTER_ORIGINAL_LIBC_SOCK(cret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
870 NO_DESTINATIONINFO, "d", errcode);
875 int gai_suspend(const struct gaicb* const list[], int nitems,
876 const struct timespec *timeout) {
877 static int (*gai_suspendp)(const struct gaicb* const list[], int nitems,
878 const struct timespec *timeout);
880 BEFORE_ORIGINAL_SOCK(gai_suspend, LIBC);
882 ret = gai_suspendp(list, nitems, timeout);
884 AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
885 NO_DESTINATIONINFO, "pdp", list, nitems, timeout);
890 int gai_error(struct gaicb *req) {
891 static int (*gai_errorp)(struct gaicb *req);
893 BEFORE_ORIGINAL_SOCK(gai_error, LIBC);
895 ret = gai_errorp(req);
897 AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
898 NO_DESTINATIONINFO, "p", req);
903 int gai_cancel(struct gaicb *req) {
904 static int (*gai_cancelp)(struct gaicb *req);
906 BEFORE_ORIGINAL_SOCK(gai_cancel, LIBC);
908 ret = gai_cancelp(req);
910 AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
911 NO_DESTINATIONINFO, "p", req);
916 int getaddrinfo_a(int mode, struct gaicb *list[], int nitems,
917 struct sigevent *sevp) {
918 static int (*getaddrinfo_ap)(int mode, struct gaicb *list[], int nitems,
919 struct sigevent *sevp);
921 BEFORE_ORIGINAL_SOCK(getaddrinfo_a, LIBC);
923 ret = getaddrinfo_ap(mode, list, nitems, sevp);
925 AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
926 NO_DESTINATIONINFO, "dpdp", mode, list, nitems, sevp);
931 int getdomainname(char *name, size_t len) {
932 static int (*getdomainnamep)(char *name, size_t len);
934 BEFORE_ORIGINAL_SOCK(getdomainname, LIBC);
936 ret = getdomainnamep(name, len);
938 //AFTER_ORIGINAL_NOSOCK(FD_API_OTHER, "pd", name, len);
940 AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
941 NO_DESTINATIONINFO, "pd", name, len);
946 int setdomainname(const char *name, size_t len) {
947 static int (*setdomainnamep)(const char *name, size_t len);
949 BEFORE_ORIGINAL_SOCK(setdomainname, LIBC);
951 ret = setdomainnamep(name, len);
953 AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
954 NO_DESTINATIONINFO, "pd", name, len);
959 int gethostname(char *name, size_t len) {
960 static int (*gethostnamep)(char *name, size_t len);
962 BEFORE_ORIGINAL_SOCK(gethostname, LIBC);
964 ret = gethostnamep(name, len);
966 AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
967 NO_DESTINATIONINFO, "pd", name, len);
972 int sethostname(const char *name, size_t len) {
973 static int (*sethostnamep)(const char *name, size_t len);
975 BEFORE_ORIGINAL_SOCK(sethostname, LIBC);
977 ret = sethostnamep(name, len);
979 AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
980 NO_DESTINATIONINFO, "pd", name, len);
985 int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host,
986 socklen_t hostlen, char *serv, socklen_t servlen, unsigned int flags) {
987 static int (*getnameinfop)(const struct sockaddr *sa, socklen_t salen,
988 char *host, socklen_t hostlen, char *serv, socklen_t servlen,
991 BEFORE_ORIGINAL_SOCK(getnameinfo, LIBC);
993 ret = getnameinfop(sa, salen, host, hostlen, serv, servlen, flags);
995 AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
996 NO_DESTINATIONINFO, "pdpdpdd",
997 sa, salen, host, hostlen, serv, servlen, flags);
1002 struct hostent *gethostbyname(const char *name) {
1003 static struct hostent * (*gethostbynamep)(const char *name);
1004 struct hostent* pret;
1006 BEFORE_ORIGINAL_SOCK(gethostbyname, LIBC);
1008 pret = gethostbynamep(name);
1010 AFTER_ORIGINAL_LIBC_SOCK(pret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
1011 NO_DESTINATIONINFO, "p", name);
1016 struct hostent *gethostbyaddr(const void *addr, socklen_t len, int type) {
1017 static struct hostent * (*gethostbyaddrp)(const void *addr, socklen_t len,
1019 struct hostent* pret;
1021 BEFORE_ORIGINAL_SOCK(gethostbyaddr, LIBC);
1023 pret = gethostbyaddrp(addr, len, type);
1025 AFTER_ORIGINAL_LIBC_SOCK(pret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
1026 NO_DESTINATIONINFO, "pdd", addr, len, type);
1031 void sethostent(int stayopen) {
1032 static void (*sethostentp)(int stayopen);
1034 BEFORE_ORIGINAL_SOCK(sethostent, LIBC);
1036 sethostentp(stayopen);
1038 AFTER_ORIGINAL_LIBC_SOCK(NULL, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
1039 NO_DESTINATIONINFO, "d", stayopen);
1042 void endhostent(void) {
1043 static void (*endhostentp)(void);
1045 BEFORE_ORIGINAL_SOCK(endhostent, LIBC);
1049 //AFTER_ORIGINAL_NOSOCK_RET(NULL, 0, FD_API_OTHER, "s", "");
1051 AFTER_ORIGINAL_LIBC_SOCK(NULL, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
1052 NO_DESTINATIONINFO, "s", "");
1055 void herror(const char *s) {
1056 static void (*herrorp)(const char *s);
1058 BEFORE_ORIGINAL_SOCK(herror, LIBC);
1062 AFTER_ORIGINAL_LIBC_SOCK(NULL, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
1063 NO_DESTINATIONINFO, "p", s);
1066 const char *hstrerror(int err) {
1067 static const char* (*hstrerrorp)(int err);
1070 BEFORE_ORIGINAL_SOCK(hstrerror, LIBC);
1072 cret = hstrerrorp(err);
1074 AFTER_ORIGINAL_LIBC_SOCK(cret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
1075 NO_DESTINATIONINFO, "d", err);
1080 struct hostent *gethostent(void) {
1081 static struct hostent* (*gethostentp)(void);
1082 struct hostent* pret;
1084 BEFORE_ORIGINAL_SOCK(gethostent, LIBC);
1086 pret = gethostentp();
1088 AFTER_ORIGINAL_LIBC_SOCK(pret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
1089 NO_DESTINATIONINFO, "s", "");
1094 struct hostent *gethostbyname2(const char *name, int af) {
1095 static struct hostent * (*gethostbyname2p)(const char *name, int af);
1096 struct hostent* pret;
1098 BEFORE_ORIGINAL_SOCK(gethostbyname2, LIBC);
1100 pret = gethostbyname2p(name, af);
1102 AFTER_ORIGINAL_LIBC_SOCK(pret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
1103 NO_DESTINATIONINFO, "pd", name, af);
1108 int gethostent_r(struct hostent *rret, char *buf, size_t buflen,
1109 struct hostent **result, int *h_errnop) {
1110 static int (*gethostent_rp)(struct hostent *rret, char *buf, size_t buflen,
1111 struct hostent **result, int *h_errnop);
1113 BEFORE_ORIGINAL_SOCK(gethostent_r, LIBC);
1115 ret = gethostent_rp(rret, buf, buflen, result, h_errnop);
1117 AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
1118 NO_DESTINATIONINFO, "ppdpp", rret, buf, buflen, result, h_errnop);
1123 int gethostbyaddr_r(const void *addr, socklen_t len, int type,
1124 struct hostent *rret, char *buf, size_t buflen, struct hostent **result,
1126 static int (*gethostbyaddr_rp)(const void *addr, socklen_t len, int type,
1127 struct hostent *rret, char *buf, size_t buflen,
1128 struct hostent **result, int *h_errnop);
1130 BEFORE_ORIGINAL_SOCK(gethostbyaddr_r, LIBC);
1132 ret = gethostbyaddr_rp(addr, len, type, rret, buf, buflen, result,
1135 AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
1136 NO_DESTINATIONINFO, "pddppdpp",
1137 addr, len, type, rret, buf, buflen, result, h_errnop);
1142 int gethostbyname_r(const char *name, struct hostent *rret, char *buf,
1143 size_t buflen, struct hostent **result, int *h_errnop) {
1144 static int (*gethostbyname_rp)(const char *name, struct hostent *rret,
1145 char *buf, size_t buflen, struct hostent **result, int *h_errnop);
1147 BEFORE_ORIGINAL_SOCK(gethostbyname_r, LIBC);
1149 ret = gethostbyname_rp(name, rret, buf, buflen, result, h_errnop);
1151 AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
1152 NO_DESTINATIONINFO, "pppdpp",
1153 name, rret, buf, buflen, result, h_errnop);
1158 int gethostbyname2_r(const char *name, int af, struct hostent *rret, char *buf,
1159 size_t buflen, struct hostent **result, int *h_errnop) {
1160 static int (*gethostbyname2_rp)(const char *name, int af,
1161 struct hostent *rret, char *buf, size_t buflen,
1162 struct hostent **result, int *h_errnop);
1164 BEFORE_ORIGINAL_SOCK(gethostbyname2_r, LIBC);
1166 ret = gethostbyname2_rp(name, af, rret, buf, buflen, result, h_errnop);
1168 AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
1169 NO_DESTINATIONINFO, "pdppdpp",
1170 name, af, rret, buf, buflen, result, h_errnop);
1175 struct servent *getservbyname(const char *name, const char *proto) {
1176 static struct servent * (*getservbynamep)(const char *name,
1178 struct servent* pret;
1180 BEFORE_ORIGINAL_SOCK(getservbyname, LIBC);
1182 pret = getservbynamep(name, proto);
1184 AFTER_ORIGINAL_LIBC_SOCK(pret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
1185 NO_DESTINATIONINFO, "pp", name, proto);
1190 void setservent(int stayopen) {
1191 static void (*setserventp)(int stayopen);
1193 BEFORE_ORIGINAL_SOCK(setservent, LIBC);
1195 setserventp(stayopen);
1197 AFTER_ORIGINAL_LIBC_SOCK(NULL, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
1198 NO_DESTINATIONINFO, "d", stayopen);
1201 void endservent(void) {
1202 static void (*endserventp)(void);
1204 BEFORE_ORIGINAL_SOCK(endservent, LIBC);
1208 AFTER_ORIGINAL_LIBC_SOCK(NULL, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
1209 NO_DESTINATIONINFO, "s", "");
1212 struct servent *getservent(void) {
1213 static struct servent * (*getserventp)(void);
1214 struct servent* pret;
1216 BEFORE_ORIGINAL_SOCK(getservent, LIBC);
1218 pret = getserventp();
1220 AFTER_ORIGINAL_LIBC_SOCK(pret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
1221 NO_DESTINATIONINFO, "s", "");
1226 struct servent *getservbyport(int port, const char *proto) {
1227 static struct servent * (*getservbyportp)(int port, const char *proto);
1228 struct servent* pret;
1230 BEFORE_ORIGINAL_SOCK(getservbyport, LIBC);
1232 pret = getservbyportp(port, proto);
1234 AFTER_ORIGINAL_LIBC_SOCK(pret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
1235 NO_DESTINATIONINFO, "dp", port, proto);
1240 int getservent_r(struct servent *result_buf, char *buf, size_t buflen,
1241 struct servent **result) {
1242 static int (*getservent_rp)(struct servent *result_buf, char *buf,
1243 size_t buflen, struct servent **result);
1245 BEFORE_ORIGINAL_SOCK(getservent_r, LIBC);
1247 ret = getservent_rp(result_buf, buf, buflen, result);
1249 AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
1250 NO_DESTINATIONINFO, "ppdp", result_buf, buf, buflen, result);
1255 int getservbyname_r(const char *name, const char *proto,
1256 struct servent *result_buf, char *buf, size_t buflen,
1257 struct servent **result) {
1258 static int (*getservbyname_rp)(const char *name, const char *proto,
1259 struct servent *result_buf, char *buf, size_t buflen,
1260 struct servent **result);
1262 BEFORE_ORIGINAL_SOCK(getservbyname_r, LIBC);
1264 ret = getservbyname_rp(name, proto, result_buf, buf, buflen, result);
1266 AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
1267 NO_DESTINATIONINFO, "ppppdp",
1268 name, proto, result_buf, buf, buflen, result);
1273 int getservbyport_r(int port, const char *proto, struct servent *result_buf,
1274 char *buf, size_t buflen, struct servent **result) {
1275 static int (*getservbyport_rp)(int port, const char *proto,
1276 struct servent *result_buf, char *buf, size_t buflen,
1277 struct servent **result);
1279 BEFORE_ORIGINAL_SOCK(getservbyport_r, LIBC);
1281 ret = getservbyport_rp(port, proto, result_buf, buf, buflen, result);
1283 AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
1284 NO_DESTINATIONINFO, "dpppdp",
1285 port, proto, result_buf, buf, buflen, result);
1290 struct netent* getnetent(void) {
1291 static struct netent * (*getnetentp)(void);
1292 struct netent* pret;
1294 BEFORE_ORIGINAL_SOCK(getnetent, LIBC);
1296 pret = getnetentp();
1298 AFTER_ORIGINAL_LIBC_SOCK(pret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
1299 NO_DESTINATIONINFO, "s", "");
1304 struct netent *getnetbyname(const char *name) {
1305 static struct netent * (*getnetbynamep)(const char *name);
1306 struct netent* pret;
1308 BEFORE_ORIGINAL_SOCK(getnetbyname, LIBC);
1310 pret = getnetbynamep(name);
1312 AFTER_ORIGINAL_LIBC_SOCK(pret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
1313 NO_DESTINATIONINFO, "p", name);
1318 struct netent *getnetbyaddr(uint32_t net, int type) {
1319 static struct netent * (*getnetbyaddrp)(uint32_t net, int type);
1320 struct netent * pret;
1322 BEFORE_ORIGINAL_SOCK(getnetbyaddr, LIBC);
1324 pret = getnetbyaddrp(net, type);
1326 AFTER_ORIGINAL_LIBC_SOCK(pret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
1327 NO_DESTINATIONINFO, "dd", net, type);
1332 void setnetent(int stayopen) {
1333 static void (*setnetentp)(int stayopen);
1335 BEFORE_ORIGINAL_SOCK(setnetent, LIBC);
1337 setnetentp(stayopen);
1339 AFTER_ORIGINAL_LIBC_SOCK(NULL, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
1340 NO_DESTINATIONINFO, "d", stayopen);
1343 void endnetent(void) {
1344 static void (*endnetentp)(void);
1346 BEFORE_ORIGINAL_SOCK(endnetent, LIBC);
1350 AFTER_ORIGINAL_LIBC_SOCK(NULL, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
1351 NO_DESTINATIONINFO, "s", "");
1354 int getnetent_r(struct netent *result_buf, char *buf, size_t buflen,
1355 struct netent **result, int *h_errnop) {
1356 static int (*getnetent_rp)(struct netent *result_buf, char *buf,
1357 size_t buflen, struct netent **result, int *h_errnop);
1359 BEFORE_ORIGINAL_SOCK(getnetent_r, LIBC);
1361 ret = getnetent_rp(result_buf, buf, buflen, result, h_errnop);
1363 AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
1364 NO_DESTINATIONINFO, "ppdpp",
1365 result_buf, buf, buflen, result, h_errnop);
1370 int getnetbyname_r(const char *name, struct netent *result_buf, char *buf,
1371 size_t buflen, struct netent **result, int *h_errnop) {
1372 static int (*getnetbyname_rp)(const char *name, struct netent *result_buf,
1373 char *buf, size_t buflen, struct netent **result, int *h_errnop);
1375 BEFORE_ORIGINAL_SOCK(getnetbyname_r, LIBC);
1377 ret = getnetbyname_rp(name, result_buf, buf, buflen, result, h_errnop);
1379 AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
1380 NO_DESTINATIONINFO, "pppdpp",
1381 name, result_buf, buf, buflen, result, h_errnop);
1386 int getnetbyaddr_r(uint32_t net, int type, struct netent *result_buf, char *buf,
1387 size_t buflen, struct netent **result, int *h_errnop) {
1388 static int (*getnetbyaddr_rp)(uint32_t net, int type,
1389 struct netent *result_buf, char *buf, size_t buflen,
1390 struct netent **result, int *h_errnop);
1392 BEFORE_ORIGINAL_SOCK(getnetbyaddr_r, LIBC);
1394 ret = getnetbyaddr_rp(net, type, result_buf, buf, buflen, result, h_errnop);
1396 AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
1397 NO_DESTINATIONINFO, "ddppdpp",
1398 net, type, result_buf, buf, buflen, result, h_errnop);
1403 struct protoent *getprotoent(void) {
1404 static struct protoent * (*getprotoentp)(void);
1405 struct protoent * pret;
1407 BEFORE_ORIGINAL_SOCK(getprotoent, LIBC);
1409 pret = getprotoentp();
1411 AFTER_ORIGINAL_LIBC_SOCK(pret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
1412 NO_DESTINATIONINFO, "s", "");
1417 struct protoent *getprotobyname(const char *name) {
1418 static struct protoent * (*getprotobynamep)(const char *name);
1419 struct protoent * pret;
1421 BEFORE_ORIGINAL_SOCK(getprotobyname, LIBC);
1423 pret = getprotobynamep(name);
1425 AFTER_ORIGINAL_LIBC_SOCK(pret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
1426 NO_DESTINATIONINFO, "p", name);
1431 struct protoent *getprotobynumber(int proto) {
1432 static struct protoent * (*getprotobynumberp)(int proto);
1433 struct protoent * pret;
1435 BEFORE_ORIGINAL_SOCK(getprotobynumber, LIBC);
1437 pret = getprotobynumberp(proto);
1439 AFTER_ORIGINAL_LIBC_SOCK(pret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
1440 NO_DESTINATIONINFO, "d", proto);
1445 void setprotoent(int stayopen) {
1446 static void (*setprotoentp)(int stayopen);
1448 BEFORE_ORIGINAL_SOCK(setprotoent, LIBC);
1450 setprotoentp(stayopen);
1452 AFTER_ORIGINAL_LIBC_SOCK(NULL, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
1453 NO_DESTINATIONINFO, "d", stayopen);
1456 void endprotoent(void) {
1457 static void (*endprotoentp)(void);
1459 BEFORE_ORIGINAL_SOCK(endprotoent, LIBC);
1463 AFTER_ORIGINAL_LIBC_SOCK(NULL, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
1464 NO_DESTINATIONINFO, "s", "");
1467 int getprotoent_r(struct protoent *result_buf, char *buf, size_t buflen,
1468 struct protoent **result) {
1469 static int (*getprotoent_rp)(struct protoent *result_buf, char *buf,
1470 size_t buflen, struct protoent **result);
1472 BEFORE_ORIGINAL_SOCK(getprotoent_r, LIBC);
1474 ret = getprotoent_rp(result_buf, buf, buflen, result);
1476 AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
1477 NO_DESTINATIONINFO, "ppdp", result_buf, buf, buflen, result);
1482 int getprotobyname_r(const char *name, struct protoent *result_buf, char *buf,
1483 size_t buflen, struct protoent **result) {
1484 static int (*getprotobyname_rp)(const char *name,
1485 struct protoent *result_buf, char *buf, size_t buflen,
1486 struct protoent **result);
1488 BEFORE_ORIGINAL_SOCK(getprotobyname_r, LIBC);
1490 ret = getprotobyname_rp(name, result_buf, buf, buflen, result);
1492 AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
1493 NO_DESTINATIONINFO, "pppdp", name, result_buf, buf, buflen, result);
1498 int getprotobynumber_r(int proto, struct protoent *result_buf, char *buf,
1499 size_t buflen, struct protoent **result) {
1500 static int (*getprotobynumber_rp)(int proto, struct protoent *result_buf,
1501 char *buf, size_t buflen, struct protoent **result);
1503 BEFORE_ORIGINAL_SOCK(getprotobynumber_r, LIBC);
1505 ret = getprotobynumber_rp(proto, result_buf, buf, buflen, result);
1507 AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
1508 NO_DESTINATIONINFO, "dppdp", proto, result_buf, buf, buflen, result);
1513 unsigned int if_nametoindex(__const char *__ifname) {
1514 static unsigned int (*if_nametoindexp)(__const char *__ifname);
1517 BEFORE_ORIGINAL_SOCK(if_nametoindex, LIBC);
1519 uret = if_nametoindexp(__ifname);
1521 AFTER_ORIGINAL_LIBC_SOCK(uret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
1522 NO_DESTINATIONINFO, "p", __ifname);
1527 char *if_indextoname(unsigned int __ifindex, char *__ifname) {
1528 static char * (*if_indextonamep)(unsigned int __ifindex, char *__ifname);
1531 BEFORE_ORIGINAL_SOCK(if_indextoname, LIBC);
1533 cret = if_indextonamep(__ifindex, __ifname);
1535 AFTER_ORIGINAL_LIBC_SOCK(cret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
1536 NO_DESTINATIONINFO, "dp", __ifindex, __ifname);
1541 struct if_nameindex *if_nameindex(void) {
1542 static struct if_nameindex * (*if_nameindexp)(void);
1543 struct if_nameindex * pret;
1545 BEFORE_ORIGINAL_NOFILTER(if_nameindex, LIBC);
1547 pret = if_nameindexp();
1549 AFTER_ORIGINAL_LIBC_SOCK(pret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
1550 NO_DESTINATIONINFO, "s", "");
1555 void if_freenameindex(struct if_nameindex *__ptr) {
1556 static void (*if_freenameindexp)(struct if_nameindex *__ptr);
1558 BEFORE_ORIGINAL_NOFILTER(if_freenameindex, LIBC);
1560 if_freenameindexp(__ptr);
1562 AFTER_ORIGINAL_LIBC_SOCK(NULL, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
1563 NO_DESTINATIONINFO, "p", __ptr);
1566 int getifaddrs(struct ifaddrs **ifap) {
1567 static int (*getifaddrsp)(struct ifaddrs **ifap);
1569 BEFORE_ORIGINAL_NOFILTER(getifaddrs, LIBC);
1571 ret = getifaddrsp(ifap);
1573 AFTER_ORIGINAL_LIBC_SOCK(ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
1574 NO_DESTINATIONINFO, "p", ifap);
1579 void freeifaddrs(struct ifaddrs *ifa) {
1580 static void (*freeifaddrsp)(struct ifaddrs *ifa);
1582 BEFORE_ORIGINAL_NOFILTER(freeifaddrs, LIBC);
1586 AFTER_ORIGINAL_LIBC_SOCK(NULL, OBJ_DUMMY, 0, SOCKET_API_OTHER, "",
1587 NO_DESTINATIONINFO, "p", ifa);
1592 uint16_t htobe16(uint16_t host_16bits)
1594 static uint16_t (*htobe16p)(uint16_t host_16bits);
1597 BEFORE_ORIGINAL_SOCK(htobe16, LIBC);
1599 uret = htobe16p(host_16bits);
1601 AFTER_ORIGINAL_NOSOCK_RET(VT_UINT16_T, uret, 0, FD_API_OTHER, "d", host_16bits);
1606 uint16_t htole16(uint16_t host_16bits)
1608 static uint16_t (*htole16p)(uint16_t host_16bits);
1611 BEFORE_ORIGINAL_SOCK(htole16, LIBC);
1613 uret = htole16p(host_16bits);
1615 AFTER_ORIGINAL_NOSOCK_RET(VT_UINT16_T, uret, 0, FD_API_OTHER, "d", host_16bits);
1620 uint16_t be16toh(uint16_t big_endian_16bits)
1622 static uint16_t (*be16tohp)(uint16_t big_endian_16bits);
1625 BEFORE_ORIGINAL_SOCK(be16toh, LIBC);
1627 uret = be16tohp(big_endian_16bits);
1629 AFTER_ORIGINAL_NOSOCK_RET(VT_UINT16_T, uret, 0, FD_API_OTHER,
1630 "d", big_endian_16bits);
1635 uint16_t le16toh(uint16_t little_endian_16bits)
1637 static uint16_t (*le16tohp)(uint16_t little_endian_16bits);
1640 BEFORE_ORIGINAL_SOCK(le16toh, LIBC);
1642 uret = le16tohp(little_endian_16bits);
1644 AFTER_ORIGINAL_NOSOCK_RET(VT_UINT16_T, uret, 0, FD_API_OTHER,
1645 "d", little_endian_16bits);
1650 uint32_t htobe32(uint32_t host_32bits)
1652 static uint32_t (*htobe32p)(uint32_t host_32bits);
1655 BEFORE_ORIGINAL_SOCK(htobe32, LIBC);
1657 uret = htobe32p(host_32bits);
1659 AFTER_ORIGINAL_NOSOCK_RET(VT_UINT32_T, uret, 0, FD_API_OTHER,
1665 uint32_t htole32(uint32_t host_32bits)
1667 static uint32_t (*htole32p)(uint32_t host_32bits);
1670 BEFORE_ORIGINAL_SOCK(htole32, LIBC);
1672 uret = htole32p(host_32bits);
1674 AFTER_ORIGINAL_NOSOCK_RET(VT_UINT32_T, uret, 0, FD_API_OTHER,
1680 uint32_t be32toh(uint32_t big_endian_32bits)
1682 static uint32_t (*be32tohp)(uint32_t big_endian_32bits);
1685 BEFORE_ORIGINAL_SOCK(be32toh, LIBC);
1687 uret = be32tohp(big_endian_32bits);
1689 AFTER_ORIGINAL_NOSOCK_RET(VT_UINT32_T, uret, 0, FD_API_OTHER,
1690 "d", big_endian_32bits);
1695 uint32_t le32toh(uint32_t little_endian_32bits)
1697 static uint32_t (*le32tohp)(uint32_t little_endian_32bits);
1700 BEFORE_ORIGINAL_SOCK(le32toh, LIBC);
1702 uret = le32tohp(little_endian_32bits);
1704 AFTER_ORIGINAL_NOSOCK_RET(VT_UINT32_T, uret, 0, FD_API_OTHER,
1705 "d", little_endian_32bits);
1710 uint64_t htobe64(uint64_t host_64bits)
1712 static uint64_t (*htobe64p)(uint64_t host_64bits);
1715 BEFORE_ORIGINAL_SOCK(htobe64, LIBC);
1717 uret = htobe64p(host_64bits);
1719 AFTER_ORIGINAL_NOSOCK_RET(VT_UINT64_T, uret, 0, FD_API_OTHER,
1725 uint64_t htole64(uint64_t host_64bits)
1727 static uint64_t (*htole64p)(uint64_t host_64bits);
1730 BEFORE_ORIGINAL_SOCK(htole64, LIBC);
1732 uret = htole64p(host_64bits);
1734 AFTER_ORIGINAL_NOSOCK_RET(VT_UINT64_T, uret, 0, FD_API_OTHER,
1740 uint64_t be64toh(uint64_t big_endian_64bits)
1742 static uint64_t (*be64tohp)(uint64_t big_endian_64bits);
1745 BEFORE_ORIGINAL_SOCK(be64toh, LIBC);
1747 uret = be64tohp(big_endian_64bits);
1749 AFTER_ORIGINAL_NOSOCK_RET(VT_UINT64_T, uret, 0, FD_API_OTHER,
1750 "d", big_endian_64bits);
1755 uint64_t le64toh(uint64_t little_endian_64bits)
1757 static uint64_t (*le64tohp)(uint64_t little_endian_64bits);
1760 BEFORE_ORIGINAL_SOCK(le64toh, LIBC);
1762 uret = le64tohp(little_endian_64bits);
1764 AFTER_ORIGINAL_NOSOCK_RET(VT_UINT64_T, uret, 0, FD_API_OTHER,
1765 "d", little_endian_64bits);
1770 struct in_addr inet_makeaddr(int net, int host)
1772 static struct in_addr (*inet_makeaddrp)(int net, int host);
1773 struct in_addr iret;
1775 BEFORE_ORIGINAL_SOCK(inet_makeaddr, LIBC);
1777 iret = inet_makeaddrp(net,host);
1779 AFTER_ORIGINAL_NOSOCK_RET(VT_UINT32_T, iret.s_addr, 0, FD_API_OTHER,