/third_party/ltp/lib/ |
D | safe_net.c | 84 int tst_getsockport(const char *file, const int lineno, int sockfd) in tst_getsockport() argument 90 safe_getsockname(file, lineno, NULL, sockfd, sa, &addrlen); in tst_getsockport() 161 int safe_getsockopt(const char *file, const int lineno, int sockfd, int level, in safe_getsockopt() argument 164 int rval = getsockopt(sockfd, level, optname, optval, optlen); in safe_getsockopt() 171 file, lineno, sockfd, level, optname, optval, optlen); in safe_getsockopt() 176 int safe_setsockopt(const char *file, const int lineno, int sockfd, int level, in safe_setsockopt() argument 181 rval = setsockopt(sockfd, level, optname, optval, optlen); in safe_setsockopt() 186 file, lineno, sockfd, level, optname, optval, optlen); in safe_setsockopt() 193 int sockfd, const void *buf, size_t len, int flags) in safe_send() argument 197 rval = send(sockfd, buf, len, flags); in safe_send() [all …]
|
/third_party/ltp/testcases/kernel/sched/clisrv/ |
D | pthserv.c | 51 int sockfd; variable 56 int str_echo(int sockfd) in str_echo() argument 61 printf("sockfd = %d\n", sockfd); in str_echo() 65 sockfd)); in str_echo() 66 n = readline(sockfd, line, MAXLINE); in str_echo() 77 sockfd)); in str_echo() 78 testint = writen(sockfd, line, n); in str_echo() 100 if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { in main() 106 sockfd)); in main() 120 if (bind(sockfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) { in main() [all …]
|
D | pthcli.c | 63 void str_cli(FILE *fp, int sockfd) in str_cli() argument 73 if (writen(sockfd, sendline, n) != n) in str_cli() 80 n = readline(sockfd, recvline, MAXLINE); in str_cli() 100 int sockfd; in main() local 121 if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { in main() 128 sockfd); in main() 130 if (connect(sockfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < in main() 142 str_cli(input, sockfd); /* call the routines that do the work */ in main() 146 str_cli(stdin, sockfd); /* call the routines that do the work */ in main() 149 close(sockfd); in main()
|
/third_party/curl/docs/examples/ |
D | externalsocket.c | 72 curl_socket_t sockfd; in opensocket() local 75 sockfd = *(curl_socket_t *)clientp; in opensocket() 78 return sockfd; in opensocket() 96 curl_socket_t sockfd; in main() local 116 sockfd = socket(AF_INET, SOCK_STREAM, 0); in main() 117 if(sockfd == CURL_SOCKET_BAD) { in main() 128 close(sockfd); in main() 132 if(connect(sockfd, (struct sockaddr *) &servaddr, sizeof(servaddr)) == in main() 134 close(sockfd); in main() 147 curl_easy_setopt(curl, CURLOPT_OPENSOCKETDATA, &sockfd); in main() [all …]
|
D | sendrecv.c | 32 static int wait_on_socket(curl_socket_t sockfd, int for_recv, long timeout_ms) in wait_on_socket() argument 45 FD_SET(sockfd, &errfd); /* always check for error */ in wait_on_socket() 48 FD_SET(sockfd, &infd); in wait_on_socket() 51 FD_SET(sockfd, &outfd); in wait_on_socket() 55 res = select((int)sockfd + 1, &infd, &outfd, &errfd, &tv); in wait_on_socket() 77 curl_socket_t sockfd; in main() local 91 res = curl_easy_getinfo(curl, CURLINFO_ACTIVESOCKET, &sockfd); in main() 111 if(res == CURLE_AGAIN && !wait_on_socket(sockfd, 0, 60000L)) { in main() 137 if(res == CURLE_AGAIN && !wait_on_socket(sockfd, 1, 60000L)) { in main()
|
/third_party/flutter/skia/experimental/Networking/ |
D | SkSockets.cpp | 30 int sockfd = socket(AF_INET, SOCK_STREAM, 0); in createSocket() local 31 if (sockfd < 0) { in createSocket() 37 if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(int)) < 0) { in createSocket() 42 this->setNonBlocking(sockfd); in createSocket() 46 return sockfd; in createSocket() 49 void SkSocket::closeSocket(int sockfd) { in closeSocket() argument 53 close(sockfd); in closeSocket() 56 if (FD_ISSET(sockfd, &fMasterSet)) { in closeSocket() 57 FD_CLR(sockfd, &fMasterSet); in closeSocket() 58 if (sockfd >= fMaxfd) { in closeSocket() [all …]
|
/third_party/toybox/toys/net/ |
D | netcat.c | 77 int sockfd; in usock() local 87 sockfd = xsocket(AF_UNIX, type, 0); in usock() 88 (out?xconnect:xbind)(sockfd, (struct sockaddr*)&sockaddr, sizeof(sockaddr)); in usock() 90 return sockfd; in usock() 96 int sockfd = -1, in1 = 0, in2 = 0, out1 = 1, out2 = 1, family = AF_UNSPEC, in netcat_main() local 119 if (FLAG(U)) sockfd = usock(toys.optargs[0], type, 1); in netcat_main() 120 else sockfd = xconnectany(xgetaddrinfo(toys.optargs[0], toys.optargs[1], in netcat_main() 125 in1 = out2 = sockfd; in netcat_main() 131 sockfd = usock(TT.s, type, 0); in netcat_main() 134 sockfd = xbindany(xgetaddrinfo(TT.s, toybuf, family, type, 0, 0)); in netcat_main() [all …]
|
D | ifconfig.c | 61 int sockfd; in GLOBALS() argument 119 if (ioctl(TT.sockfd, SIOCGIFFLAGS, &ifre)<0) perror_exit_raw(name); in display_ifconfig() 127 ioctl(TT.sockfd, SIOCGIFADDR, &ifre); in display_ifconfig() 129 if (!ioctl(TT.sockfd, SIOCGIFNETMASK, &ifre)) in display_ifconfig() 138 ioctl(TT.sockfd, SIOCGIFHWADDR, &ifre); in display_ifconfig() 160 ioctl(TT.sockfd, SIOCGIFADDR, &ifre); in display_ifconfig() 182 if (addr[i].ioctl && ioctl(TT.sockfd, addr[i].ioctl, &ifre)) in display_ifconfig() 255 if (ioctl(TT.sockfd, SIOCGIFMTU, &ifre) < 0) ifre.ifr_mtu = 0; in display_ifconfig() 257 if (ioctl(TT.sockfd, SIOCGIFMETRIC, &ifre) < 0) ifre.ifr_metric = 0; in display_ifconfig() 272 if (ioctl(TT.sockfd, SIOCGIFTXQLEN, &ifre) >= 0) val[16] = ifre.ifr_qlen; in display_ifconfig() [all …]
|
/third_party/curl/lib/ |
D | nonblock.c | 47 int curlx_nonblock(curl_socket_t sockfd, /* operate on this */ in curlx_nonblock() argument 53 flags = sfcntl(sockfd, F_GETFL, 0); in curlx_nonblock() 55 return sfcntl(sockfd, F_SETFL, flags | O_NONBLOCK); in curlx_nonblock() 56 return sfcntl(sockfd, F_SETFL, flags & (~O_NONBLOCK)); in curlx_nonblock() 62 return ioctl(sockfd, FIONBIO, &flags); in curlx_nonblock() 68 return ioctlsocket(sockfd, FIONBIO, &flags); in curlx_nonblock() 74 return IoctlSocket(sockfd, FIONBIO, (char *)&flags); in curlx_nonblock() 80 return setsockopt(sockfd, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b)); in curlx_nonblock()
|
D | connect.c | 86 static bool verifyconnect(curl_socket_t sockfd, int *error); 107 curl_socket_t sockfd) in tcpkeepalive() argument 112 if(setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, in tcpkeepalive() 114 infof(data, "Failed to set SO_KEEPALIVE on fd %d", sockfd); in tcpkeepalive() 127 if(WSAIoctl(sockfd, SIO_KEEPALIVE_VALS, (LPVOID) &vals, sizeof(vals), in tcpkeepalive() 130 (int)sockfd, WSAGetLastError()); in tcpkeepalive() 136 if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPIDLE, in tcpkeepalive() 138 infof(data, "Failed to set TCP_KEEPIDLE on fd %d", sockfd); in tcpkeepalive() 144 if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPINTVL, in tcpkeepalive() 146 infof(data, "Failed to set TCP_KEEPINTVL on fd %d", sockfd); in tcpkeepalive() [all …]
|
D | memdebug.c | 308 curl_socket_t sockfd; in curl_dbg_socket() local 313 sockfd = socket(domain, type, protocol); in curl_dbg_socket() 315 if(source && (sockfd != CURL_SOCKET_BAD)) in curl_dbg_socket() 316 curl_dbg_log(fmt, source, line, sockfd); in curl_dbg_socket() 318 return sockfd; in curl_dbg_socket() 321 SEND_TYPE_RETV curl_dbg_send(SEND_TYPE_ARG1 sockfd, in curl_dbg_send() argument 329 rc = send(sockfd, buf, len, flags); in curl_dbg_send() 336 RECV_TYPE_RETV curl_dbg_recv(RECV_TYPE_ARG1 sockfd, RECV_TYPE_ARG2 buf, in curl_dbg_recv() argument 343 rc = recv(sockfd, buf, len, flags); in curl_dbg_recv() 382 curl_socket_t sockfd = accept(s, addr, addrlen); in curl_dbg_accept() local [all …]
|
/third_party/ltp/include/ |
D | safe_net_fn.h | 34 int safe_getsockopt(const char *file, const int lineno, int sockfd, int level, 37 int safe_setsockopt(const char *file, const int lineno, int sockfd, int level, 41 int sockfd, const void *buf, size_t len, int flags); 44 int sockfd, const void *buf, size_t len, int flags, 48 int sockfd, const struct msghdr *msg, int flags); 51 int sockfd, struct msghdr *msg, int flags); 61 int sockfd, struct sockaddr *addr, socklen_t *addrlen); 64 int sockfd, const struct sockaddr *addr, socklen_t addrlen); 67 void (cleanup_fn)(void), int sockfd, struct sockaddr *addr, 73 int tst_getsockport(const char *file, const int lineno, int sockfd);
|
D | tst_safe_net.h | 35 #define SAFE_SEND(strict, sockfd, buf, len, flags) \ argument 36 safe_send(__FILE__, __LINE__, strict, sockfd, buf, len, flags) 55 #define SAFE_ACCEPT(sockfd, addr, addrlen) \ argument 56 safe_accept(__FILE__, __LINE__, NULL, sockfd, addr, addrlen) 58 #define SAFE_CONNECT(sockfd, addr, addrlen) \ argument 59 safe_connect(__FILE__, __LINE__, NULL, sockfd, addr, addrlen) 61 #define SAFE_GETSOCKNAME(sockfd, addr, addrlen) \ argument 62 safe_getsockname(__FILE__, __LINE__, NULL, sockfd, addr, \ 68 #define TST_GETSOCKPORT(sockfd) \ argument 69 tst_getsockport(__FILE__, __LINE__, sockfd)
|
/third_party/ltp/testcases/kernel/syscalls/sendmmsg/ |
D | sendmmsg_var.h | 11 static int do_sendmmsg(int sockfd, struct mmsghdr *msgvec, unsigned int vlen, in do_sendmmsg() argument 16 return tst_syscall(__NR_sendmmsg, sockfd, msgvec, vlen, flags); in do_sendmmsg() 19 return sendmmsg(sockfd, msgvec, vlen, flags); in do_sendmmsg() 28 static int do_recvmmsg(int sockfd, struct mmsghdr *msgvec, unsigned int vlen, in do_recvmmsg() argument 33 return tst_syscall(__NR_recvmmsg, sockfd, msgvec, vlen, flags, in do_recvmmsg() 37 return recvmmsg(sockfd, msgvec, vlen, flags, timeout); in do_recvmmsg()
|
/third_party/ltp/testcases/kernel/syscalls/setsockopt/ |
D | setsockopt04.c | 25 static int sockfd; variable 36 SAFE_SETSOCKOPT(sockfd, SOL_SOCKET, SO_SNDBUFFORCE, &sndbuf, optlen); in run() 37 SAFE_GETSOCKOPT(sockfd, SOL_SOCKET, SO_SNDBUF, &rec_sndbuf, &optlen); in run() 50 sockfd = SAFE_SOCKET(AF_INET, SOCK_DGRAM, 0); in setup() 55 if (sockfd > 0) in cleanup() 56 SAFE_CLOSE(sockfd); in cleanup()
|
/third_party/ltp/testcases/cve/ |
D | cve-2017-2671.c | 43 static int sockfd; variable 63 sockfd = SAFE_SOCKET(AF_INET, SOCK_DGRAM, IPPROTO_ICMP); in setup() 73 if (sockfd > 0) in cleanup() 74 SAFE_CLOSE(sockfd); in cleanup() 85 connect(sockfd, (struct sockaddr *)&uaddr, sizeof(uaddr)); in connect_b() 96 SAFE_CONNECT(sockfd, in run() 100 connect(sockfd, (struct sockaddr *)&uaddr, sizeof(uaddr)); in run()
|
/third_party/ltp/testcases/kernel/syscalls/sendto/ |
D | sendto02.c | 33 static int sockfd; variable 38 sockfd = socket(AF_INET, SOCK_STREAM, IPPROTO_SCTP); in setup() 39 if (sockfd == -1) { in setup() 54 if (sockfd > 0) in cleanup() 55 SAFE_CLOSE(sockfd); in cleanup() 60 TEST(sendto(sockfd, NULL, 1, 0, (struct sockaddr *) &sa, sizeof(sa))); in verify_sendto()
|
/third_party/ltp/testcases/kernel/syscalls/sendmsg/ |
D | sendmsg03.c | 30 static int sockfd = -1; variable 45 sockfd = SAFE_SOCKET(AF_INET, SOCK_RAW, IPPROTO_ICMP); in setup() 65 if (sockfd > 0) in cleanup() 66 SAFE_CLOSE(sockfd); in cleanup() 76 setsockopt(sockfd, SOL_IP, IP_HDRINCL, &val, sizeof(val)); in thread_run() 90 SAFE_SETSOCKOPT_INT(sockfd, SOL_IP, IP_HDRINCL, hdrincl); in run() 93 sendmsg(sockfd, &msg, 0); in run()
|
/third_party/toybox/toys/pending/ |
D | brctl.c | 39 int sockfd; in GLOBALS() argument 54 xioctl(TT.sockfd, SIOCDEVPRIVATE, &ifr); 68 if (ioctl(TT.sockfd, SIOCDEVPRIVATE, &ifr) < 0) { in get_br_info() 82 num = ioctl(TT.sockfd, SIOCGIFBR, args); //ret is num of bridges found in br_show() 119 xioctl(TT.sockfd, SIOCBRADDBR, argv[0]); in br_addbr() 122 xioctl(TT.sockfd, SIOCSIFBR, args); in br_addbr() 132 xioctl(TT.sockfd, SIOCBRDELBR, argv[0]); in br_delbr() 135 xioctl(TT.sockfd, SIOCSIFBR, args); in br_delbr() 148 xioctl(TT.sockfd, SIOCBRADDIF, &ifr); in br_addif() 153 xioctl(TT.sockfd, SIOCDEVPRIVATE, &ifr); in br_addif() [all …]
|
/third_party/wayland_standard/src/ |
D | wayland-os.c | 91 recvmsg_cloexec_fallback(int sockfd, struct msghdr *msg, int flags) in recvmsg_cloexec_fallback() argument 99 len = recvmsg(sockfd, msg, flags); in recvmsg_cloexec_fallback() 122 wl_os_recvmsg_cloexec(int sockfd, struct msghdr *msg, int flags) in wl_os_recvmsg_cloexec() argument 126 len = recvmsg(sockfd, msg, flags | MSG_CMSG_CLOEXEC); in wl_os_recvmsg_cloexec() 132 return recvmsg_cloexec_fallback(sockfd, msg, flags); in wl_os_recvmsg_cloexec() 153 wl_os_accept_cloexec(int sockfd, struct sockaddr *addr, socklen_t *addrlen) in wl_os_accept_cloexec() argument 158 fd = accept4(sockfd, addr, addrlen, SOCK_CLOEXEC); in wl_os_accept_cloexec() 165 fd = accept(sockfd, addr, addrlen); in wl_os_accept_cloexec()
|
/third_party/libwebsockets/lib/plat/unix/ |
D | unix-fds.c | 44 if (*p && (*p)->desc.sockfd == fd) in wsi_from_fd() 58 assert(context->lws_lookup[wsi->desc.sockfd - in insert_wsi() 61 context->lws_lookup[wsi->desc.sockfd - \ in insert_wsi() 84 while (p != done && (!*p || (*p)->desc.sockfd != wsi->desc.sockfd)) in insert_wsi() 89 __func__, *p, wsi->desc.sockfd); in insert_wsi() 129 while (p != done && (!*p || (*p)->desc.sockfd != fd)) in delete_from_fd() 139 while (p != done && (!*p || (*p)->desc.sockfd != fd)) in delete_from_fd()
|
/third_party/ltp/testcases/kernel/syscalls/getpeername/ |
D | getpeername01.c | 53 int sockfd; member 101 TEST(getpeername(test_cases[i].sockfd, in main() 146 test_cases[i].sockfd = SAFE_OPEN(cleanup, "/dev/null", O_WRONLY, 0666); in setup2() 151 test_cases[i].sockfd = socket(PF_INET, SOCK_STREAM, 0); in setup3() 152 if (test_cases[i].sockfd < 0) { in setup3() 156 SAFE_BIND(cleanup, test_cases[i].sockfd, in setup3() 166 test_cases[i].sockfd = sv[0]; in setup4() 171 SAFE_CLOSE(cleanup, test_cases[i].sockfd); in cleanup2()
|
/third_party/ltp/testcases/kernel/syscalls/sendfile/ |
D | sendfile06.c | 51 static int sockfd; variable 83 shutdown(sockfd, SHUT_RDWR); in do_sendfile() 105 SAFE_CLOSE(cleanup, sockfd); in do_sendfile() 115 ret = recvfrom(sockfd, rbuf, 4096, 0, (struct sockaddr *)&sin1, in do_child() 157 sockfd = socket(PF_INET, SOCK_DGRAM, 0); in create_server() 158 if (sockfd < 0) { in create_server() 167 if (bind(sockfd, (struct sockaddr *)&sin1, sizeof(sin1)) < 0) { in create_server() 172 SAFE_GETSOCKNAME(cleanup, sockfd, (struct sockaddr *)&sin1, &slen); in create_server()
|
/third_party/libwebsockets/lib/core-net/ |
D | adopt.c | 100 new_wsi->desc.sockfd = LWS_SOCK_INVALID; in lws_create_new_server_wsi() 207 if (lws_plat_set_nonblocking(fd.sockfd)) { in lws_adopt_descriptor_vhost2() 209 __func__, fd.sockfd); in lws_adopt_descriptor_vhost2() 263 if (lws_server_socket_service_ssl(new_wsi, fd.sockfd)) { in lws_adopt_descriptor_vhost2() 337 peer = lws_get_or_create_peer(info->vh, info->fd.sockfd); in lws_adopt_descriptor_vhost_via_info() 346 compatible_close(info->fd.sockfd); in lws_adopt_descriptor_vhost_via_info() 357 compatible_close(info->fd.sockfd); in lws_adopt_descriptor_vhost_via_info() 362 lws_get_peer_simple_fd(info->fd.sockfd, new_wsi->simple_ip, in lws_adopt_descriptor_vhost_via_info() 379 fd.sockfd = accept_fd; in lws_adopt_socket_vhost() 500 sock.sockfd = socket(wsi->dns_results_next->ai_family, in lws_create_adopt_udp2() [all …]
|
/third_party/toybox/porting/liteos_a/toys/net/ |
D | ifconfig.c | 60 int sockfd; in GLOBALS() argument 118 if (ioctl(TT.sockfd, SIOCGIFFLAGS, &ifre)<0) perror_exit_raw(name); in display_ifconfig() 126 ioctl(TT.sockfd, SIOCGIFADDR, &ifre); in display_ifconfig() 128 if (!ioctl(TT.sockfd, SIOCGIFNETMASK, &ifre)) in display_ifconfig() 137 ioctl(TT.sockfd, SIOCGIFHWADDR, &ifre); in display_ifconfig() 159 ioctl(TT.sockfd, SIOCGIFADDR, &ifre); in display_ifconfig() 181 if (addr[i].ioctl && ioctl(TT.sockfd, addr[i].ioctl, &ifre)) in display_ifconfig() 254 if (ioctl(TT.sockfd, SIOCGIFMTU, &ifre) < 0) ifre.ifr_mtu = 0; in display_ifconfig() 256 if (ioctl(TT.sockfd, SIOCGIFMETRIC, &ifre) < 0) ifre.ifr_metric = 0; in display_ifconfig() 271 if (ioctl(TT.sockfd, SIOCGIFTXQLEN, &ifre) >= 0) val[16] = ifre.ifr_qlen; in display_ifconfig() [all …]
|