Lines Matching refs:sock
42 int sock; in vtest_open_socket() local
44 sock = socket(PF_UNIX, SOCK_STREAM, 0); in vtest_open_socket()
45 if (sock < 0) { in vtest_open_socket()
56 if (bind(sock, (struct sockaddr *)&un, sizeof(un)) < 0) { in vtest_open_socket()
60 if (listen(sock, 1) < 0){ in vtest_open_socket()
64 return sock; in vtest_open_socket()
66 close(sock); in vtest_open_socket()
70 static int wait_for_socket_accept(int sock) in wait_for_socket_accept() argument
76 FD_SET(sock, &read_fds); in wait_for_socket_accept()
78 ret = select(sock + 1, &read_fds, NULL, NULL, NULL); in wait_for_socket_accept()
82 if (FD_ISSET(sock, &read_fds)) { in wait_for_socket_accept()
83 new_fd = accept(sock, NULL, NULL); in wait_for_socket_accept()
157 int ret, sock = -1, in_fd, out_fd; in main() local
201 sock = vtest_open_socket("/tmp/.virgl_test"); in main()
203 in_fd = wait_for_socket_accept(sock); in main()
226 if (sock != -1) in main()
227 close(sock); in main()