Lines Matching refs:sk

111 static int fio_sendv_data(int sk, struct iovec *iov, int count)  in fio_sendv_data()  argument
117 ret = writev(sk, iov, count); in fio_sendv_data()
150 int fio_send_data(int sk, const void *p, unsigned int len) in fio_send_data() argument
156 return fio_sendv_data(sk, &iov, 1); in fio_send_data()
159 int fio_recv_data(int sk, void *p, unsigned int len) in fio_recv_data() argument
162 int ret = recv(sk, p, len, MSG_WAITALL); in fio_recv_data()
223 struct fio_net_cmd *fio_net_recv_cmd(int sk) in fio_net_recv_cmd() argument
232 ret = fio_recv_data(sk, &cmd, sizeof(cmd)); in fio_net_recv_cmd()
276 ret = fio_recv_data(sk, pdu, cmd.pdu_len); in fio_net_recv_cmd()
418 static int fio_net_send_simple_stack_cmd(int sk, uint16_t opcode, uint64_t tag) in fio_net_send_simple_stack_cmd() argument
425 return fio_send_data(sk, &cmd, sizeof(cmd)); in fio_net_send_simple_stack_cmd()
432 int fio_net_send_simple_cmd(int sk, uint16_t opcode, uint64_t tag, in fio_net_send_simple_cmd() argument
440 ret = fio_net_send_simple_stack_cmd(sk, opcode, tag); in fio_net_send_simple_cmd()
454 int fio_net_send_quit(int sk) in fio_net_send_quit() argument
458 return fio_net_send_simple_cmd(sk, FIO_NET_CMD_QUIT, 0, NULL); in fio_net_send_quit()
461 static int fio_net_send_ack(int sk, struct fio_net_cmd *cmd, int error, in fio_net_send_ack() argument
472 return fio_net_send_cmd(sk, FIO_NET_CMD_STOP, &epdu, sizeof(epdu), &tag, NULL); in fio_net_send_ack()
475 int fio_net_send_stop(int sk, int error, int signal) in fio_net_send_stop() argument
478 return fio_net_send_ack(sk, NULL, error, signal); in fio_net_send_stop()
871 static int handle_connection(int sk) in handle_connection() argument
878 server_fd = sk; in handle_connection()
883 .fd = sk, in handle_connection()
918 cmd = fio_net_recv_cmd(sk); in handle_connection()
935 close(sk); in handle_connection()
945 int ret = 0, sk, exitval = 0; in accept_loop() local
986 sk = accept(listen_sk, (struct sockaddr *) &addr6, &len); in accept_loop()
988 sk = accept(listen_sk, (struct sockaddr *) &addr, &len); in accept_loop()
990 if (sk < 0) { in accept_loop()
1004 close(sk); in accept_loop()
1010 handle_connection(sk); in accept_loop()
1235 static int fio_send_cmd_ext_pdu(int sk, uint16_t opcode, const void *buf, in fio_send_cmd_ext_pdu() argument
1250 return fio_sendv_data(sk, iov, 2); in fio_send_cmd_ext_pdu()
1445 int sk, opt; in fio_init_server_ip() local
1448 sk = socket(AF_INET6, SOCK_STREAM, 0); in fio_init_server_ip()
1450 sk = socket(AF_INET, SOCK_STREAM, 0); in fio_init_server_ip()
1452 if (sk < 0) { in fio_init_server_ip()
1458 if (setsockopt(sk, SOL_SOCKET, SO_REUSEADDR, (void *)&opt, sizeof(opt)) < 0) { in fio_init_server_ip()
1460 close(sk); in fio_init_server_ip()
1464 if (setsockopt(sk, SOL_SOCKET, SO_REUSEPORT, &opt, sizeof(opt)) < 0) { in fio_init_server_ip()
1466 close(sk); in fio_init_server_ip()
1487 if (bind(sk, addr, socklen) < 0) { in fio_init_server_ip()
1490 close(sk); in fio_init_server_ip()
1494 return sk; in fio_init_server_ip()
1502 int sk; in fio_init_server_sock() local
1504 sk = socket(AF_UNIX, SOCK_STREAM, 0); in fio_init_server_sock()
1505 if (sk < 0) { in fio_init_server_sock()
1518 if (bind(sk, (struct sockaddr *) &addr, len) < 0) { in fio_init_server_sock()
1520 close(sk); in fio_init_server_sock()
1525 return sk; in fio_init_server_sock()
1531 int sk; in fio_init_server_connection() local
1536 sk = fio_init_server_ip(); in fio_init_server_connection()
1538 sk = fio_init_server_sock(); in fio_init_server_connection()
1540 if (sk < 0) in fio_init_server_connection()
1541 return sk; in fio_init_server_connection()
1570 if (listen(sk, 0) < 0) { in fio_init_server_connection()
1572 close(sk); in fio_init_server_connection()
1576 return sk; in fio_init_server_connection()
1763 int sk, ret; in fio_server() local
1770 sk = fio_init_server_connection(); in fio_server()
1771 if (sk < 0) in fio_server()
1776 ret = accept_loop(sk); in fio_server()
1778 close(sk); in fio_server()