mirror of
https://github.com/skyline-emu/skyline.git
synced 2025-01-04 05:05:29 +03:00
Ensure failed IOCTLs are logged as a warning log
This commit is contained in:
parent
eeb86a4f8a
commit
13e7b54c61
@ -60,6 +60,23 @@ namespace skyline::service::nvdrv {
|
|||||||
return NvResult::FileOperationFailed;
|
return NvResult::FileOperationFailed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PosixResult LogIoctlResult(PosixResult result, u32 ioctl) {
|
||||||
|
switch (result) {
|
||||||
|
case PosixResult::Success:
|
||||||
|
case PosixResult::TryAgain:
|
||||||
|
case PosixResult::Busy:
|
||||||
|
case PosixResult::TimedOut:
|
||||||
|
return result;
|
||||||
|
case PosixResult::NotPermitted:
|
||||||
|
case PosixResult::InvalidArgument:
|
||||||
|
case PosixResult::InappropriateIoctlForDevice:
|
||||||
|
case PosixResult::NotSupported:
|
||||||
|
default:
|
||||||
|
Logger::Warn("IOCTL {} failed: {}", ioctl, static_cast<i32>(result));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static NvResult ConvertResult(PosixResult result) {
|
static NvResult ConvertResult(PosixResult result) {
|
||||||
switch (result) {
|
switch (result) {
|
||||||
case PosixResult::Success:
|
case PosixResult::Success:
|
||||||
@ -87,7 +104,7 @@ namespace skyline::service::nvdrv {
|
|||||||
try {
|
try {
|
||||||
std::shared_lock lock(deviceMutex);
|
std::shared_lock lock(deviceMutex);
|
||||||
Logger::Debug("fd: {}, cmd: 0x{:X}, device: {}", fd, cmd.raw, devices.at(fd)->GetName());
|
Logger::Debug("fd: {}, cmd: 0x{:X}, device: {}", fd, cmd.raw, devices.at(fd)->GetName());
|
||||||
return ConvertResult(devices.at(fd)->Ioctl(cmd, buffer));
|
return ConvertResult(LogIoctlResult(devices.at(fd)->Ioctl(cmd, buffer), cmd.raw));
|
||||||
} catch (const std::out_of_range &) {
|
} catch (const std::out_of_range &) {
|
||||||
throw exception("Ioctl was called with invalid fd: {}", fd);
|
throw exception("Ioctl was called with invalid fd: {}", fd);
|
||||||
}
|
}
|
||||||
@ -97,7 +114,7 @@ namespace skyline::service::nvdrv {
|
|||||||
try {
|
try {
|
||||||
std::shared_lock lock(deviceMutex);
|
std::shared_lock lock(deviceMutex);
|
||||||
Logger::Debug("fd: {}, cmd: 0x{:X}, device: {}", fd, cmd.raw, devices.at(fd)->GetName());
|
Logger::Debug("fd: {}, cmd: 0x{:X}, device: {}", fd, cmd.raw, devices.at(fd)->GetName());
|
||||||
return ConvertResult(devices.at(fd)->Ioctl2(cmd, buffer, inlineBuffer));
|
return ConvertResult(LogIoctlResult(devices.at(fd)->Ioctl2(cmd, buffer, inlineBuffer), cmd.raw));
|
||||||
} catch (const std::out_of_range &) {
|
} catch (const std::out_of_range &) {
|
||||||
throw exception("Ioctl2 was called with invalid fd: {}", fd);
|
throw exception("Ioctl2 was called with invalid fd: {}", fd);
|
||||||
}
|
}
|
||||||
@ -107,7 +124,7 @@ namespace skyline::service::nvdrv {
|
|||||||
try {
|
try {
|
||||||
std::shared_lock lock(deviceMutex);
|
std::shared_lock lock(deviceMutex);
|
||||||
Logger::Debug("fd: {}, cmd: 0x{:X}, device: {}", fd, cmd.raw, devices.at(fd)->GetName());
|
Logger::Debug("fd: {}, cmd: 0x{:X}, device: {}", fd, cmd.raw, devices.at(fd)->GetName());
|
||||||
return ConvertResult(devices.at(fd)->Ioctl3(cmd, buffer, inlineBuffer));
|
return ConvertResult(LogIoctlResult(devices.at(fd)->Ioctl3(cmd, buffer, inlineBuffer), cmd.raw));
|
||||||
} catch (const std::out_of_range &) {
|
} catch (const std::out_of_range &) {
|
||||||
throw exception("Ioctl3 was called with invalid fd: {}", fd);
|
throw exception("Ioctl3 was called with invalid fd: {}", fd);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user