I'm trying to create a vsock socket on the host but it fails with ENODEV. I know I can use a VZVirtioSocketDeviceConfiguration and get one through the Virtualization Framework, but for my use case it would be easier to integrate if I can create the socket myself.
This works from inside a VM assuming I've configured a VZVirtioSocketDeviceConfiguration, but not on the host.
#include <sys/types.h>
#include <sys/socket.h>
#include <stdio.h>
int main() {
int fd = socket(PF_VSOCK, SOCK_STREAM, 0);
if (fd < 0 ) {
perror("socket");
}
return 0;
}