Home
last modified time | relevance | path

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

12345678910

/external/linux-kselftest/tools/testing/selftests/android/ion/
Dipcsocket.c14 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/
Dsafe_net.c84 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 …]
/external/ltp/testcases/kernel/sched/clisrv/
Dpthserv.c51 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 …]
Dpthcli.c63 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/curl/docs/examples/
Dexternalsocket.c72 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 …]
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((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()
/external/iptables/extensions/
Dlibxt_set.h14 int res, sockfd = socket(AF_INET, SOCK_RAW, IPPROTO_RAW); in get_version() local
18 if (sockfd < 0) in get_version()
22 if (fcntl(sockfd, F_SETFD, FD_CLOEXEC) == -1) { in get_version()
29 res = getsockopt(sockfd, SOL_IP, SO_IP_SET, &req_version, &size); in get_version()
36 return sockfd; in get_version()
44 int res, sockfd; in get_set_byid() local
46 sockfd = get_version(&req.version); in get_set_byid()
49 res = getsockopt(sockfd, SOL_IP, SO_IP_SET, &req, &size); in get_set_byid()
50 close(sockfd); in get_set_byid()
70 int sockfd, unsigned int version) in get_set_byname_only() argument
[all …]
/external/toybox/toys/net/
Dnetcat.c78 int sockfd; in usock() local
88 sockfd = xsocket(AF_UNIX, type, 0); in usock()
89 (out?xconnect:xbind)(sockfd, (struct sockaddr*)&sockaddr, sizeof(sockaddr)); in usock()
91 return sockfd; in usock()
97 int sockfd = -1, in1 = 0, in2 = 0, out1 = 1, out2 = 1, family = AF_UNSPEC, in netcat_main() local
121 if (FLAG(U)) sockfd = usock(toys.optargs[0], type, 1); in netcat_main()
122 else sockfd = xconnectany(xgetaddrinfo(toys.optargs[0], toys.optargs[1], in netcat_main()
127 in1 = out2 = sockfd; in netcat_main()
133 sockfd = usock(TT.s, type, 0); in netcat_main()
136 sockfd = xbindany(xgetaddrinfo(TT.s, toybuf, family, type, 0, 0)); in netcat_main()
[all …]
/external/curl/lib/
Dnonblock.c47 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()
Dconnect.c86 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\n", 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\n", sockfd); in tcpkeepalive()
144 if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPINTVL, in tcpkeepalive()
146 infof(data, "Failed to set TCP_KEEPINTVL on fd %d\n", sockfd); in tcpkeepalive()
[all …]
Dmemdebug.c293 curl_socket_t sockfd; in curl_dbg_socket() local
298 sockfd = socket(domain, type, protocol); in curl_dbg_socket()
300 if(source && (sockfd != CURL_SOCKET_BAD)) in curl_dbg_socket()
301 curl_dbg_log(fmt, source, line, sockfd); in curl_dbg_socket()
303 return sockfd; in curl_dbg_socket()
306 SEND_TYPE_RETV curl_dbg_send(SEND_TYPE_ARG1 sockfd, in curl_dbg_send() argument
314 rc = send(sockfd, buf, len, flags); in curl_dbg_send()
321 RECV_TYPE_RETV curl_dbg_recv(RECV_TYPE_ARG1 sockfd, RECV_TYPE_ARG2 buf, in curl_dbg_recv() argument
328 rc = recv(sockfd, buf, len, flags); in curl_dbg_recv()
367 curl_socket_t sockfd = accept(s, addr, addrlen); in curl_dbg_accept() local
[all …]
/external/skqp/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 …]
/external/ltp/include/
Dsafe_net_fn.h34 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);
Dtst_safe_net.h47 #define SAFE_SEND(strict, sockfd, buf, len, flags) \ argument
48 safe_send(__FILE__, __LINE__, strict, sockfd, buf, len, flags)
67 #define SAFE_ACCEPT(sockfd, addr, addrlen) \ argument
68 safe_accept(__FILE__, __LINE__, NULL, sockfd, addr, addrlen)
70 #define SAFE_CONNECT(sockfd, addr, addrlen) \ argument
71 safe_connect(__FILE__, __LINE__, NULL, sockfd, addr, addrlen)
73 #define SAFE_GETSOCKNAME(sockfd, addr, addrlen) \ argument
74 safe_getsockname(__FILE__, __LINE__, NULL, sockfd, addr, \
80 #define TST_GETSOCKPORT(sockfd) \ argument
81 tst_getsockport(__FILE__, __LINE__, sockfd)
/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/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/llvm-project/compiler-rt/test/asan/TestCases/Linux/
Drecvfrom.cpp27 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/ltp/testcases/kernel/syscalls/setsockopt/
Dsetsockopt04.c25 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()
/external/ltp/testcases/kernel/syscalls/sendmmsg/
Dsendmmsg_var.h11 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()
/external/ltp/testcases/cve/
Dcve-2017-2671.c43 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()
/external/llvm-project/compiler-rt/test/msan/Linux/
Dsendmsg.cpp33 int sockfd[2]; variable
41 ret = socketpair(AF_LOCAL, SOCK_DGRAM, 0, sockfd); in main()
77 sent = send(sockfd[0], buf, kBufSize, 0); in main()
81 ret = recv(sockfd[1], rbuf, kRecvBufSize, 0); in main()
85 sent = sendto(sockfd[0], buf, kBufSize, 0, nullptr, 0); in main()
91 ret = recvfrom(sockfd[1], rbuf, kRecvBufSize, 0, (struct sockaddr *)&ss, in main()
97 sent = sendmsg(sockfd[0], &msg, 0); in main()
111 ret = recvmsg(sockfd[1], &rmsg, 0); in main()
115 sent = sendmmsg(sockfd[0], mmsg, 2, 0); in main()
145 ret = recvmmsg(sockfd[1], rmmsg, 2, 0, nullptr); 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.c33 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()
/external/wayland/src/
Dwayland-os.c91 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/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()
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()

12345678910