MCPcopy Create free account
hub / github.com/F-Stack/f-stack / vhost_user_connect_nonblock

Function vhost_user_connect_nonblock

dpdk/lib/vhost/socket.c:437–457  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

435static rte_thread_t reconn_tid;
436
437static int
438vhost_user_connect_nonblock(char *path, int fd, struct sockaddr *un, size_t sz)
439{
440 int ret, flags;
441
442 ret = connect(fd, un, sz);
443 if (ret < 0 && errno != EISCONN)
444 return -1;
445
446 flags = fcntl(fd, F_GETFL, 0);
447 if (flags < 0) {
448 VHOST_LOG_CONFIG(path, ERR, "can't get flags for connfd %d (%s)\n",
449 fd, strerror(errno));
450 return -2;
451 }
452 if ((flags & O_NONBLOCK) && fcntl(fd, F_SETFL, flags & ~O_NONBLOCK)) {
453 VHOST_LOG_CONFIG(path, ERR, "can't disable nonblocking on fd %d\n", fd);
454 return -2;
455 }
456 return 0;
457}
458
459static uint32_t
460vhost_user_client_reconnect(void *arg __rte_unused)

Callers 2

vhost_user_start_clientFunction · 0.85

Calls 2

connectFunction · 0.50
fcntlFunction · 0.50

Tested by

no test coverage detected