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>
40 #include <arpa/inet.h>
46 #include <sys/epoll.h>
48 #include "probeinfo.h"
50 #include "da_socket.h"
53 #include "api_id_mapping.h"
55 #include "real_functions.h"
59 static enum DaOptions _sopt = OPT_NETWORK;
60 void getAddress(const struct sockaddr *sa, char *address) {
61 char buff[INET6_ADDRSTRLEN];
65 const char sa_is_null[] = "<addr is NULL>";
66 memcpy(address, sa_is_null, sizeof(sa_is_null));
70 switch (sa->sa_family) {
72 snprintf(address, MAX_PATH_LENGTH, "%s:%d",
73 inet_ntoa(((struct sockaddr_in*) sa)->sin_addr),
74 (int) ntohs(((struct sockaddr_in*) sa)->sin_port));
77 snprintf(address, MAX_PATH_LENGTH, "%s:%d",
78 inet_ntop(AF_INET6, &(((struct sockaddr_in6 *) sa)->sin6_addr),
80 ntohs(((struct sockaddr_in6*) sa)->sin6_port));
83 path = ((struct sockaddr_un*)sa)->sun_path;
85 snprintf(address, MAX_PATH_LENGTH, "%s", path + 1);
87 snprintf(address, MAX_PATH_LENGTH, "%s", path);
90 snprintf(address, MAX_PATH_LENGTH, "<unknown socket type #%d>",
97 int socket(int domain, int type, int protocol) {
98 static int (*socketp)(int domain, int type, int protocol);
99 BEFORE_ORIGINAL_SOCK(socket, LIBC);
100 ret = socketp(domain, type, protocol);
102 AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, ret, SOCKET_API_FD_OPEN, info,
103 "ddd", domain, type, protocol);
108 int accept(int socket, struct sockaddr *address, socklen_t *address_len) {
110 static int (*acceptp)(int socket, struct sockaddr *address,
111 socklen_t *address_len);
113 BEFORE_ORIGINAL_SOCK(accept, LIBC);
115 char callAddress[MAX_PATH_LENGTH];
116 getAddress(address, callAddress);
118 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START('d', NULL, OBJ_DUMMY, socket,
119 SOCKET_API_ACCEPT_START, info,
120 "dsp", socket, callAddress,
121 voidp_to_uint64(address_len));
123 ret = acceptp(socket, address, address_len);
124 info.sock = (struct sockaddr *)address;
126 getAddress(address, callAddress);
128 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END('d', ret, OBJ_DUMMY, socket,
129 SOCKET_API_ACCEPT_END, info,
130 "dsp", socket, callAddress,
131 voidp_to_uint64(address_len));
136 int accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags) {
137 static int (*accept4p)(int sockfd, struct sockaddr *addr,
138 socklen_t *addrlen, int flags);
140 BEFORE_ORIGINAL_SOCK(accept4, LIBC);
142 char callAddress[MAX_PATH_LENGTH];
143 getAddress(addr, callAddress);
145 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START('d', NULL, OBJ_DUMMY, sockfd,
146 SOCKET_API_ACCEPT_START, info,
147 "dspd", sockfd, callAddress,
148 voidp_to_uint64(addrlen),
151 ret = accept4p(sockfd, addr, addrlen, flags);
152 info.sock = (struct sockaddr *)addr;
154 getAddress(addr, callAddress);
156 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END('d', ret, OBJ_DUMMY, sockfd,
157 SOCKET_API_ACCEPT_END, info,
158 "dspd", sockfd, callAddress,
159 voidp_to_uint64(addrlen), flags);
164 int connect(int socket, const struct sockaddr *address, socklen_t address_len) {
165 static int (*connectp)(int socket, const struct sockaddr *address,
166 socklen_t address_len);
168 BEFORE_ORIGINAL_SOCK(connect, LIBC);
170 ret = connectp(socket, address, address_len);
171 info.sock = (struct sockaddr *)address;
173 char callAddress[MAX_PATH_LENGTH];
174 getAddress(address, callAddress);
176 AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, socket, SOCKET_API_CONNECT,
178 socket, callAddress, address_len);
183 int shutdown(int socket, int how) {
184 static int (*shutdownp)(int socket, int how);
186 BEFORE_ORIGINAL_SOCK(shutdown, LIBC);
188 ret = shutdownp(socket, how);
190 AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, socket, SOCKET_API_FD_CLOSE,
191 info, "dd", socket, how);
196 int bind(int socket, const struct sockaddr *address, socklen_t address_len) {
197 static int (*bindp)(int socket, const struct sockaddr *address,
198 socklen_t address_len);
200 BEFORE_ORIGINAL_SOCK(bind, LIBC);
202 ret = bindp(socket, address, address_len);
203 info.sock = (struct sockaddr *)address;
205 char callAddress[MAX_PATH_LENGTH];
206 getAddress(address, callAddress);
208 AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, socket, SOCKET_API_BIND,
209 info, "dsd", socket, callAddress, address_len);
214 int listen(int socket, int backlog) {
215 static int (*listenp)(int socket, int backlog);
216 BEFORE_ORIGINAL_SOCK(listen, LIBC);
217 ret = listenp(socket, backlog);
219 AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, socket, SOCKET_API_LISTEN,
220 info, "dd", socket, backlog);
225 ssize_t send(int socket, const void *message, size_t length, int flags) {
226 static ssize_t (*sendp)(int socket, const void *message, size_t length,
228 ssize_t sret, result;
229 BEFORE_ORIGINAL_SOCK(send, LIBC);
231 char *messagP = (char *)message;
233 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START('x', NULL, OBJ_DUMMY, socket,
234 SOCKET_API_SEND_START, info,
236 voidp_to_uint64(messagP),
239 sret = sendp(socket, message, length, flags);
243 info.msg_total_size = result;
244 info.msg_pack_size = result>SOCKET_SEND_SIZE?SOCKET_SEND_SIZE:result;
245 info.msg_buf = messagP;
247 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END('x', sret, OBJ_DUMMY, socket,
248 SOCKET_API_SEND_END, info,
250 voidp_to_uint64(messagP),
255 ssize_t recv(int socket, void *buffer, size_t length, int flags) {
256 static ssize_t (*recvp)(int socket, void *buffer, size_t length, int flags);
257 ssize_t sret, result;
259 BEFORE_ORIGINAL_SOCK(recv, LIBC);
261 char *bufferP = (char *)buffer;
263 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START('x', NULL, OBJ_DUMMY, socket,
264 SOCKET_API_RECV_START, info,
266 voidp_to_uint64(bufferP),
269 sret = recvp(socket, buffer, length, flags);
273 info.msg_total_size = result;
274 info.msg_pack_size = result>SOCKET_SEND_SIZE?SOCKET_SEND_SIZE:result;
275 info.msg_buf = bufferP;
277 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END('x', sret, OBJ_DUMMY, socket,
278 SOCKET_API_RECV_END, info,
280 voidp_to_uint64(bufferP),
285 ssize_t sendto(int socket, const void *message, size_t length, int flags,
286 const struct sockaddr *dest_addr, socklen_t dest_len) {
287 static ssize_t (*sendtop)(int socket, const void *message, size_t length,
288 int flags, const struct sockaddr *dest_addr, socklen_t dest_len);
289 ssize_t sret, result;
291 BEFORE_ORIGINAL_SOCK(sendto, LIBC);
293 char *bufferP = (char *)message;
294 info.sock = (struct sockaddr *) dest_addr;
296 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START('x', NULL, OBJ_DUMMY, socket,
297 SOCKET_API_SEND_START, info,
299 voidp_to_uint64(bufferP),
301 voidp_to_uint64(dest_addr),
304 sret = sendtop(socket, message, length, flags, dest_addr, dest_len);
308 info.msg_total_size = result;
309 info.msg_pack_size = result>SOCKET_SEND_SIZE?SOCKET_SEND_SIZE:result;
310 info.msg_buf = bufferP;
312 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END('x', sret, OBJ_DUMMY, socket,
313 SOCKET_API_SEND_END, info,
315 voidp_to_uint64(bufferP),
317 voidp_to_uint64(dest_addr), dest_len);
321 ssize_t recvfrom(int socket, void *buffer, size_t length, int flags,
322 struct sockaddr *address, socklen_t *address_len) {
323 static ssize_t (*recvfromp)(int socket, void *buffer, size_t length,
324 int flags, struct sockaddr *address, socklen_t *address_len);
325 ssize_t sret, result;
327 BEFORE_ORIGINAL_SOCK(recvfrom, LIBC);
329 char *bufferP = (char *)buffer;
331 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START('x', NULL, OBJ_DUMMY, socket,
332 SOCKET_API_RECV_START, info,
334 voidp_to_uint64(bufferP),
336 voidp_to_uint64(address),
337 voidp_to_uint64(address_len));
339 sret = recvfromp(socket, buffer, length, flags, address, address_len);
340 info.sock = (struct sockaddr *)address;
345 info.msg_total_size = result;
346 info.msg_pack_size = result>SOCKET_SEND_SIZE?SOCKET_SEND_SIZE:result;
347 info.msg_buf = bufferP;
349 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END('x', sret, OBJ_DUMMY, socket,
350 SOCKET_API_RECV_END, info,
352 voidp_to_uint64(bufferP),
354 voidp_to_uint64(address),
355 voidp_to_uint64(address_len));
359 ssize_t recvmsg(int socket, struct msghdr *message, int flags) {
360 static ssize_t (*recvmsgp)(int socket, struct msghdr *message, int flags);
363 BEFORE_ORIGINAL_SOCK(recvmsg, LIBC);
365 int* bufferP = (int*) message->msg_name;
367 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START('x', NULL, OBJ_DUMMY, socket,
368 SOCKET_API_RECV_START, info,
370 voidp_to_uint64(message),
373 sret = recvmsgp(socket, message, flags);
375 memset(&message, 0, sizeof(message));
378 int sendMaxSize = SOCKET_SEND_SIZE;
379 char* out = (char*) real_malloc(sendMaxSize + 5);
383 memcpy(out, message, sendMaxSize + 5);
384 if (sret > sendMaxSize + 5) {
385 out[sendMaxSize] = '.';
386 out[sendMaxSize + 1] = '.';
387 out[sendMaxSize + 2] = '.';
388 out[sendMaxSize + 3] = '\0';
394 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END('x', sret, OBJ_DUMMY, socket,
395 SOCKET_API_RECV_END, info, "dpd",
396 socket, voidp_to_uint64(bufferP),
402 ssize_t sendmsg(int socket, const struct msghdr *message, int flags) {
403 static ssize_t (*sendmsgp)(int socket, const struct msghdr *message,
407 BEFORE_ORIGINAL_SOCK(sendmsg, LIBC);
409 int* bufferP = (int*) message->msg_name;
411 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START('x', NULL, OBJ_DUMMY, socket,
412 SOCKET_API_SEND_START, info,
414 voidp_to_uint64(message),
417 sret = sendmsgp(socket, message, flags);
419 memset(&message, 0, sizeof(message));
421 int sendMaxSize = SOCKET_SEND_SIZE;
422 char* out = (char*) real_malloc(sendMaxSize + 5);
426 memcpy(out, message, sendMaxSize + 5);
427 if (sret > sendMaxSize + 5) {
428 out[sendMaxSize] = '.';
429 out[sendMaxSize + 1] = '.';
430 out[sendMaxSize + 2] = '.';
431 out[sendMaxSize + 3] = '\0';
437 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END('x', sret, OBJ_DUMMY, socket,
438 SOCKET_API_SEND_END, info, "dpd",
439 socket, voidp_to_uint64(bufferP),
445 int getsockopt(int socket, int level, int option_name, void *option_value,
446 socklen_t *option_len) {
447 static int (*getsockoptp)(int socket, int level, int option_name,
448 void *option_value, socklen_t *option_len);
450 BEFORE_ORIGINAL_SOCK(getsockopt, LIBC);
452 ret = getsockoptp(socket, level, option_name, option_value, option_len);
454 AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, socket, SOCKET_API_OTHER,
455 info, "dddpp", socket, level, option_name,
456 voidp_to_uint64(option_value),
457 voidp_to_uint64(option_len));
462 int setsockopt(int socket, int level, int option_name, const void *option_value,
463 socklen_t option_len) {
464 static int (*setsockoptp)(int socket, int level, int option_name,
465 const void *option_value, socklen_t option_len);
467 BEFORE_ORIGINAL_SOCK(setsockopt, LIBC);
469 ret = setsockoptp(socket, level, option_name, option_value, option_len);
471 AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, socket, SOCKET_API_OTHER,
472 info, "dddpd", socket, level, option_name,
473 voidp_to_uint64(option_value), option_len);
478 int getpeername(int fd, struct sockaddr *addr, socklen_t *len) {
479 static int (*getpeernamep)(int s, struct sockaddr *addr, socklen_t *len);
481 BEFORE_ORIGINAL_SOCK(getpeername, LIBC);
483 ret = getpeernamep(fd, addr, len);
484 info.sock = (struct sockaddr *)addr;
486 char callAddress[MAX_PATH_LENGTH];
487 getAddress(addr, callAddress);
489 AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, fd, SOCKET_API_OTHER,
490 info, "dsp", fd, callAddress,
491 voidp_to_uint64(len));
495 int getsockname(int sockfd, struct sockaddr *addr, socklen_t *addrlen) {
496 static int (*getsocknamep)(int sockfd, struct sockaddr *addr,
499 BEFORE_ORIGINAL_SOCK(getsockname, LIBC);
501 ret = getsocknamep(sockfd, addr, addrlen);
502 info.sock = (struct sockaddr *)addr;
504 char callAddress[MAX_PATH_LENGTH];
505 getAddress(addr, callAddress);
507 AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, sockfd, SOCKET_API_OTHER,
508 info, "dsp", sockfd, callAddress,
509 voidp_to_uint64(addrlen));
514 int socketpair(int domain, int type, int protocol, int socket_vector[2]) {
515 static int (*socketpairp)(int domain, int type, int protocol,
516 int socket_vector[2]);
518 BEFORE_ORIGINAL_SOCK(socketpair, LIBC);
520 ret = socketpairp(domain, type, protocol, socket_vector);
522 AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, socket_vector[0],
523 SOCKET_API_FD_OPEN, info, "ddddd",
524 domain, type, protocol, socket_vector[0], socket_vector[1]);
529 int sockatmark(int __fd) {
530 static int (*sockatmarkp)(int __fd);
532 BEFORE_ORIGINAL_SOCK(sockatmark, LIBC);
534 ret = sockatmarkp(__fd);
536 AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, __fd,
537 SOCKET_API_OTHER, info, "d", __fd);
541 int isfdtype(int __fd, int __fdtype) {
542 static int (*isfdtypep)(int __fd, int __fdtype);
544 BEFORE_ORIGINAL_SOCK(isfdtype, LIBC);
546 ret = isfdtypep(__fd, __fdtype);
548 AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, __fd, SOCKET_API_OTHER, info,
549 "dd", __fd, __fdtype);
553 int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
554 struct timeval *timeout) {
555 static int (*selectp)(int nfds, fd_set *readfds, fd_set *writefds,
556 fd_set *exceptfds, struct timeval *timeout);
558 BEFORE_ORIGINAL_SOCK(select, LIBC);
560 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START('d', NULL, OBJ_DUMMY, 0,
561 SOCKET_API_EVENT_START, info,
563 voidp_to_uint64(readfds),
564 voidp_to_uint64(writefds),
565 voidp_to_uint64(exceptfds),
566 voidp_to_uint64(timeout));
568 ret = selectp(nfds, readfds, writefds, exceptfds, timeout);
570 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END('d', ret, OBJ_DUMMY, 0,
571 SOCKET_API_EVENT_END, info,
573 voidp_to_uint64(readfds),
574 voidp_to_uint64(writefds),
575 voidp_to_uint64(exceptfds),
576 voidp_to_uint64(timeout));
581 int pselect(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
582 const struct timespec *ntimeout, const sigset_t *sigmask) {
583 static int (*pselectp)(int nfds, fd_set *readfds, fd_set *writefds,
584 fd_set *exceptfds, const struct timespec *ntimeout,
585 const sigset_t *sigmask);
587 BEFORE_ORIGINAL_SOCK(pselect, LIBC);
589 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START('d', NULL, OBJ_DUMMY, 0,
590 SOCKET_API_EVENT_START, info,
592 voidp_to_uint64(readfds),
593 voidp_to_uint64(writefds),
594 voidp_to_uint64(exceptfds),
595 voidp_to_uint64(ntimeout),
596 voidp_to_uint64(sigmask));
598 ret = pselectp(nfds, readfds, writefds, exceptfds, ntimeout, sigmask);
600 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END('d', ret, OBJ_DUMMY, 0,
601 SOCKET_API_EVENT_END, info,
603 voidp_to_uint64(readfds),
604 voidp_to_uint64(writefds),
605 voidp_to_uint64(exceptfds),
606 voidp_to_uint64(ntimeout),
607 voidp_to_uint64(sigmask));
612 int poll(struct pollfd *fds, nfds_t nfds, int timeout) {
613 static int (*pollp)(struct pollfd *ufds, unsigned int nfds, int timeout);
615 BEFORE_ORIGINAL_SOCK(poll, LIBC);
617 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START('d', NULL, OBJ_DUMMY, fds->fd,
618 SOCKET_API_EVENT_START, info,
619 "pxd", voidp_to_uint64(fds),
620 (uint64_t)(nfds), timeout);
622 ret = pollp(fds, nfds, timeout);
624 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END('d', ret, OBJ_DUMMY, fds->fd,
625 SOCKET_API_EVENT_END, info,
626 "pxd", voidp_to_uint64(fds),
627 (uint64_t)(nfds), timeout);
632 int ppoll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout_ts,
633 const sigset_t *sigmask) {
634 static int (*ppollp)(struct pollfd *fds, nfds_t nfds,
635 const struct timespec *timeout_ts, const sigset_t *sigmask);
637 BEFORE_ORIGINAL_SOCK(ppoll, LIBC);
639 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START('d', NULL, OBJ_DUMMY, fds->fd,
640 SOCKET_API_EVENT_START, info,
642 voidp_to_uint64(fds),
644 voidp_to_uint64(timeout_ts),
645 voidp_to_uint64(sigmask));
647 ret = ppollp(fds, nfds, timeout_ts, sigmask);
649 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END('d', ret, OBJ_DUMMY, fds->fd,
650 SOCKET_API_EVENT_END, info,
652 voidp_to_uint64(fds),
654 voidp_to_uint64(timeout_ts),
655 voidp_to_uint64(sigmask));
660 int epoll_create(int __size) {
661 static int (*epoll_createp)(int __size);
662 BEFORE_ORIGINAL_SOCK(epoll_create, LIBC);
664 ret = epoll_createp(__size);
666 AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, ret, SOCKET_API_FD_OPEN, info,
671 int epoll_create1(int __flags) {
672 static int (*epoll_create1p)(int __size);
673 BEFORE_ORIGINAL_SOCK(epoll_create1, LIBC);
675 ret = epoll_create1p(__flags);
677 AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, ret, SOCKET_API_FD_OPEN, info,
682 int epoll_wait(int __epfd, struct epoll_event *__events, int __maxevents,
684 static int (*epoll_waitp)(int __epfd, struct epoll_event *__events,
685 int __maxevents, int __timeout);
686 BEFORE_ORIGINAL_SOCK(epoll_wait, LIBC);
688 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START('d', NULL, OBJ_DUMMY, __epfd,
689 SOCKET_API_EVENT_START, info,
691 voidp_to_uint64(__events),
692 __maxevents, __timeout);
694 ret = epoll_waitp(__epfd, __events, __maxevents, __timeout);
696 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END('d', ret, OBJ_DUMMY, __epfd,
697 SOCKET_API_EVENT_END, info,
699 voidp_to_uint64(__events),
700 __maxevents, __timeout);
705 int epoll_pwait(int __epfd, struct epoll_event *__events, int __maxevents,
706 int __timeout, __const __sigset_t *__ss) {
707 static int (*epoll_pwaitp)(int __epfd, struct epoll_event *__events,
708 int __maxevents, int __timeout, __const __sigset_t *__ss);
709 BEFORE_ORIGINAL_SOCK(epoll_pwait, LIBC);
711 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START('d', NULL, OBJ_DUMMY, __epfd,
712 SOCKET_API_EVENT_START, info,
714 voidp_to_uint64(__events),
715 __maxevents, __timeout,
716 voidp_to_uint64(__ss));
718 ret = epoll_pwaitp(__epfd, __events, __maxevents, __timeout, __ss);
720 AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END('d', ret, OBJ_DUMMY, __epfd,
721 SOCKET_API_EVENT_END, info,
723 voidp_to_uint64(__events),
724 __maxevents, __timeout,
725 voidp_to_uint64(__ss));
730 int epoll_ctl(int __epfd, int __op, int __fd, struct epoll_event *__event) {
731 static int (*epoll_ctlp)(int __epfd, int __op, int __fd,
732 struct epoll_event *__event);
734 BEFORE_ORIGINAL_SOCK(epoll_ctl, LIBC);
736 ret = epoll_ctlp(__epfd, __op, __fd, __event);
738 AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, __fd, SOCKET_API_OTHER,
739 info, "dddp", __epfd, __op, __fd,
740 voidp_to_uint64(__event));
747 uint32_t htonl(uint32_t hostlong) {
748 static uint32_t (*htonlp)(uint32_t hostlong);
751 BEFORE_ORIGINAL_SOCK(htonl, LIBC);
753 uret = htonlp(hostlong);
755 AFTER_ORIGINAL_LIBC_SOCK('d', uret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
756 info, "d", hostlong);
761 uint16_t htons(uint16_t hostshort) {
762 static uint16_t (*htonsp)(uint16_t hostshort);
765 BEFORE_ORIGINAL_SOCK(htons, LIBC);
767 uret = htonsp(hostshort);
769 AFTER_ORIGINAL_LIBC_SOCK('d', (uint32_t)uret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
770 info, "d", hostshort);
775 int inet_aton(const char *cp, struct in_addr *inp) {
776 static int (*inet_atonp)(const char *cp, struct in_addr *inp);
778 BEFORE_ORIGINAL_SOCK(inet_aton, LIBC);
780 ret = inet_atonp(cp, inp);
782 AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
783 info, "pp", voidp_to_uint64(cp),
784 voidp_to_uint64(inp));
789 in_addr_t inet_addr(const char *cp) {
790 static in_addr_t (*inet_addrp)(const char *cp);
793 BEFORE_ORIGINAL_SOCK(inet_addr, LIBC);
795 iret = inet_addrp(cp);
797 AFTER_ORIGINAL_LIBC_SOCK(iret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
798 info, "p", voidp_to_uint64(cp));
803 in_addr_t inet_network(const char *cp) {
804 static in_addr_t (*inet_networkp)(const char *cp);
807 BEFORE_ORIGINAL_SOCK(inet_network, LIBC);
809 iret = inet_networkp(cp);
811 AFTER_ORIGINAL_LIBC_SOCK(iret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
812 info, "p", voidp_to_uint64(cp));
817 char *inet_ntoa(struct in_addr in) {
818 static char * (*inet_ntoap)(struct in_addr in);
821 BEFORE_ORIGINAL_SOCK(inet_ntoa, LIBC);
823 sret = inet_ntoap(in);
825 AFTER_ORIGINAL_LIBC_SOCK(sret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
826 info, "d", in.s_addr);
831 uint32_t ntohl(uint32_t netlong) {
832 static uint32_t (*ntohlp)(uint32_t netlong);
835 BEFORE_ORIGINAL_SOCK(ntohl, LIBC);
837 uret = ntohlp(netlong);
839 AFTER_ORIGINAL_LIBC_SOCK('d', uret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
845 uint16_t ntohs(uint16_t netshort) {
846 static uint16_t (*ntohsp)(uint16_t netshort);
849 BEFORE_ORIGINAL_SOCK(ntohs, LIBC);
851 uret = ntohsp(netshort);
853 AFTER_ORIGINAL_LIBC_SOCK('d', (uint32_t)uret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
854 info, "d", netshort);
859 in_addr_t inet_lnaof(struct in_addr in) {
860 static in_addr_t (*inet_lnaofp)(struct in_addr in);
863 BEFORE_ORIGINAL_SOCK(inet_lnaof, LIBC);
865 iret = inet_lnaofp(in);
867 AFTER_ORIGINAL_LIBC_SOCK('d', iret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
868 info, "d", in.s_addr);
873 in_addr_t inet_netof(struct in_addr in) {
874 static in_addr_t (*inet_netofp)(struct in_addr in);
877 BEFORE_ORIGINAL_SOCK(inet_netof, LIBC);
879 iret = inet_netofp(in);
881 AFTER_ORIGINAL_LIBC_SOCK('d', iret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
882 info, "d", in.s_addr);
887 const char *inet_ntop(int af, const void *src, char *dst, socklen_t size) {
888 static const char* (*inet_ntopp)(int af, const void *src, char *dst,
892 BEFORE_ORIGINAL_SOCK(inet_ntop, LIBC);
894 cret = inet_ntopp(af, src, dst, size);
896 AFTER_ORIGINAL_LIBC_SOCK(cret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
897 info, "dppd", af, voidp_to_uint64(src), voidp_to_uint64(dst), size);
902 int inet_pton(int af, const char *src, void *dst) {
903 static int (*inet_ptonp)(int af, const char *src, void *dst);
905 BEFORE_ORIGINAL_SOCK(inet_pton, LIBC);
907 ret = inet_ptonp(af, src, dst);
909 AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
910 info, "dpp", af, voidp_to_uint64(src), voidp_to_uint64(dst));
915 int getaddrinfo(const char *node, const char *service,
916 const struct addrinfo *hints, struct addrinfo **res) {
917 static int (*getaddrinfop)(const char *node, const char *service,
918 const struct addrinfo *hints, struct addrinfo **res);
920 BEFORE_ORIGINAL_NOFILTER(getaddrinfo, LIBC);
922 ret = getaddrinfop(node, service, hints, res);
924 AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
925 info, "pppp", voidp_to_uint64(node), voidp_to_uint64(service), voidp_to_uint64(hints), voidp_to_uint64(res));
930 void freeaddrinfo(struct addrinfo *res) {
931 static void (*freeaddrinfop)(struct addrinfo *res);
933 BEFORE_ORIGINAL_NOFILTER(freeaddrinfo, LIBC);
937 AFTER_ORIGINAL_LIBC_SOCK(NULL, OBJ_DUMMY, 0, SOCKET_API_OTHER,
938 info, "p", voidp_to_uint64(res));
941 const char *gai_strerror(int errcode) {
942 static const char * (*gai_strerrorp)(int errcode);
945 BEFORE_ORIGINAL_SOCK(gai_strerror, LIBC);
947 cret = gai_strerrorp(errcode);
949 AFTER_ORIGINAL_LIBC_SOCK(cret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
955 int gai_suspend(const struct gaicb* const list[], int nitems,
956 const struct timespec *timeout) {
957 static int (*gai_suspendp)(const struct gaicb* const list[], int nitems,
958 const struct timespec *timeout);
960 BEFORE_ORIGINAL_SOCK(gai_suspend, LIBC);
962 ret = gai_suspendp(list, nitems, timeout);
964 AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
965 info, "pdp", voidp_to_uint64(list), nitems, voidp_to_uint64(timeout));
970 int gai_error(struct gaicb *req) {
971 static int (*gai_errorp)(struct gaicb *req);
973 BEFORE_ORIGINAL_SOCK(gai_error, LIBC);
975 ret = gai_errorp(req);
977 AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
978 info, "p", voidp_to_uint64(req));
983 int gai_cancel(struct gaicb *req) {
984 static int (*gai_cancelp)(struct gaicb *req);
986 BEFORE_ORIGINAL_SOCK(gai_cancel, LIBC);
988 ret = gai_cancelp(req);
990 AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
991 info, "p", voidp_to_uint64(req));
996 int getaddrinfo_a(int mode, struct gaicb *list[], int nitems,
997 struct sigevent *sevp) {
998 static int (*getaddrinfo_ap)(int mode, struct gaicb *list[], int nitems,
999 struct sigevent *sevp);
1001 BEFORE_ORIGINAL_SOCK(getaddrinfo_a, LIBC);
1003 ret = getaddrinfo_ap(mode, list, nitems, sevp);
1005 AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1006 info, "dpdp", mode, voidp_to_uint64(list), nitems, voidp_to_uint64(sevp));
1011 int getdomainname(char *name, size_t len) {
1012 static int (*getdomainnamep)(char *name, size_t len);
1014 BEFORE_ORIGINAL_SOCK(getdomainname, LIBC);
1016 ret = getdomainnamep(name, len);
1018 //AFTER_ORIGINAL_NOSOCK(FD_API_OTHER, "pd", voidp_to_uint64(name), len);
1020 AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1021 info, "pd", voidp_to_uint64(name), len);
1026 int setdomainname(const char *name, size_t len) {
1027 static int (*setdomainnamep)(const char *name, size_t len);
1029 BEFORE_ORIGINAL_SOCK(setdomainname, LIBC);
1031 ret = setdomainnamep(name, len);
1033 AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1034 info, "pd", voidp_to_uint64(name), len);
1039 int gethostname(char *name, size_t len) {
1040 static int (*gethostnamep)(char *name, size_t len);
1042 BEFORE_ORIGINAL_SOCK(gethostname, LIBC);
1044 ret = gethostnamep(name, len);
1046 AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1047 info, "pd", voidp_to_uint64(name), len);
1052 int sethostname(const char *name, size_t len) {
1053 static int (*sethostnamep)(const char *name, size_t len);
1055 BEFORE_ORIGINAL_SOCK(sethostname, LIBC);
1057 ret = sethostnamep(name, len);
1059 AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1060 info, "pd", voidp_to_uint64(name), len);
1065 int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host,
1066 socklen_t hostlen, char *serv, socklen_t servlen, unsigned int flags) {
1067 static int (*getnameinfop)(const struct sockaddr *sa, socklen_t salen,
1068 char *host, socklen_t hostlen, char *serv, socklen_t servlen,
1069 unsigned int flags);
1071 BEFORE_ORIGINAL_SOCK(getnameinfo, LIBC);
1073 ret = getnameinfop(sa, salen, host, hostlen, serv, servlen, flags);
1075 AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1076 info, "pdpdpdd", voidp_to_uint64(sa), salen,
1077 voidp_to_uint64(host), hostlen,
1078 voidp_to_uint64(serv), servlen, flags);
1083 struct hostent *gethostbyname(const char *name) {
1084 static struct hostent * (*gethostbynamep)(const char *name);
1085 struct hostent* pret;
1087 BEFORE_ORIGINAL_SOCK(gethostbyname, LIBC);
1089 pret = gethostbynamep(name);
1091 AFTER_ORIGINAL_LIBC_SOCK(pret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1092 info, "p", voidp_to_uint64(name));
1097 struct hostent *gethostbyaddr(const void *addr, socklen_t len, int type) {
1098 static struct hostent * (*gethostbyaddrp)(const void *addr, socklen_t len,
1100 struct hostent* pret;
1102 BEFORE_ORIGINAL_SOCK(gethostbyaddr, LIBC);
1104 pret = gethostbyaddrp(addr, len, type);
1106 AFTER_ORIGINAL_LIBC_SOCK(pret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1107 info, "pdd", voidp_to_uint64(addr), len, type);
1112 void sethostent(int stayopen) {
1113 static void (*sethostentp)(int stayopen);
1115 BEFORE_ORIGINAL_SOCK(sethostent, LIBC);
1117 sethostentp(stayopen);
1119 AFTER_ORIGINAL_LIBC_SOCK(NULL, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1120 info, "d", stayopen);
1123 void endhostent(void) {
1124 static void (*endhostentp)(void);
1126 BEFORE_ORIGINAL_SOCK(endhostent, LIBC);
1130 //AFTER_ORIGINAL_NOSOCK_RET(NULL, 0, FD_API_OTHER, "s", "");
1132 AFTER_ORIGINAL_LIBC_SOCK(NULL, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1136 void herror(const char *s) {
1137 static void (*herrorp)(const char *s);
1139 BEFORE_ORIGINAL_SOCK(herror, LIBC);
1143 AFTER_ORIGINAL_LIBC_SOCK(NULL, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1144 info, "p", voidp_to_uint64(s));
1147 const char *hstrerror(int err) {
1148 static const char* (*hstrerrorp)(int err);
1151 BEFORE_ORIGINAL_SOCK(hstrerror, LIBC);
1153 cret = hstrerrorp(err);
1155 AFTER_ORIGINAL_LIBC_SOCK(cret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1161 struct hostent *gethostent(void) {
1162 static struct hostent* (*gethostentp)(void);
1163 struct hostent* pret;
1165 BEFORE_ORIGINAL_SOCK(gethostent, LIBC);
1167 pret = gethostentp();
1169 AFTER_ORIGINAL_LIBC_SOCK(pret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1175 struct hostent *gethostbyname2(const char *name, int af) {
1176 static struct hostent * (*gethostbyname2p)(const char *name, int af);
1177 struct hostent* pret;
1179 BEFORE_ORIGINAL_SOCK(gethostbyname2, LIBC);
1181 pret = gethostbyname2p(name, af);
1183 AFTER_ORIGINAL_LIBC_SOCK(pret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1184 info, "pd", voidp_to_uint64(name), af);
1189 int gethostent_r(struct hostent *rret, char *buf, size_t buflen,
1190 struct hostent **result, int *h_errnop) {
1191 static int (*gethostent_rp)(struct hostent *rret, char *buf, size_t buflen,
1192 struct hostent **result, int *h_errnop);
1194 BEFORE_ORIGINAL_SOCK(gethostent_r, LIBC);
1196 ret = gethostent_rp(rret, buf, buflen, result, h_errnop);
1198 AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1199 info, "ppdpp", voidp_to_uint64(rret),
1200 voidp_to_uint64(buf), buflen,
1201 voidp_to_uint64(result),
1202 voidp_to_uint64(h_errnop));
1207 int gethostbyaddr_r(const void *addr, socklen_t len, int type,
1208 struct hostent *rret, char *buf, size_t buflen, struct hostent **result,
1210 static int (*gethostbyaddr_rp)(const void *addr, socklen_t len, int type,
1211 struct hostent *rret, char *buf, size_t buflen,
1212 struct hostent **result, int *h_errnop);
1214 BEFORE_ORIGINAL_SOCK(gethostbyaddr_r, LIBC);
1216 ret = gethostbyaddr_rp(addr, len, type, rret, buf, buflen, result,
1219 AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1220 info, "pddppdpp", voidp_to_uint64(addr), len,
1221 type, voidp_to_uint64(rret),
1222 voidp_to_uint64(buf), buflen,
1223 voidp_to_uint64(result),
1224 voidp_to_uint64(h_errnop));
1229 int gethostbyname_r(const char *name, struct hostent *rret, char *buf,
1230 size_t buflen, struct hostent **result, int *h_errnop) {
1231 static int (*gethostbyname_rp)(const char *name, struct hostent *rret,
1232 char *buf, size_t buflen, struct hostent **result, int *h_errnop);
1234 BEFORE_ORIGINAL_SOCK(gethostbyname_r, LIBC);
1236 ret = gethostbyname_rp(name, rret, buf, buflen, result, h_errnop);
1238 AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1239 info, "pppdpp", voidp_to_uint64(name),
1240 voidp_to_uint64(rret), voidp_to_uint64(buf),
1241 buflen, voidp_to_uint64(result),
1242 voidp_to_uint64(h_errnop));
1247 int gethostbyname2_r(const char *name, int af, struct hostent *rret, char *buf,
1248 size_t buflen, struct hostent **result, int *h_errnop) {
1249 static int (*gethostbyname2_rp)(const char *name, int af,
1250 struct hostent *rret, char *buf, size_t buflen,
1251 struct hostent **result, int *h_errnop);
1253 BEFORE_ORIGINAL_SOCK(gethostbyname2_r, LIBC);
1255 ret = gethostbyname2_rp(name, af, rret, buf, buflen, result, h_errnop);
1257 AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1258 info, "pdppdpp", voidp_to_uint64(name), af,
1259 voidp_to_uint64(rret), voidp_to_uint64(buf),
1260 buflen, voidp_to_uint64(result),
1261 voidp_to_uint64(h_errnop));
1266 struct servent *getservbyname(const char *name, const char *proto) {
1267 static struct servent * (*getservbynamep)(const char *name,
1269 struct servent* pret;
1271 BEFORE_ORIGINAL_SOCK(getservbyname, LIBC);
1273 pret = getservbynamep(name, proto);
1275 AFTER_ORIGINAL_LIBC_SOCK(pret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1276 info, "pp", voidp_to_uint64(name),
1277 voidp_to_uint64(proto));
1282 void setservent(int stayopen) {
1283 static void (*setserventp)(int stayopen);
1285 BEFORE_ORIGINAL_SOCK(setservent, LIBC);
1287 setserventp(stayopen);
1289 AFTER_ORIGINAL_LIBC_SOCK(NULL, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1290 info, "d", stayopen);
1293 void endservent(void) {
1294 static void (*endserventp)(void);
1296 BEFORE_ORIGINAL_SOCK(endservent, LIBC);
1300 AFTER_ORIGINAL_LIBC_SOCK(NULL, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1304 struct servent *getservent(void) {
1305 static struct servent * (*getserventp)(void);
1306 struct servent* pret;
1308 BEFORE_ORIGINAL_SOCK(getservent, LIBC);
1310 pret = getserventp();
1312 AFTER_ORIGINAL_LIBC_SOCK(pret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1318 struct servent *getservbyport(int port, const char *proto) {
1319 static struct servent * (*getservbyportp)(int port, const char *proto);
1320 struct servent* pret;
1322 BEFORE_ORIGINAL_SOCK(getservbyport, LIBC);
1324 pret = getservbyportp(port, proto);
1326 AFTER_ORIGINAL_LIBC_SOCK(pret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1327 info, "dp", port, voidp_to_uint64(proto));
1332 int getservent_r(struct servent *result_buf, char *buf, size_t buflen,
1333 struct servent **result) {
1334 static int (*getservent_rp)(struct servent *result_buf, char *buf,
1335 size_t buflen, struct servent **result);
1337 BEFORE_ORIGINAL_SOCK(getservent_r, LIBC);
1339 ret = getservent_rp(result_buf, buf, buflen, result);
1341 AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1342 info, "ppdp", voidp_to_uint64(result_buf),
1343 voidp_to_uint64(buf), buflen,
1344 voidp_to_uint64(result));
1349 int getservbyname_r(const char *name, const char *proto,
1350 struct servent *result_buf, char *buf, size_t buflen,
1351 struct servent **result) {
1352 static int (*getservbyname_rp)(const char *name, const char *proto,
1353 struct servent *result_buf, char *buf, size_t buflen,
1354 struct servent **result);
1356 BEFORE_ORIGINAL_SOCK(getservbyname_r, LIBC);
1358 ret = getservbyname_rp(name, proto, result_buf, buf, buflen, result);
1360 AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1361 info, "ppppdp", voidp_to_uint64(name),
1362 voidp_to_uint64(proto),
1363 voidp_to_uint64(result_buf),
1364 voidp_to_uint64(buf), buflen,
1365 voidp_to_uint64(result));
1370 int getservbyport_r(int port, const char *proto, struct servent *result_buf,
1371 char *buf, size_t buflen, struct servent **result) {
1372 static int (*getservbyport_rp)(int port, const char *proto,
1373 struct servent *result_buf, char *buf, size_t buflen,
1374 struct servent **result);
1376 BEFORE_ORIGINAL_SOCK(getservbyport_r, LIBC);
1378 ret = getservbyport_rp(port, proto, result_buf, buf, buflen, result);
1380 AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1381 info, "dpppdp", port, voidp_to_uint64(proto),
1382 voidp_to_uint64(result_buf),
1383 voidp_to_uint64(buf), buflen,
1384 voidp_to_uint64(result));
1389 struct netent* getnetent(void) {
1390 static struct netent * (*getnetentp)(void);
1391 struct netent* pret;
1393 BEFORE_ORIGINAL_SOCK(getnetent, LIBC);
1395 pret = getnetentp();
1397 AFTER_ORIGINAL_LIBC_SOCK(pret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1403 struct netent *getnetbyname(const char *name) {
1404 static struct netent * (*getnetbynamep)(const char *name);
1405 struct netent* pret;
1407 BEFORE_ORIGINAL_SOCK(getnetbyname, LIBC);
1409 pret = getnetbynamep(name);
1411 AFTER_ORIGINAL_LIBC_SOCK(pret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1412 info, "p", voidp_to_uint64(name));
1417 struct netent *getnetbyaddr(uint32_t net, int type) {
1418 static struct netent * (*getnetbyaddrp)(uint32_t net, int type);
1419 struct netent * pret;
1421 BEFORE_ORIGINAL_SOCK(getnetbyaddr, LIBC);
1423 pret = getnetbyaddrp(net, type);
1425 AFTER_ORIGINAL_LIBC_SOCK(pret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1426 info, "dd", net, type);
1431 void setnetent(int stayopen) {
1432 static void (*setnetentp)(int stayopen);
1434 BEFORE_ORIGINAL_SOCK(setnetent, LIBC);
1436 setnetentp(stayopen);
1438 AFTER_ORIGINAL_LIBC_SOCK(NULL, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1439 info, "d", stayopen);
1442 void endnetent(void) {
1443 static void (*endnetentp)(void);
1445 BEFORE_ORIGINAL_SOCK(endnetent, LIBC);
1449 AFTER_ORIGINAL_LIBC_SOCK(NULL, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1453 int getnetent_r(struct netent *result_buf, char *buf, size_t buflen,
1454 struct netent **result, int *h_errnop) {
1455 static int (*getnetent_rp)(struct netent *result_buf, char *buf,
1456 size_t buflen, struct netent **result, int *h_errnop);
1458 BEFORE_ORIGINAL_SOCK(getnetent_r, LIBC);
1460 ret = getnetent_rp(result_buf, buf, buflen, result, h_errnop);
1462 AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1463 info, "ppdpp", voidp_to_uint64(result_buf),
1464 voidp_to_uint64(buf), buflen,
1465 voidp_to_uint64(result),
1466 voidp_to_uint64(h_errnop));
1471 int getnetbyname_r(const char *name, struct netent *result_buf, char *buf,
1472 size_t buflen, struct netent **result, int *h_errnop) {
1473 static int (*getnetbyname_rp)(const char *name, struct netent *result_buf,
1474 char *buf, size_t buflen, struct netent **result, int *h_errnop);
1476 BEFORE_ORIGINAL_SOCK(getnetbyname_r, LIBC);
1478 ret = getnetbyname_rp(name, result_buf, buf, buflen, result, h_errnop);
1480 AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1481 info, "pppdpp", voidp_to_uint64(name),
1482 voidp_to_uint64(result_buf),
1483 voidp_to_uint64(buf), buflen,
1484 voidp_to_uint64(result),
1485 voidp_to_uint64(h_errnop));
1490 int getnetbyaddr_r(uint32_t net, int type, struct netent *result_buf, char *buf,
1491 size_t buflen, struct netent **result, int *h_errnop) {
1492 static int (*getnetbyaddr_rp)(uint32_t net, int type,
1493 struct netent *result_buf, char *buf, size_t buflen,
1494 struct netent **result, int *h_errnop);
1496 BEFORE_ORIGINAL_SOCK(getnetbyaddr_r, LIBC);
1498 ret = getnetbyaddr_rp(net, type, result_buf, buf, buflen, result, h_errnop);
1500 AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1501 info, "ddppdpp", net, type,
1502 voidp_to_uint64(result_buf),
1503 voidp_to_uint64(buf), buflen,
1504 voidp_to_uint64(result),
1505 voidp_to_uint64(h_errnop));
1510 struct protoent *getprotoent(void) {
1511 static struct protoent * (*getprotoentp)(void);
1512 struct protoent * pret;
1514 BEFORE_ORIGINAL_SOCK(getprotoent, LIBC);
1516 pret = getprotoentp();
1518 AFTER_ORIGINAL_LIBC_SOCK(pret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1524 struct protoent *getprotobyname(const char *name) {
1525 static struct protoent * (*getprotobynamep)(const char *name);
1526 struct protoent * pret;
1528 BEFORE_ORIGINAL_SOCK(getprotobyname, LIBC);
1530 pret = getprotobynamep(name);
1532 AFTER_ORIGINAL_LIBC_SOCK(pret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1533 info, "p", voidp_to_uint64(name));
1538 struct protoent *getprotobynumber(int proto) {
1539 static struct protoent * (*getprotobynumberp)(int proto);
1540 struct protoent * pret;
1542 BEFORE_ORIGINAL_SOCK(getprotobynumber, LIBC);
1544 pret = getprotobynumberp(proto);
1546 AFTER_ORIGINAL_LIBC_SOCK(pret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1552 void setprotoent(int stayopen) {
1553 static void (*setprotoentp)(int stayopen);
1555 BEFORE_ORIGINAL_SOCK(setprotoent, LIBC);
1557 setprotoentp(stayopen);
1559 AFTER_ORIGINAL_LIBC_SOCK(NULL, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1560 info, "d", stayopen);
1563 void endprotoent(void) {
1564 static void (*endprotoentp)(void);
1566 BEFORE_ORIGINAL_SOCK(endprotoent, LIBC);
1570 AFTER_ORIGINAL_LIBC_SOCK(NULL, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1574 int getprotoent_r(struct protoent *result_buf, char *buf, size_t buflen,
1575 struct protoent **result) {
1576 static int (*getprotoent_rp)(struct protoent *result_buf, char *buf,
1577 size_t buflen, struct protoent **result);
1579 BEFORE_ORIGINAL_SOCK(getprotoent_r, LIBC);
1581 ret = getprotoent_rp(result_buf, buf, buflen, result);
1583 AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1584 info, "ppdp", voidp_to_uint64(result_buf),
1585 voidp_to_uint64(buf), buflen,
1586 voidp_to_uint64(result));
1591 int getprotobyname_r(const char *name, struct protoent *result_buf, char *buf,
1592 size_t buflen, struct protoent **result) {
1593 static int (*getprotobyname_rp)(const char *name,
1594 struct protoent *result_buf, char *buf, size_t buflen,
1595 struct protoent **result);
1597 BEFORE_ORIGINAL_SOCK(getprotobyname_r, LIBC);
1599 ret = getprotobyname_rp(name, result_buf, buf, buflen, result);
1601 AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1602 info, "pppdp", voidp_to_uint64(name),
1603 voidp_to_uint64(result_buf),
1604 voidp_to_uint64(buf), buflen,
1605 voidp_to_uint64(result));
1610 int getprotobynumber_r(int proto, struct protoent *result_buf, char *buf,
1611 size_t buflen, struct protoent **result) {
1612 static int (*getprotobynumber_rp)(int proto, struct protoent *result_buf,
1613 char *buf, size_t buflen, struct protoent **result);
1615 BEFORE_ORIGINAL_SOCK(getprotobynumber_r, LIBC);
1617 ret = getprotobynumber_rp(proto, result_buf, buf, buflen, result);
1619 AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1620 info, "dppdp", proto,
1621 voidp_to_uint64(result_buf),
1622 voidp_to_uint64(buf), buflen,
1623 voidp_to_uint64(result));
1628 unsigned int if_nametoindex(__const char *__ifname) {
1629 static unsigned int (*if_nametoindexp)(__const char *__ifname);
1632 BEFORE_ORIGINAL_SOCK(if_nametoindex, LIBC);
1634 uret = if_nametoindexp(__ifname);
1636 AFTER_ORIGINAL_LIBC_SOCK(uret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1637 info, "p", voidp_to_uint64(__ifname));
1642 char *if_indextoname(unsigned int __ifindex, char *__ifname) {
1643 static char * (*if_indextonamep)(unsigned int __ifindex, char *__ifname);
1646 BEFORE_ORIGINAL_SOCK(if_indextoname, LIBC);
1648 cret = if_indextonamep(__ifindex, __ifname);
1650 AFTER_ORIGINAL_LIBC_SOCK(cret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1651 info, "dp", __ifindex,
1652 voidp_to_uint64(__ifname));
1657 struct if_nameindex *if_nameindex(void) {
1658 static struct if_nameindex * (*if_nameindexp)(void);
1659 struct if_nameindex * pret;
1661 BEFORE_ORIGINAL_NOFILTER(if_nameindex, LIBC);
1663 pret = if_nameindexp();
1665 AFTER_ORIGINAL_LIBC_SOCK(pret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1671 void if_freenameindex(struct if_nameindex *__ptr) {
1672 static void (*if_freenameindexp)(struct if_nameindex *__ptr);
1674 BEFORE_ORIGINAL_NOFILTER(if_freenameindex, LIBC);
1676 if_freenameindexp(__ptr);
1678 AFTER_ORIGINAL_LIBC_SOCK(NULL, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1679 info, "p", voidp_to_uint64(__ptr));
1682 int getifaddrs(struct ifaddrs **ifap) {
1683 static int (*getifaddrsp)(struct ifaddrs **ifap);
1685 BEFORE_ORIGINAL_NOFILTER(getifaddrs, LIBC);
1687 ret = getifaddrsp(ifap);
1689 AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, 0, SOCKET_API_OTHER,
1690 info, "p", voidp_to_uint64(ifap));
1695 void freeifaddrs(struct ifaddrs *ifa) {
1696 static void (*freeifaddrsp)(struct ifaddrs *ifa);
1698 BEFORE_ORIGINAL_NOFILTER(freeifaddrs, LIBC);
1702 AFTER_ORIGINAL_LIBC_SOCK(NULL, OBJ_DUMMY, 0, SOCKET_API_OTHER, info,
1703 "p", voidp_to_uint64(ifa));
1708 uint16_t htobe16(uint16_t host_16bits)
1710 static uint16_t (*htobe16p)(uint16_t host_16bits);
1713 BEFORE_ORIGINAL_SOCK(htobe16, LIBC);
1715 uret = htobe16p(host_16bits);
1717 AFTER_ORIGINAL_NOSOCK_RET('d', (uint32_t)uret, 0, FD_API_OTHER, "d", host_16bits);
1722 uint16_t htole16(uint16_t host_16bits)
1724 static uint16_t (*htole16p)(uint16_t host_16bits);
1727 BEFORE_ORIGINAL_SOCK(htole16, LIBC);
1729 uret = htole16p(host_16bits);
1731 AFTER_ORIGINAL_NOSOCK_RET('d', (uint32_t)uret, 0, FD_API_OTHER, "d", host_16bits);
1736 uint16_t be16toh(uint16_t big_endian_16bits)
1738 static uint16_t (*be16tohp)(uint16_t big_endian_16bits);
1741 BEFORE_ORIGINAL_SOCK(be16toh, LIBC);
1743 uret = be16tohp(big_endian_16bits);
1745 AFTER_ORIGINAL_NOSOCK_RET('d', (uint32_t)uret, 0, FD_API_OTHER,
1746 "d", big_endian_16bits);
1751 uint16_t le16toh(uint16_t little_endian_16bits)
1753 static uint16_t (*le16tohp)(uint16_t little_endian_16bits);
1756 BEFORE_ORIGINAL_SOCK(le16toh, LIBC);
1758 uret = le16tohp(little_endian_16bits);
1760 AFTER_ORIGINAL_NOSOCK_RET('d', (uint32_t)uret, 0, FD_API_OTHER,
1761 "d", little_endian_16bits);
1766 uint32_t htobe32(uint32_t host_32bits)
1768 static uint32_t (*htobe32p)(uint32_t host_32bits);
1771 BEFORE_ORIGINAL_SOCK(htobe32, LIBC);
1773 uret = htobe32p(host_32bits);
1775 AFTER_ORIGINAL_NOSOCK_RET('d', uret, 0, FD_API_OTHER,
1781 uint32_t htole32(uint32_t host_32bits)
1783 static uint32_t (*htole32p)(uint32_t host_32bits);
1786 BEFORE_ORIGINAL_SOCK(htole32, LIBC);
1788 uret = htole32p(host_32bits);
1790 AFTER_ORIGINAL_NOSOCK_RET('d', uret, 0, FD_API_OTHER,
1796 uint32_t be32toh(uint32_t big_endian_32bits)
1798 static uint32_t (*be32tohp)(uint32_t big_endian_32bits);
1801 BEFORE_ORIGINAL_SOCK(be32toh, LIBC);
1803 uret = be32tohp(big_endian_32bits);
1805 AFTER_ORIGINAL_NOSOCK_RET('d', uret, 0, FD_API_OTHER,
1806 "d", big_endian_32bits);
1811 uint32_t le32toh(uint32_t little_endian_32bits)
1813 static uint32_t (*le32tohp)(uint32_t little_endian_32bits);
1816 BEFORE_ORIGINAL_SOCK(le32toh, LIBC);
1818 uret = le32tohp(little_endian_32bits);
1820 AFTER_ORIGINAL_NOSOCK_RET('d', uret, 0, FD_API_OTHER,
1821 "d", little_endian_32bits);
1826 uint64_t htobe64(uint64_t host_64bits)
1828 static uint64_t (*htobe64p)(uint64_t host_64bits);
1831 BEFORE_ORIGINAL_SOCK(htobe64, LIBC);
1833 uret = htobe64p(host_64bits);
1835 AFTER_ORIGINAL_NOSOCK_RET('x', uret, 0, FD_API_OTHER,
1841 uint64_t htole64(uint64_t host_64bits)
1843 static uint64_t (*htole64p)(uint64_t host_64bits);
1846 BEFORE_ORIGINAL_SOCK(htole64, LIBC);
1848 uret = htole64p(host_64bits);
1850 AFTER_ORIGINAL_NOSOCK_RET('x', uret, 0, FD_API_OTHER,
1856 uint64_t be64toh(uint64_t big_endian_64bits)
1858 static uint64_t (*be64tohp)(uint64_t big_endian_64bits);
1861 BEFORE_ORIGINAL_SOCK(be64toh, LIBC);
1863 uret = be64tohp(big_endian_64bits);
1865 AFTER_ORIGINAL_NOSOCK_RET('x', uret, 0, FD_API_OTHER,
1866 "d", big_endian_64bits);
1871 uint64_t le64toh(uint64_t little_endian_64bits)
1873 static uint64_t (*le64tohp)(uint64_t little_endian_64bits);
1876 BEFORE_ORIGINAL_SOCK(le64toh, LIBC);
1878 uret = le64tohp(little_endian_64bits);
1880 AFTER_ORIGINAL_NOSOCK_RET('x', uret, 0, FD_API_OTHER,
1881 "d", little_endian_64bits);
1886 struct in_addr inet_makeaddr(int net, int host)
1888 static struct in_addr (*inet_makeaddrp)(int net, int host);
1889 struct in_addr iret;
1891 BEFORE_ORIGINAL_SOCK(inet_makeaddr, LIBC);
1893 iret = inet_makeaddrp(net,host);
1895 AFTER_ORIGINAL_NOSOCK_RET('d', iret.s_addr, 0, FD_API_OTHER,