Lines Matching refs:sock
239 int sock,rc; in inet_connect_opts() local
281 sock = qemu_socket(e->ai_family, e->ai_socktype, e->ai_protocol); in inet_connect_opts()
282 if (sock < 0) { in inet_connect_opts()
287 setsockopt(sock,SOL_SOCKET,SO_REUSEADDR,(void*)&on,sizeof(on)); in inet_connect_opts()
290 if (connect(sock,e->ai_addr,e->ai_addrlen) < 0) { in inet_connect_opts()
295 closesocket(sock); in inet_connect_opts()
303 return sock; in inet_connect_opts()
316 int sock = -1, rc; in inet_dgram_opts() local
374 sock = qemu_socket(peer->ai_family, peer->ai_socktype, peer->ai_protocol); in inet_dgram_opts()
375 if (sock < 0) { in inet_dgram_opts()
380 setsockopt(sock,SOL_SOCKET,SO_REUSEADDR,(void*)&on,sizeof(on)); in inet_dgram_opts()
389 if (bind(sock, local->ai_addr, local->ai_addrlen) < 0) { in inet_dgram_opts()
402 if (connect(sock,peer->ai_addr,peer->ai_addrlen) < 0) { in inet_dgram_opts()
411 return sock; in inet_dgram_opts()
414 if (-1 != sock) in inet_dgram_opts()
415 closesocket(sock); in inet_dgram_opts()
503 int sock = -1; in inet_listen() local
507 sock = inet_listen_opts(opts, port_offset); in inet_listen()
508 if (sock != -1 && ostr) { in inet_listen()
524 return sock; in inet_listen()
530 int sock = -1; in inet_connect() local
534 sock = inet_connect_opts(opts); in inet_connect()
536 return sock; in inet_connect()
545 int sock, fd; in unix_listen_opts() local
547 sock = qemu_socket(PF_UNIX, SOCK_STREAM, 0); in unix_listen_opts()
548 if (sock < 0) { in unix_listen_opts()
573 if (bind(sock, (struct sockaddr*) &un, sizeof(un)) < 0) { in unix_listen_opts()
577 if (listen(sock, 1) < 0) { in unix_listen_opts()
584 return sock; in unix_listen_opts()
587 closesocket(sock); in unix_listen_opts()
595 int sock; in unix_connect_opts() local
602 sock = qemu_socket(PF_UNIX, SOCK_STREAM, 0); in unix_connect_opts()
603 if (sock < 0) { in unix_connect_opts()
611 if (connect(sock, (struct sockaddr*) &un, sizeof(un)) < 0) { in unix_connect_opts()
618 return sock; in unix_connect_opts()
626 int sock, len; in unix_listen() local
643 sock = unix_listen_opts(opts); in unix_listen()
645 if (sock != -1 && ostr) in unix_listen()
648 return sock; in unix_listen()
654 int sock; in unix_connect() local
658 sock = unix_connect_opts(opts); in unix_connect()
660 return sock; in unix_connect()