mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-29 14:25:30 +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;
|
||||
}
|
||||
|
||||
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) {
|
||||
switch (result) {
|
||||
case PosixResult::Success:
|
||||
@ -87,7 +104,7 @@ namespace skyline::service::nvdrv {
|
||||
try {
|
||||
std::shared_lock lock(deviceMutex);
|
||||
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 &) {
|
||||
throw exception("Ioctl was called with invalid fd: {}", fd);
|
||||
}
|
||||
@ -97,7 +114,7 @@ namespace skyline::service::nvdrv {
|
||||
try {
|
||||
std::shared_lock lock(deviceMutex);
|
||||
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 &) {
|
||||
throw exception("Ioctl2 was called with invalid fd: {}", fd);
|
||||
}
|
||||
@ -107,7 +124,7 @@ namespace skyline::service::nvdrv {
|
||||
try {
|
||||
std::shared_lock lock(deviceMutex);
|
||||
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 &) {
|
||||
throw exception("Ioctl3 was called with invalid fd: {}", fd);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user