/freebsd/tools/regression/sockets/listen_backlog/ |
H A D | listen_backlog.c | 67 socket_get_backlog(int sock, int *backlogp, const char *testclass, in socket_get_backlog() argument 74 if (getsockopt(sock, SOL_SOCKET, SO_LISTENQLIMIT, &i, &len) < 0) { in socket_get_backlog() 103 int backlog_retrieved, sock; in socket_listen() local 105 sock = socket(domain, type, protocol); in socket_listen() 106 if (sock < 0) { in socket_listen() 109 close(sock); in socket_listen() 113 if (socket_get_backlog(sock, &backlog_retrieved, testclass, test, in socket_listen() 115 close(sock); in socket_listen() 123 close(sock); in socket_listen() 127 if (listen(sock, backlog) < 0) { in socket_listen() [all …]
|
/freebsd/tools/regression/netinet/ipsockopt/ |
H A D | ipsockopt.c | 75 int sock; in get_socket_priv() local 84 sock = socket(PF_INET, type, 0); in get_socket_priv() 89 return (sock); in get_socket_priv() 112 test_ip_options(int sock, const char *socktypename) in test_ip_options() argument 122 if (getsockopt(sock, IPPROTO_IP, IP_OPTIONS, test_options, &len) < 0) in test_ip_options() 138 if (setsockopt(sock, IPPROTO_IP, IP_OPTIONS, &new_options, in test_ip_options() 152 if (getsockopt(sock, IPPROTO_IP, IP_OPTIONS, test_options, &len) < 0) in test_ip_options() 182 if (setsockopt(sock, IPPROTO_IP, IP_OPTIONS, NULL, 0) < 0) in test_ip_options() 192 if (getsockopt(sock, IPPROTO_IP, IP_OPTIONS, test_options, &len) < 0) in test_ip_options() 215 int flag[2], sock; in test_ip_hdrincl() local [all …]
|
/freebsd/tools/regression/sockets/shutdown/ |
H A D | shutdown.c | 41 struct sockaddr_in sock; in main() local 59 bzero(&sock, sizeof(sock)); in main() 60 sock.sin_len = sizeof(sock); in main() 61 sock.sin_family = AF_INET; in main() 62 sock.sin_addr.s_addr = htonl(INADDR_LOOPBACK); in main() 63 sock.sin_port = 0; in main() 65 if (bind(listen_sock, (struct sockaddr *)&sock, sizeof(sock)) < 0) in main() 67 inet_ntoa(sock.sin_addr), sock.sin_port, strerror(errno)); in main() 69 len = sizeof(sock); in main() 70 if (getsockname(listen_sock, (struct sockaddr *)&sock, &len) < 0) in main() [all …]
|
/freebsd/contrib/bsnmp/snmpd/ |
H A D | trans_inet.c | 354 struct port_sock *sock = __containerof(pi, struct port_sock, input); in inet_recv() local 367 sock->parse_ctrl(sock, &msg); in inet_recv() 464 struct port_sock *sock = calloc(1, sizeof(struct port_sock)); in ipv4_create() local 465 if (sock == NULL) in ipv4_create() 468 snmpd_input_init(&sock->input); in ipv4_create() 470 TAILQ_INSERT_HEAD(&port->socks, sock, link); in ipv4_create() 473 (struct sockaddr_in *)&sock->bind_addr; in ipv4_create() 480 sock->port = port; in ipv4_create() 495 struct port_sock *sock = udata; in ipv4_input() local 497 sock->input.peerlen = sizeof(struct sockaddr_in); in ipv4_input() [all …]
|
/freebsd/crypto/openssl/crypto/bio/ |
H A D | bio_sock2.c | 43 int sock = -1; in BIO_socket() local 48 sock = socket(domain, socktype, protocol); in BIO_socket() 49 if (sock == -1) { in BIO_socket() 63 ktls_enable(sock); in BIO_socket() 67 return sock; in BIO_socket() 90 int BIO_connect(int sock, const BIO_ADDR *addr, int options) in BIO_connect() argument 94 if (sock == -1) { in BIO_connect() 99 if (!BIO_socket_nbio(sock, (options & BIO_SOCK_NONBLOCK) != 0)) in BIO_connect() 103 if (setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, in BIO_connect() 113 if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, in BIO_connect() [all …]
|
/freebsd/tools/regression/sockets/sigpipe/ |
H A D | sigpipe.c | 86 test_send(const char *testname, int sock) in test_send() argument 92 len = send(sock, &ch, sizeof(ch), 0); in test_send() 102 test_write(const char *testname, int sock) in test_write() argument 108 len = write(sock, &ch, sizeof(ch)); in test_write() 216 tcp_pair(u_short port, int sock[2]) in tcp_pair() 244 sock[0] = accept_sock; in tcp_pair() 245 sock[1] = connect_sock; in tcp_pair() 252 int sock[2]; in main() local 269 if (socketpair(PF_LOCAL, SOCK_STREAM, 0, sock) < 0) in main() 271 test_send_wantsignal("test_send_wantsignal(PF_LOCAL)", sock[0], in main() [all …]
|
/freebsd/contrib/ntp/libntp/lib/isc/include/isc/ |
H A D | socket.h | 277 void (*attach)(isc_socket_t *sock, 280 isc_result_t (*bind)(isc_socket_t *sock, isc_sockaddr_t *sockaddr, 282 isc_result_t (*sendto)(isc_socket_t *sock, isc_region_t *region, 286 isc_result_t (*connect)(isc_socket_t *sock, isc_sockaddr_t *addr, 289 isc_result_t (*recv)(isc_socket_t *sock, isc_region_t *region, 292 void (*cancel)(isc_socket_t *sock, isc_task_t *task, 294 isc_result_t (*getsockname)(isc_socket_t *sock, 296 isc_sockettype_t (*gettype)(isc_socket_t *sock); 297 void (*ipv6only)(isc_socket_t *sock, isc_boolean_t yes); 298 isc_result_t (*fdwatchpoke)(isc_socket_t *sock, int flags); [all …]
|
/freebsd/contrib/wpa/wpa_supplicant/ |
H A D | ctrl_iface_unix.c | 36 int sock; member 46 int sock; member 64 const char *ifname, int sock, 76 static void wpas_ctrl_sock_debug(const char *title, int sock, const char *buf, in wpas_ctrl_sock_debug() argument 89 if (getsockopt(sock, SOL_SOCKET, SO_SNDBUF, &sndbuf, &optlen) < 0) in wpas_ctrl_sock_debug() 92 if (ioctl(sock, TIOCOUTQ, &outq) < 0) in wpas_ctrl_sock_debug() 97 title, sock, sndbuf, outq, (int) len); in wpas_ctrl_sock_debug() 129 static void wpa_supplicant_ctrl_iface_receive(int sock, void *eloop_ctx, in wpa_supplicant_ctrl_iface_receive() argument 145 res = recvfrom(sock, buf, CTRL_IFACE_MAX_LEN + 1, 0, in wpa_supplicant_ctrl_iface_receive() 205 wpas_ctrl_sock_debug("ctrl_sock-sendto", sock, reply, in wpa_supplicant_ctrl_iface_receive() [all …]
|
H A D | ctrl_iface_udp.c | 46 int sock; member 52 int sock; member 59 const char *ifname, int sock, 217 static void wpa_supplicant_ctrl_iface_receive(int sock, void *eloop_ctx, argument 241 res = recvfrom(sock, buf, CTRL_IFACE_MAX_LEN, 0, 346 sendto(sock, reply, reply_len, 0, (struct sockaddr *) &from, 350 sendto(sock, "FAIL\n", 5, 0, (struct sockaddr *) &from, 353 sendto(sock, "OK\n", 3, 0, (struct sockaddr *) &from, 381 priv->sock, &priv->ctrl_dst, level, txt, len); 388 wpa_supplicant_ctrl_iface_send(wpa_s, NULL, wpa_s->ctrl_iface->sock, [all …]
|
/freebsd/usr.bin/sockstat/ |
H A D | sockstat.c | 131 struct sock { struct 133 RB_ENTRY(sock) socket_tree; /* tree of pcbs with socket */ argument 134 SLIST_ENTRY(sock) socket_list; /* list of pcbs w/o socket */ 136 RB_ENTRY(sock) pcb_tree; 154 static RB_HEAD(socks_t, sock) socks = RB_INITIALIZER(&socks); argument 156 socket_compare(const struct sock *a, const struct sock *b) in socket_compare() 160 RB_GENERATE_STATIC(socks_t, sock, socket_tree, socket_compare); 162 static RB_HEAD(pcbs_t, sock) pcbs = RB_INITIALIZER(&pcbs); 164 pcb_compare(const struct sock *a, const struct sock *b) in pcb_compare() 168 RB_GENERATE_STATIC(pcbs_t, sock, pcb_tree, pcb_compare); [all …]
|
/freebsd/contrib/sendmail/contrib/ |
H A D | socketmapClient.pl | 14 my $sock; 17 $sock = new IO::Socket::INET ( 23 $sock = new IO::Socket::UNIX ( 31 die "Could not create socket: $!\n" unless $sock; 35 netstringWrite($sock, $request); 36 $sock->flush(); 37 my $response = netstringRead($sock); 42 $sock->close(); 45 my $sock = shift; 48 print $sock length($data).':'.$data.','; [all …]
|
H A D | socketmapServer.pl | 11 my $sock; 14 $sock = new IO::Socket::INET ( 23 $sock = new IO::Socket::UNIX ( 32 while(my $client = $sock->accept()) { 38 $sock->close(); 45 $sock->close(); 76 my $sock = shift; 79 print $sock length($data).':'.$data.','; 83 my $sock = shift; 86 my $dataLength = <$sock>; [all …]
|
/freebsd/lib/libc/tests/secure/ |
H A D | fortify_socket_test.c | 76 new_socket(int sock[2]) in new_socket() 86 error = socketpair(AF_UNIX, SOCK_STREAM, 0, sock); in new_socket() 90 rv = send(sock[1], &sockbuf[total], sizeof(sockbuf) - total, 0); in new_socket() 110 error = sendmsg(sock[1], &hdr, 0); in new_socket() 177 int sock[2] = { -1, -1 }; in ATF_TC_BODY() local 179 new_socket(sock); in ATF_TC_BODY() 182 getpeername(sock[0], &__stack.__buf, &socklen); in ATF_TC_BODY() 199 int sock[2] = { -1, -1 }; in ATF_TC_BODY() local 201 new_socket(sock); in ATF_TC_BODY() 204 getpeername(sock[0], &__stack.__buf, &socklen); in ATF_TC_BODY() [all …]
|
/freebsd/contrib/openbsm/bin/auditdistd/ |
H A D | proto_common.c | 52 blocking_socket(int sock) in blocking_socket() argument 56 flags = fcntl(sock, F_GETFL); in blocking_socket() 62 proto_descriptor_send(int sock, int fd) in proto_descriptor_send() argument 68 PJDLOG_ASSERT(sock >= 0); in proto_descriptor_send() 85 if (sendmsg(sock, &msg, 0) == -1) in proto_descriptor_send() 92 proto_common_send(int sock, const unsigned char *data, size_t size, int fd) in proto_common_send() argument 98 PJDLOG_ASSERT(sock >= 0); in proto_common_send() 105 if (shutdown(sock, SHUT_RD) == -1) in proto_common_send() 115 done = send(sock, data, sendsize, MSG_NOSIGNAL); in proto_common_send() 144 if (errno == EAGAIN && blocking_socket(sock)) in proto_common_send() [all …]
|
/freebsd/sbin/hastd/ |
H A D | proto_common.c | 52 blocking_socket(int sock) in blocking_socket() argument 56 flags = fcntl(sock, F_GETFL); in blocking_socket() 62 proto_descriptor_send(int sock, int fd) in proto_descriptor_send() argument 68 PJDLOG_ASSERT(sock >= 0); in proto_descriptor_send() 85 if (sendmsg(sock, &msg, 0) == -1) in proto_descriptor_send() 92 proto_common_send(int sock, const unsigned char *data, size_t size, int fd) in proto_common_send() argument 98 PJDLOG_ASSERT(sock >= 0); in proto_common_send() 105 if (shutdown(sock, SHUT_RD) == -1) in proto_common_send() 115 done = send(sock, data, sendsize, MSG_NOSIGNAL); in proto_common_send() 144 if (errno == EAGAIN && blocking_socket(sock)) in proto_common_send() [all …]
|
/freebsd/lib/libnv/ |
H A D | msgio.c | 100 msg_recv(int sock, struct msghdr *msg) in msg_recv() argument 104 PJDLOG_ASSERT(sock >= 0); in msg_recv() 113 fd_wait(sock, true); in msg_recv() 114 if (recvmsg(sock, msg, flags) == -1) { in msg_recv() 126 msg_send(int sock, const struct msghdr *msg) in msg_send() argument 129 PJDLOG_ASSERT(sock >= 0); in msg_send() 132 fd_wait(sock, false); in msg_send() 133 if (sendmsg(sock, msg, 0) == -1) { in msg_send() 146 cred_send(int sock) in cred_send() argument 179 if (msg_send(sock, &msg) == -1) in cred_send() [all …]
|
/freebsd/contrib/netbsd-tests/net/ |
H A D | net_common.sh | 110 local sock=$1 114 export RUMP_SERVER=$sock 146 local sock=$1 152 atf_check -s exit:0 rump_server $libs $sock 154 echo $sock >> $_rump_server_socks 160 local sock=$1 171 _rump_server_start_common $sock $libs 178 local sock=$1 189 _rump_server_start_common $sock $libs 196 local sock=$1 [all …]
|
/freebsd/tools/regression/sockets/rtsocket/ |
H A D | rtsocket.c | 44 int sock, socks[2]; in main() local 46 sock = socket(PF_ROUTE, SOCK_STREAM, 0); in main() 47 if (sock >= 0) { in main() 48 close(sock); in main() 50 sock); in main() 56 sock = socket(PF_ROUTE, SOCK_DGRAM, 0); in main() 57 if (sock >= 0) { in main() 58 close(sock); in main() 60 sock); in main() 66 sock = socket(PF_ROUTE, SOCK_RAW, 0); in main() [all …]
|
/freebsd/tools/regression/sockets/unix_socket/ |
H A D | unix_socket.c | 43 int sock, socks[2]; in main() local 45 sock = socket(PF_LOCAL, SOCK_STREAM, 0); in main() 46 if (sock < 0) in main() 48 close(sock); in main() 50 sock = socket(PF_LOCAL, SOCK_DGRAM, 0); in main() 51 if (sock < 0) in main() 53 close(sock); in main() 55 sock = socket(PF_LOCAL, SOCK_RAW, 0); in main() 56 if (sock >= 0) { in main() 57 close(sock); in main() [all …]
|
/freebsd/crypto/heimdal/lib/kadm5/ |
H A D | send_recv.c | 44 krb5_storage *sock; in _kadm5_client_send() local 46 assert(context->sock != -1); in _kadm5_client_send() 62 sock = krb5_storage_from_fd(context->sock); in _kadm5_client_send() 63 if(sock == NULL) { in _kadm5_client_send() 69 ret = krb5_store_data(sock, out); in _kadm5_client_send() 72 krb5_storage_free(sock); in _kadm5_client_send() 82 krb5_storage *sock; in _kadm5_client_recv() local 84 sock = krb5_storage_from_fd(context->sock); in _kadm5_client_recv() 85 if(sock == NULL) { in _kadm5_client_recv() 89 ret = krb5_ret_data(sock, &data); in _kadm5_client_recv() [all …]
|
/freebsd/crypto/openssh/ |
H A D | canohost.c | 68 get_socket_address(int sock, int remote, int flags) in get_socket_address() argument 75 if (sock < 0) in get_socket_address() 83 if (getpeername(sock, (struct sockaddr *)&addr, &addrlen) != 0) in get_socket_address() 86 if (getsockname(sock, (struct sockaddr *)&addr, &addrlen) != 0) in get_socket_address() 117 get_peer_ipaddr(int sock) in get_peer_ipaddr() argument 121 if ((p = get_socket_address(sock, 1, NI_NUMERICHOST)) != NULL) in get_peer_ipaddr() 127 get_local_ipaddr(int sock) in get_local_ipaddr() argument 131 if ((p = get_socket_address(sock, 0, NI_NUMERICHOST)) != NULL) in get_local_ipaddr() 159 get_sock_port(int sock, int local) in get_sock_port() argument 166 if (sock < 0) in get_sock_port() [all …]
|
/freebsd/tools/regression/sockets/listen_kqueue/ |
H A D | listen_kqueue.c | 52 int kq, sock, opt, pid, nev, fd; in main() local 57 if ((sock = socket(PF_INET, SOCK_STREAM, 0)) == -1) in main() 60 EV_SET(&ev[0], sock, EVFILT_READ, EV_ADD | EV_CLEAR, 0, 0, NULL); in main() 61 EV_SET(&ev[1], sock, EVFILT_WRITE, EV_ADD | EV_CLEAR, 0, 0, NULL); in main() 64 if (setsockopt(sock, SOL_SOCKET, SO_NOSIGPIPE, &opt, sizeof(opt)) == -1) in main() 70 if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) == -1) in main() 77 if (bind(sock, (struct sockaddr *)&addr, sizeof(addr)) == -1) in main() 79 if (listen(sock, 0x80) == -1) in main() 82 if (ioctl(sock, FIONBIO, &opt) == -1) in main() 92 if (close(sock) == -1) in main() [all …]
|
/freebsd/contrib/capsicum-test/ |
H A D | socket.cc | 32 int sock = socket(AF_UNIX, SOCK_STREAM, 0); in TEST() local 33 EXPECT_OK(sock); in TEST() 34 if (sock < 0) return; in TEST() 36 int cap_sock_rw = dup(sock); in TEST() 39 int cap_sock_all = dup(sock); in TEST() 42 EXPECT_OK(close(sock)); in TEST() 56 int sock = socket(AF_UNIX, SOCK_STREAM, 0); in TEST() local 57 EXPECT_OK(sock); in TEST() 58 if (sock < 0) return; in TEST() 60 int cap_sock_rw = dup(sock); in TEST() [all …]
|
/freebsd/contrib/wpa/src/drivers/ |
H A D | linux_ioctl.c | 19 int linux_set_iface_flags(int sock, const char *ifname, int dev_up) in linux_set_iface_flags() argument 24 if (sock < 0) in linux_set_iface_flags() 30 if (ioctl(sock, SIOCGIFFLAGS, &ifr) != 0) { in linux_set_iface_flags() 47 if (ioctl(sock, SIOCSIFFLAGS, &ifr) != 0) { in linux_set_iface_flags() 59 int linux_iface_up(int sock, const char *ifname) in linux_iface_up() argument 64 if (sock < 0) in linux_iface_up() 70 if (ioctl(sock, SIOCGIFFLAGS, &ifr) != 0) { in linux_iface_up() 81 int linux_get_ifhwaddr(int sock, const char *ifname, u8 *addr) in linux_get_ifhwaddr() argument 87 if (ioctl(sock, SIOCGIFHWADDR, &ifr)) { in linux_get_ifhwaddr() 104 int linux_set_ifhwaddr(int sock, const char *ifname, const u8 *addr) in linux_set_ifhwaddr() argument [all …]
|
/freebsd/lib/libcasper/libcasper/ |
H A D | libcasper.c | 89 int sock[2], serrno, pfd; in cap_init() local 94 sock) == -1) { in cap_init() 101 close(sock[0]); in cap_init() 102 casper_main_loop(sock[1]); in cap_init() 106 close(sock[1]); in cap_init() 107 chan = cap_wrap(sock[0], 0); in cap_init() 110 close(sock[0]); in cap_init() 122 close(sock[0]); in cap_init() 123 close(sock[1]); in cap_init() 129 cap_wrap(int sock, int flags) in cap_wrap() argument [all …]
|