Lines Matching defs:fd
87 static void vhost_user_server_new_connection(int fd, void *data, int *remove);
88 static void vhost_user_read_cb(int fd, void *dat, int *remove);
126 VHOST_CONFIG_LOG(ifname, ERR, "recvmsg failed on fd %d (%s)",
132 VHOST_CONFIG_LOG(ifname, ERR, "truncated msg (fd %d)", sockfd);
136 VHOST_CONFIG_LOG(ifname, ERR, "truncated control data (fd %d)", sockfd);
197 VHOST_CONFIG_LOG(ifname, ERR, "sendmsg error on fd %d (%s)",
206 vhost_user_add_connection(int fd, struct vhost_user_socket *vsocket)
219 close(fd);
256 "failed to add vhost user connection with fd %d",
257 fd);
262 conn->connfd = fd;
265 ret = fdset_add(vhost_user.fdset, fd, vhost_user_read_cb,
269 "failed to add fd %d into vhost server fdset",
270 fd);
288 close(fd);
293 vhost_user_server_new_connection(int fd, void *dat, int *remove __rte_unused)
297 fd = accept(fd, NULL, NULL);
298 if (fd < 0)
301 VHOST_CONFIG_LOG(vsocket->path, INFO, "new vhost user connection is %d", fd);
302 vhost_user_add_connection(fd, vsocket);
343 int fd;
346 fd = socket(AF_UNIX, SOCK_STREAM, 0);
347 if (fd < 0)
349 VHOST_CONFIG_LOG(vsocket->path, INFO, "vhost-user %s: socket created, fd: %d",
350 vsocket->is_server ? "server" : "client", fd);
352 if (!vsocket->is_server && fcntl(fd, F_SETFL, O_NONBLOCK)) {
354 "vhost-user: can't set nonblocking mode for socket, fd: %d (%s)",
355 fd, strerror(errno));
356 close(fd);
364 vsocket->socket_fd = fd;
372 int fd = vsocket->socket_fd;
385 ret = bind(fd, (struct sockaddr *)&vsocket->un, sizeof(vsocket->un));
393 ret = listen(fd, MAX_VIRTIO_BACKLOG);
397 ret = fdset_add(vhost_user.fdset, fd, vhost_user_server_new_connection,
400 VHOST_CONFIG_LOG(path, ERR, "failed to add listen fd %d to vhost server fdset",
401 fd);
408 close(fd);
414 int fd;
430 vhost_user_connect_nonblock(char *path, int fd, struct sockaddr *un, size_t sz)
434 ret = connect(fd, un, sz);
438 flags = fcntl(fd, F_GETFL, 0);
441 fd, strerror(errno));
444 if ((flags & O_NONBLOCK) && fcntl(fd, F_SETFL, flags & ~O_NONBLOCK)) {
445 VHOST_CONFIG_LOG(path, ERR, "can't disable nonblocking on fd %d", fd);
468 ret = vhost_user_connect_nonblock(reconn->vsocket->path, reconn->fd,
472 close(reconn->fd);
474 "reconnection for fd %d failed",
475 reconn->fd);
482 vhost_user_add_connection(reconn->fd, reconn->vsocket);
520 int fd = vsocket->socket_fd;
525 ret = vhost_user_connect_nonblock(vsocket->path, fd,
528 vhost_user_add_connection(fd, vsocket);
535 close(fd);
544 close(fd);
548 reconn->fd = fd;
1049 close(reconn->fd);