/external/linux-kselftest/tools/testing/selftests/android/ion/ |
D | ipcsocket.c | 14 int opensocket(int *sockfd, const char *name, int connecttype) in opensocket() argument 30 *sockfd = ret; in opensocket() 31 if (setsockopt(*sockfd, SOL_SOCKET, SO_REUSEADDR, in opensocket() 51 ret = bind(*sockfd, (struct sockaddr *)&skaddr, in opensocket() 59 ret = listen(*sockfd, 5); in opensocket() 69 ret = accept(*sockfd, (struct sockaddr *)&skaddr, in opensocket() 78 *sockfd = clientfd; in opensocket() 87 ret = connect(*sockfd, (struct sockaddr *)&skaddr, in opensocket() 99 if (*sockfd) in opensocket() 100 close(*sockfd); in opensocket() [all …]
|
/external/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() 135 int safe_getsockopt(const char *file, const int lineno, int sockfd, int level, in safe_getsockopt() argument 138 int rval = getsockopt(sockfd, level, optname, optval, optlen); in safe_getsockopt() 145 file, lineno, sockfd, level, optname, optval, optlen); in safe_getsockopt() 150 int safe_setsockopt(const char *file, const int lineno, int sockfd, int level, in safe_setsockopt() argument 155 rval = setsockopt(sockfd, level, optname, optval, optlen); in safe_setsockopt() 160 file, lineno, sockfd, level, optname, optval, optlen); in safe_setsockopt() 167 int sockfd, const void *buf, size_t len, int flags) in safe_send() argument 171 rval = send(sockfd, buf, len, flags); in safe_send() [all …]
|
/external/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()
|
/external/iptables/extensions/ |
D | libxt_set.h | 20 int res, sockfd = socket(AF_INET, SOCK_RAW, IPPROTO_RAW); in get_version() local 24 if (sockfd < 0) in get_version() 28 if (fcntl(sockfd, F_SETFD, FD_CLOEXEC) == -1) { in get_version() 35 res = getsockopt(sockfd, SOL_IP, SO_IP_SET, &req_version, &size); in get_version() 42 return sockfd; in get_version() 50 int res, sockfd; in get_set_byid() local 52 sockfd = get_version(&req.version); in get_set_byid() 55 res = getsockopt(sockfd, SOL_IP, SO_IP_SET, &req, &size); in get_set_byid() 56 close(sockfd); in get_set_byid() 76 int sockfd, unsigned int version) in get_set_byname_only() argument [all …]
|
/external/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 …]
|
/external/skqp/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 …]
|
/external/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() 66 curl_socket_t sockfd; in main() local 90 res = curl_easy_getinfo(curl, CURLINFO_ACTIVESOCKET, &sockfd); in main() 110 if(res == CURLE_AGAIN && !wait_on_socket(sockfd, 0, 60000L)) { in main() 136 if(res == CURLE_AGAIN && !wait_on_socket(sockfd, 1, 60000L)) { in main()
|
/external/curl/lib/ |
D | nonblock.c | 47 int curlx_nonblock(curl_socket_t sockfd, /* operate on this */ in curlx_nonblock() argument 51 (void)sockfd; in curlx_nonblock() 59 flags = sfcntl(sockfd, F_GETFL, 0); in curlx_nonblock() 61 return sfcntl(sockfd, F_SETFL, flags | O_NONBLOCK); in curlx_nonblock() 62 return sfcntl(sockfd, F_SETFL, flags & (~O_NONBLOCK)); in curlx_nonblock() 68 return ioctl(sockfd, FIONBIO, &flags); in curlx_nonblock() 74 return ioctlsocket(sockfd, FIONBIO, &flags); in curlx_nonblock() 80 return IoctlSocket(sockfd, FIONBIO, (char *)&flags); in curlx_nonblock() 86 return setsockopt(sockfd, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b)); in curlx_nonblock()
|
D | connect.c | 89 static bool verifyconnect(curl_socket_t sockfd, int *error); 110 curl_socket_t sockfd) in tcpkeepalive() argument 115 if(setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, in tcpkeepalive() 117 infof(data, "Failed to set SO_KEEPALIVE on fd %d\n", sockfd); in tcpkeepalive() 130 if(WSAIoctl(sockfd, SIO_KEEPALIVE_VALS, (LPVOID) &vals, sizeof(vals), in tcpkeepalive() 133 (int)sockfd, WSAGetLastError()); in tcpkeepalive() 139 if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPIDLE, in tcpkeepalive() 141 infof(data, "Failed to set TCP_KEEPIDLE on fd %d\n", sockfd); in tcpkeepalive() 147 if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPINTVL, in tcpkeepalive() 149 infof(data, "Failed to set TCP_KEEPINTVL on fd %d\n", sockfd); in tcpkeepalive() [all …]
|
D | memdebug.c | 345 curl_socket_t sockfd; in curl_dbg_socket() local 350 sockfd = socket(domain, type, protocol); in curl_dbg_socket() 352 if(source && (sockfd != CURL_SOCKET_BAD)) in curl_dbg_socket() 353 curl_dbg_log(fmt, source, line, sockfd); in curl_dbg_socket() 355 return sockfd; in curl_dbg_socket() 358 SEND_TYPE_RETV curl_dbg_send(SEND_TYPE_ARG1 sockfd, in curl_dbg_send() argument 366 rc = send(sockfd, buf, len, flags); in curl_dbg_send() 373 RECV_TYPE_RETV curl_dbg_recv(RECV_TYPE_ARG1 sockfd, RECV_TYPE_ARG2 buf, in curl_dbg_recv() argument 380 rc = recv(sockfd, buf, len, flags); in curl_dbg_recv() 419 curl_socket_t sockfd = accept(s, addr, addrlen); in curl_dbg_accept() local [all …]
|
/external/ltp/include/ |
D | safe_net_fn.h | 31 int tst_getsockport(const char *file, const int lineno, int sockfd); 36 int safe_getsockopt(const char *file, const int lineno, int sockfd, int level, 39 int safe_setsockopt(const char *file, const int lineno, int sockfd, int level, 43 int sockfd, const void *buf, size_t len, int flags); 46 int sockfd, const void *buf, size_t len, int flags, 50 int sockfd, const struct msghdr *msg, int flags); 53 int sockfd, struct msghdr *msg, int flags); 63 int sockfd, const struct sockaddr *addr, socklen_t addrlen); 66 void (cleanup_fn)(void), int sockfd, struct sockaddr *addr,
|
D | tst_safe_net.h | 29 #define TST_GETSOCKPORT(sockfd) \ argument 30 tst_getsockport(__FILE__, __LINE__, sockfd) 47 #define SAFE_SEND(strict, sockfd, buf, len, flags) \ argument 48 safe_send(__FILE__, __LINE__, strict, sockfd, buf, len, flags) 67 #define SAFE_CONNECT(sockfd, addr, addrlen) \ argument 68 safe_connect(__FILE__, __LINE__, NULL, sockfd, addr, addrlen) 70 #define SAFE_GETSOCKNAME(sockfd, addr, addrlen) \ argument 71 safe_getsockname(__FILE__, __LINE__, NULL, sockfd, addr, \
|
/external/compiler-rt/test/msan/Linux/ |
D | sendmsg.cc | 29 int sockfd; variable 37 sockfd = socket(AF_INET, SOCK_DGRAM, 0); in main() 44 bind(sockfd, (struct sockaddr *)&serveraddr, sizeof(serveraddr)); in main() 46 getsockname(sockfd, (struct sockaddr *)&serveraddr, &addrlen); in main() 65 ret = connect(sockfd, (struct sockaddr *)&serveraddr, addrlen); in main() 67 ret = send(sockfd, buf, kBufSize, 0); in main() 72 sendto(sockfd, buf, kBufSize, 0, (struct sockaddr *)&serveraddr, addrlen); in main() 76 ret = sendmsg(sockfd, &msg, 0); in main()
|
/external/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 …]
|
/external/ltp/testcases/cve/ |
D | cve-2017-2671.c | 55 static int sockfd; variable 75 sockfd = SAFE_SOCKET(AF_INET, SOCK_DGRAM, IPPROTO_ICMP); in setup() 85 if (sockfd > 0) in cleanup() 86 SAFE_CLOSE(sockfd); in cleanup() 97 connect(sockfd, (struct sockaddr *)&uaddr, sizeof(uaddr)); in connect_b() 108 SAFE_CONNECT(sockfd, in run() 112 connect(sockfd, (struct sockaddr *)&uaddr, sizeof(uaddr)); in run()
|
/external/compiler-rt/test/asan/TestCases/Linux/ |
D | recvfrom.cc | 27 int sockfd; variable 38 int succeeded = getsockname(sockfd, (struct sockaddr *)&serveraddr, &addrlen); in client_thread_udp() 41 succeeded = sendto(sockfd, buf, kBufSize, 0, (struct sockaddr *)&serveraddr, in client_thread_udp() 58 sockfd = socket(AF_INET, SOCK_DGRAM, 0); in main() 59 CHECK_ERROR(sockfd < 0, "opening socket"); in main() 66 int bound = bind(sockfd, (struct sockaddr *)&serveraddr, sizeof(serveraddr)); in main() 73 recvfrom(sockfd, buf, kBufSize, 0, NULL, NULL); // BOOM in main()
|
/external/wayland/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()
|
/external/ltp/testcases/kernel/syscalls/sendto/ |
D | sendto02.c | 43 static int sockfd; variable 48 sockfd = socket(AF_INET, SOCK_STREAM, IPPROTO_SCTP); in setup() 49 if (sockfd == -1) { in setup() 64 if (sockfd > 0) in cleanup() 65 SAFE_CLOSE(sockfd); in cleanup() 70 TEST(sendto(sockfd, NULL, 1, 0, (struct sockaddr *) &sa, sizeof(sa))); in verify_sendto()
|
/external/iproute2/tc/ |
D | em_ipset.c | 74 int res, sockfd = socket(AF_INET, SOCK_RAW, IPPROTO_RAW); in get_version() local 78 if (sockfd < 0) { in get_version() 84 res = getsockopt(sockfd, SOL_IP, SO_IP_SET, &req_version, &size); in get_version() 87 close(sockfd); in get_version() 92 return sockfd; in get_version() 97 int sockfd, res; in do_getsockopt() local 100 sockfd = get_version(&req->version); in do_getsockopt() 101 if (sockfd < 0) in do_getsockopt() 103 res = getsockopt(sockfd, SOL_IP, SO_IP_SET, req, &size); in do_getsockopt() 106 close(sockfd); in do_getsockopt()
|
/external/toybox/toys/net/ |
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() 137 xioctl(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 …]
|
D | netcat.c | 75 int sockfd = -1, in1 = 0, in2 = 0, out1 = 1, out2 = 1; in netcat_main() local 102 sockfd = xconnect(addr); in netcat_main() 107 in1 = out2 = sockfd; in netcat_main() 116 sockfd = xbind(xgetaddrinfo(TT.s, toybuf, family, type, 0, 0)); in netcat_main() 118 if (listen(sockfd, 5)) error_exit("listen"); in netcat_main() 122 getsockname(sockfd, address, &len); in netcat_main() 139 in1 = out2 = accept(sockfd, (struct sockaddr *)address, &len); in netcat_main() 176 close(sockfd); in netcat_main()
|
/external/honggfuzz/socketfuzzer/ |
D | vulnserver_cov.c | 85 int sockfd, newsockfd, portno, clilen; in main() local 96 sockfd = socket(AF_INET, SOCK_STREAM, 0); in main() 97 if (sockfd < 0) { in main() 103 if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEPORT, (const char *)&reuse, sizeof(reuse)) < 0) in main() 114 if (bind(sockfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) { in main() 119 listen(sockfd, 5); in main() 123 newsockfd = accept(sockfd, (struct sockaddr *)&cli_addr, &clilen); in main()
|
/external/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()
|