[common] ivshmem: default to /dev/kvmfr0 if it's found
Some checks failed
build / client (Debug, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / module (push) Has been cancelled
build / host-linux (push) Has been cancelled
build / host-windows-cross (push) Has been cancelled
build / host-windows-native (push) Has been cancelled
build / obs (clang) (push) Has been cancelled
build / obs (gcc) (push) Has been cancelled
build / docs (push) Has been cancelled

This commit is contained in:
Geoffrey McRae 2024-09-05 14:01:28 +10:00
parent 6a0a635781
commit 4e8201da07

View file

@ -86,6 +86,15 @@ static StringList ivshmemDeviceGetValues(struct Option * option)
void ivshmemOptionsInit(void)
{
char * shmFile;
struct stat st;
// if there is a kvmfr device, default to using it instead
if (stat("/dev/kvmfr0", &st) == 0)
shmFile = "/dev/kvmfr0";
else
shmFile = "/dev/shm/looking-glass";
struct Option options[] =
{
{
@ -94,7 +103,7 @@ void ivshmemOptionsInit(void)
.shortopt = 'f',
.description = "The path to the shared memory file, or the name of the kvmfr device to use, e.g. kvmfr0",
.type = OPTION_TYPE_STRING,
.value.x_string = "/dev/shm/looking-glass",
.value.x_string = shmFile,
.validator = ivshmemDeviceValidator,
.getValues = ivshmemDeviceGetValues
},