Home
last modified time | relevance | path

Searched refs:sockfd (Results 1 – 25 of 107) sorted by relevance

12345

/external/ltp/testcases/kernel/sched/clisrv/
Dpthserv.c51 int sockfd; variable
56 int str_echo(sockfd) in str_echo() argument
57 int sockfd; in str_echo()
62 printf("sockfd = %d\n", sockfd);
66 sockfd));
67 n = readline(sockfd, line, MAXLINE);
78 sockfd));
79 testint = writen(sockfd, line, n);
100 if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { in main()
106 sockfd)); in main()
[all …]
Dpthcli.c62 void str_cli(fp, sockfd) in str_cli() argument
64 register int sockfd;
74 if (writen(sockfd, sendline, n) != n)
81 n = readline(sockfd, recvline, MAXLINE);
101 int sockfd; in main() local
122 if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { in main()
129 sockfd); in main()
131 if (connect(sockfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < in main()
143 str_cli(input, sockfd); /* call the routines that do the work */ in main()
147 str_cli(stdin, sockfd); /* call the routines that do the work */ in main()
[all …]
/external/iptables/extensions/
Dlibxt_set.h20 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/
DSkSockets.cpp30 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 …]
DSkSockets.h109 void closeSocket(int sockfd);
116 virtual void onFailedConnection(int sockfd);
121 void setNonBlocking(int sockfd);
128 void addToMasterSet(int sockfd);
192 virtual void onFailedConnection(int sockfd);
/external/curl/lib/
Dconnect.c87 static bool verifyconnect(curl_socket_t sockfd, int *error);
108 curl_socket_t sockfd) in tcpkeepalive() argument
113 if(setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, in tcpkeepalive()
115 infof(data, "Failed to set SO_KEEPALIVE on fd %d\n", sockfd); in tcpkeepalive()
128 if(WSAIoctl(sockfd, SIO_KEEPALIVE_VALS, (LPVOID) &vals, sizeof(vals), in tcpkeepalive()
131 (int)sockfd, WSAGetLastError()); in tcpkeepalive()
137 if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPIDLE, in tcpkeepalive()
139 infof(data, "Failed to set TCP_KEEPIDLE on fd %d\n", sockfd); in tcpkeepalive()
145 if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPINTVL, in tcpkeepalive()
147 infof(data, "Failed to set TCP_KEEPINTVL on fd %d\n", sockfd); in tcpkeepalive()
[all …]
Dnonblock.c47 int curlx_nonblock(curl_socket_t sockfd, /* operate on this */ in curlx_nonblock() argument
58 flags = sfcntl(sockfd, F_GETFL, 0); in curlx_nonblock()
60 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()
Dmemdebug.c349 curl_socket_t sockfd = socket(domain, type, protocol); in curl_socket() local
351 if(source && (sockfd != CURL_SOCKET_BAD)) in curl_socket()
352 curl_memlog(fmt, source, line, sockfd); in curl_socket()
354 return sockfd; in curl_socket()
389 curl_socket_t sockfd = accept(s, addr, addrlen); in curl_accept() local
391 if(source && (sockfd != CURL_SOCKET_BAD)) in curl_accept()
392 curl_memlog(fmt, source, line, sockfd); in curl_accept()
394 return sockfd; in curl_accept()
398 void curl_mark_sclose(curl_socket_t sockfd, int line, const char *source) in curl_mark_sclose() argument
407 curl_memlog(fmt, source, line, sockfd); in curl_mark_sclose()
[all …]
Dsendf.c127 const curl_socket_t sockfd = conn->sock[num]; in pre_receive_plain() local
138 const int readymask = Curl_socket_check(sockfd, CURL_SOCKET_BAD, in pre_receive_plain()
149 psnd->bindsock = sockfd; /* Used only for DEBUGASSERT */ in pre_receive_plain()
155 DEBUGASSERT(psnd->bindsock == sockfd); in pre_receive_plain()
156 recvedbytes = sread(sockfd, psnd->buffer + psnd->recv_size, in pre_receive_plain()
253 CURLcode Curl_sendf(curl_socket_t sockfd, struct connectdata *conn, in Curl_sendf() argument
275 result = Curl_write(conn, sockfd, sptr, write_len, &bytes_written); in Curl_sendf()
306 curl_socket_t sockfd, in Curl_write() argument
313 int num = (sockfd == conn->sock[SECONDARYSOCKET]); in Curl_write()
341 curl_socket_t sockfd = conn->sock[num]; in Curl_send_plain() local
[all …]
/external/ltp/lib/
Dsafe_net.c100 int safe_setsockopt(const char *file, const int lineno, int sockfd, int level, in safe_setsockopt() argument
105 rval = setsockopt(sockfd, level, optname, optval, optlen); in safe_setsockopt()
110 file, lineno, sockfd, level, optname, optval, optlen); in safe_setsockopt()
117 int sockfd, const void *buf, size_t len, int flags) in safe_send() argument
121 rval = send(sockfd, buf, len, flags); in safe_send()
126 file, lineno, sockfd, buf, len, flags); in safe_send()
133 int sockfd, const void *buf, size_t len, int flags, in safe_sendto() argument
139 rval = sendto(sockfd, buf, len, flags, dest_addr, addrlen); in safe_sendto()
144 file, lineno, sockfd, buf, len, flags, in safe_sendto()
205 int sockfd, const struct sockaddr *addr, socklen_t addrlen) in safe_connect() argument
[all …]
/external/curl/docs/examples/
Dsendrecv.c32 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(sockfd + 1, &infd, &outfd, &errfd, &tv); in wait_on_socket()
65 curl_socket_t sockfd; /* socket */ in main() local
101 sockfd = (curl_socket_t)sockextr; in main()
104 if(!wait_on_socket(sockfd, 0, 60000L)) { in main()
124 wait_on_socket(sockfd, 1, 60000L); in main()
Dexternalsocket.c65 curl_socket_t sockfd; in opensocket() local
68 sockfd = *(curl_socket_t *)clientp; in opensocket()
71 return sockfd; in opensocket()
89 curl_socket_t sockfd; in main() local
110 if((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == CURL_SOCKET_BAD) { in main()
122 if(connect(sockfd, (struct sockaddr *) &servaddr, sizeof(servaddr)) == in main()
124 close(sockfd); in main()
137 curl_easy_setopt(curl, CURLOPT_OPENSOCKETDATA, &sockfd); in main()
/external/compiler-rt/test/msan/Linux/
Dsendmsg.cc29 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/net/
Dnetcat.c90 int sockfd=-1, in1 = 0, in2 = 0, out1 = 1, out2 = 1; in netcat_main() local
108 sockfd = xsocket(AF_INET, SOCK_STREAM, 0); in netcat_main()
109 fcntl(sockfd, F_SETFD, FD_CLOEXEC); in netcat_main()
110 setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &out1, sizeof(out1)); in netcat_main()
116 if (bind(sockfd, (struct sockaddr *)address, sizeof(*address))) in netcat_main()
127 if (connect(sockfd, (struct sockaddr *)address, sizeof(*address))<0) in netcat_main()
129 in1 = out2 = sockfd; in netcat_main()
136 if (listen(sockfd, 5)) error_exit("listen"); in netcat_main()
138 getsockname(sockfd, (struct sockaddr *)address, &len); in netcat_main()
149 in1 = out2 = accept(sockfd, (struct sockaddr *)address, &len); in netcat_main()
[all …]
Difconfig.c56 int sockfd; in GLOBALS() argument
113 if (ioctl(TT.sockfd, SIOCGIFFLAGS, &ifre)<0) perror_exit_raw(name); in display_ifconfig()
118 i = ioctl(TT.sockfd, SIOCGIFHWADDR, &ifre); in display_ifconfig()
137 ioctl(TT.sockfd, SIOCGIFADDR, &ifre); in display_ifconfig()
158 if (addr[i].ioctl && ioctl(TT.sockfd, addr[i].ioctl, &ifre)) in display_ifconfig()
225 if (ioctl(TT.sockfd, SIOCGIFMTU, &ifre) < 0) ifre.ifr_mtu = 0; in display_ifconfig()
227 if (ioctl(TT.sockfd, SIOCGIFMETRIC, &ifre) < 0) ifre.ifr_metric = 0; in display_ifconfig()
242 if (ioctl(TT.sockfd, SIOCGIFTXQLEN, &ifre) >= 0) val[16] = ifre.ifr_qlen; in display_ifconfig()
254 if(!ioctl(TT.sockfd, SIOCGIFMAP, &ifre) && (ifre.ifr_map.irq || in display_ifconfig()
320 xioctl(TT.sockfd, SIOCGIFCONF, &ifcon); in show_iface()
[all …]
/external/compiler-rt/test/asan/TestCases/Linux/
Drecvfrom.cc27 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/toybox/toys/pending/
Dbrctl.c39 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/kernel/syscalls/sendto/
Dsendto02.c43 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/ltp/testcases/kernel/syscalls/getpeername/
Dgetpeername01.c53 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 if (bind(test_cases[i].sockfd, (struct sockaddr *)&server_addr, in setup3()
169 test_cases[i].sockfd = sv[0]; in setup4()
174 SAFE_CLOSE(cleanup, test_cases[i].sockfd); in cleanup2()
/external/ltp/include/
Dtst_safe_net.h35 #define SAFE_SEND(strict, sockfd, buf, len, flags) \ argument
36 safe_send(__FILE__, __LINE__, strict, sockfd, buf, len, flags)
49 #define SAFE_CONNECT(sockfd, addr, addrlen) \ argument
50 safe_connect(__FILE__, __LINE__, NULL, sockfd, addr, addrlen)
52 #define SAFE_GETSOCKNAME(sockfd, addr, addrlen) \ argument
53 safe_getsockname(__FILE__, __LINE__, NULL, sockfd, addr, \
Dsafe_net_fn.h34 int safe_setsockopt(const char *file, const int lineno, int sockfd, int level,
38 int sockfd, const void *buf, size_t len, int flags);
41 int sockfd, const void *buf, size_t len, int flags,
52 int sockfd, const struct sockaddr *addr, socklen_t addrlen);
55 void (cleanup_fn)(void), int sockfd, struct sockaddr *addr,
/external/ppp/pppd/plugins/radius/
Dsendserver.c194 int sockfd; in rc_send_server() local
235 sockfd = socket (AF_INET, SOCK_DGRAM, 0); in rc_send_server()
236 if (sockfd < 0) in rc_send_server()
249 if (bind (sockfd, (struct sockaddr *) sin, length) < 0 || in rc_send_server()
250 getsockname (sockfd, (struct sockaddr *) sin, &length) < 0) in rc_send_server()
252 close (sockfd); in rc_send_server()
296 sendto (sockfd, (char *) auth, (unsigned int) total_length, (int) 0, in rc_send_server()
302 FD_SET (sockfd, &readfds); in rc_send_server()
303 if (select (sockfd + 1, &readfds, NULL, NULL, &authtime) < 0) in rc_send_server()
309 close (sockfd); in rc_send_server()
[all …]
/external/ltp/testcases/kernel/syscalls/sendfile/
Dsendfile06.c51 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 if (getsockname(sockfd, (struct sockaddr *)&sin1, &slen) == -1) in create_server()
Dsendfile05.c66 static int sockfd, s; variable
111 shutdown(sockfd, SHUT_RDWR); in do_sendfile()
128 recvfrom(sockfd, rbuf, 4096, 0, (struct sockaddr *)&sin1, in do_child()
179 sockfd = socket(PF_INET, SOCK_DGRAM, 0); in create_server()
180 if (sockfd < 0) { in create_server()
189 if (bind(sockfd, (struct sockaddr *)&sin1, sizeof(sin1)) < 0) { in create_server()
194 if (getsockname(sockfd, (struct sockaddr *)&sin1, &slen) == -1) in create_server()
/external/iproute2/tc/
Dem_ipset.c74 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()
91 return sockfd; in get_version()
96 int sockfd, res; in do_getsockopt() local
98 sockfd = get_version(&req->version); in do_getsockopt()
99 if (sockfd < 0) in do_getsockopt()
101 res = getsockopt(sockfd, SOL_IP, SO_IP_SET, req, &size); in do_getsockopt()
104 close(sockfd); in do_getsockopt()

12345