@@ -65,6 +65,18 @@ static void vmsg_close_fds(VhostUserMsg *vmsg)
static void vmsg_unblock_fds(VhostUserMsg *vmsg)
{
int i;
+
+ /*
+ * These messages carry fd used to map memory, not to send/receive messages,
+ * so this operation is useless. In addition, in some systems this
+ * operation can fail (e.g. in macOS setting an fd returned by shm_open()
+ * non-blocking fails with errno = ENOTTY)
+ */
+ if (vmsg->request == VHOST_USER_ADD_MEM_REG ||
+ vmsg->request == VHOST_USER_SET_MEM_TABLE) {
+ return;
+ }
+
for (i = 0; i < vmsg->fd_num; i++) {
qemu_socket_set_nonblock(vmsg->fds[i]);
}