#include <string.h>
#include <fcntl.h>
#include <sys/socket.h>
+#include <pthread.h>
/* sys/un.h with __USE_MISC uses strlen, which is unsafe */
#ifdef __USE_MISC
#include <rte_log.h>
#include <rte_pci.h>
-#include <rte_tailq.h>
#include <rte_eal_memconfig.h>
#include <rte_malloc.h>
#include "eal_filesystem.h"
#include "eal_pci_init.h"
+#include "eal_thread.h"
/**
* @file
struct linger l;
l.l_onoff = 1;
l.l_linger = 60;
- setsockopt(conn_sock, SOL_SOCKET, SO_LINGER, &l, sizeof(l));
+
+ if (setsockopt(conn_sock, SOL_SOCKET, SO_LINGER, &l, sizeof(l)) < 0)
+ RTE_LOG(WARNING, EAL, "Cannot set SO_LINGER option "
+ "on listen socket (%s)\n", strerror(errno));
ret = vfio_mp_sync_receive_request(conn_sock);
switch (ret) {
case SOCKET_REQ_CONTAINER:
- fd = pci_vfio_get_container_fd();
+ fd = vfio_get_container_fd();
if (fd < 0)
vfio_mp_sync_send_request(conn_sock, SOCKET_ERR);
else
continue;
}
- fd = pci_vfio_get_group_fd(vfio_group_no);
+ fd = vfio_get_group_fd(vfio_group_no);
if (fd < 0)
vfio_mp_sync_send_request(conn_sock, SOCKET_ERR);
pci_vfio_mp_sync_setup(void)
{
int ret;
+ char thread_name[RTE_MAX_THREAD_NAME_LEN];
if (vfio_mp_sync_socket_setup() < 0) {
RTE_LOG(ERR, EAL, "Failed to set up local socket!\n");
ret = pthread_create(&socket_thread, NULL,
pci_vfio_mp_sync_thread, NULL);
if (ret) {
- RTE_LOG(ERR, EAL, "Failed to create thread for communication with "
- "secondary processes!\n");
+ RTE_LOG(ERR, EAL,
+ "Failed to create thread for communication with secondary processes!\n");
close(mp_socket_fd);
return -1;
}
+
+ /* Set thread_name for aid in debugging. */
+ snprintf(thread_name, RTE_MAX_THREAD_NAME_LEN, "pci-vfio-sync");
+ ret = rte_thread_setname(socket_thread, thread_name);
+ if (ret)
+ RTE_LOG(DEBUG, EAL,
+ "Failed to set thread name for secondary processes!\n");
+
return 0;
}