Lines Matching refs:sk
97 static int fio_sendv_data(int sk, struct iovec *iov, int count) in fio_sendv_data() argument
103 ret = writev(sk, iov, count); in fio_sendv_data()
136 int fio_send_data(int sk, const void *p, unsigned int len) in fio_send_data() argument
142 return fio_sendv_data(sk, &iov, 1); in fio_send_data()
145 int fio_recv_data(int sk, void *p, unsigned int len) in fio_recv_data() argument
148 int ret = recv(sk, p, len, MSG_WAITALL); in fio_recv_data()
209 struct fio_net_cmd *fio_net_recv_cmd(int sk) in fio_net_recv_cmd() argument
218 ret = fio_recv_data(sk, &cmd, sizeof(cmd)); in fio_net_recv_cmd()
262 ret = fio_recv_data(sk, pdu, cmd.pdu_len); in fio_net_recv_cmd()
404 static int fio_net_send_simple_stack_cmd(int sk, uint16_t opcode, uint64_t tag) in fio_net_send_simple_stack_cmd() argument
411 return fio_send_data(sk, &cmd, sizeof(cmd)); in fio_net_send_simple_stack_cmd()
418 int fio_net_send_simple_cmd(int sk, uint16_t opcode, uint64_t tag, in fio_net_send_simple_cmd() argument
426 ret = fio_net_send_simple_stack_cmd(sk, opcode, tag); in fio_net_send_simple_cmd()
440 int fio_net_send_quit(int sk) in fio_net_send_quit() argument
444 return fio_net_send_simple_cmd(sk, FIO_NET_CMD_QUIT, 0, NULL); in fio_net_send_quit()
447 static int fio_net_send_ack(int sk, struct fio_net_cmd *cmd, int error, in fio_net_send_ack() argument
458 return fio_net_send_cmd(sk, FIO_NET_CMD_STOP, &epdu, sizeof(epdu), &tag, NULL); in fio_net_send_ack()
461 int fio_net_send_stop(int sk, int error, int signal) in fio_net_send_stop() argument
464 return fio_net_send_ack(sk, NULL, error, signal); in fio_net_send_stop()
783 static int handle_connection(int sk) in handle_connection() argument
790 server_fd = sk; in handle_connection()
795 .fd = sk, in handle_connection()
830 cmd = fio_net_recv_cmd(sk); in handle_connection()
847 close(sk); in handle_connection()
857 int ret = 0, sk, exitval = 0; in accept_loop() local
898 sk = accept(listen_sk, (struct sockaddr *) &addr6, &len); in accept_loop()
900 sk = accept(listen_sk, (struct sockaddr *) &addr, &len); in accept_loop()
902 if (sk < 0) { in accept_loop()
916 close(sk); in accept_loop()
922 handle_connection(sk); in accept_loop()
1145 static int fio_send_cmd_ext_pdu(int sk, uint16_t opcode, const void *buf, in fio_send_cmd_ext_pdu() argument
1160 return fio_sendv_data(sk, iov, 2); in fio_send_cmd_ext_pdu()
1284 int sk, opt; in fio_init_server_ip() local
1287 sk = socket(AF_INET6, SOCK_STREAM, 0); in fio_init_server_ip()
1289 sk = socket(AF_INET, SOCK_STREAM, 0); in fio_init_server_ip()
1291 if (sk < 0) { in fio_init_server_ip()
1297 if (setsockopt(sk, SOL_SOCKET, SO_REUSEADDR, (void *)&opt, sizeof(opt)) < 0) { in fio_init_server_ip()
1299 close(sk); in fio_init_server_ip()
1303 if (setsockopt(sk, SOL_SOCKET, SO_REUSEPORT, &opt, sizeof(opt)) < 0) { in fio_init_server_ip()
1305 close(sk); in fio_init_server_ip()
1326 if (bind(sk, addr, socklen) < 0) { in fio_init_server_ip()
1329 close(sk); in fio_init_server_ip()
1333 return sk; in fio_init_server_ip()
1341 int sk; in fio_init_server_sock() local
1343 sk = socket(AF_UNIX, SOCK_STREAM, 0); in fio_init_server_sock()
1344 if (sk < 0) { in fio_init_server_sock()
1357 if (bind(sk, (struct sockaddr *) &addr, len) < 0) { in fio_init_server_sock()
1359 close(sk); in fio_init_server_sock()
1364 return sk; in fio_init_server_sock()
1370 int sk; in fio_init_server_connection() local
1375 sk = fio_init_server_ip(); in fio_init_server_connection()
1377 sk = fio_init_server_sock(); in fio_init_server_connection()
1379 if (sk < 0) in fio_init_server_connection()
1380 return sk; in fio_init_server_connection()
1409 if (listen(sk, 0) < 0) { in fio_init_server_connection()
1411 close(sk); in fio_init_server_connection()
1415 return sk; in fio_init_server_connection()
1602 int sk, ret; in fio_server() local
1609 sk = fio_init_server_connection(); in fio_server()
1610 if (sk < 0) in fio_server()
1615 ret = accept_loop(sk); in fio_server()
1617 close(sk); in fio_server()