feat: unify system status codes
This commit is contained in:
1 parent
93894b8fe5
commit
8a3ffb2be1
46 files changed
+1499
-489
No files matched your search
@@ -500,7 +500,7 @@ static void apply_changes() {
|
||||
if (g_driver_available && g_selected_mode != g_info.currentMode) {
|
||||
int result = montauk::display_set_mode(g_selected_mode);
|
||||
if (result < 0) {
|
||||
set_status(result == -2
|
||||
set_status(result == montauk::UnsupportedOp
|
||||
? "Mode needs unsupported display-link training"
|
||||
: "Mode change failed; previous mode restored");
|
||||
refresh_state(true);
|
||||
|
||||
@@ -262,7 +262,7 @@ void perform_graceful_shutdown(LoginState* ls, int action) {
|
||||
// A successful power-control syscall never returns. If it does return,
|
||||
// keep the trusted supervisor alive and make the authorization failure
|
||||
// visible instead of falling through an unreachable-code assumption.
|
||||
show_stage(ls, heading, rc == montauk::abi::SYS_ERR_PERMISSION
|
||||
show_stage(ls, heading, rc == montauk::CapabilityDenied
|
||||
? "Power control permission denied."
|
||||
: "Power control failed.");
|
||||
for (;;) montauk::sleep_ms(1000);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
extern "C" void _start() {
|
||||
montauk::print("Rebooting...\n");
|
||||
int rc = montauk::reset();
|
||||
if (rc == montauk::abi::SYS_ERR_PERMISSION)
|
||||
if (rc == montauk::CapabilityDenied)
|
||||
montauk::print("reset: permission denied\n");
|
||||
else
|
||||
montauk::print("reset: reboot failed\n");
|
||||
|
||||
@@ -194,7 +194,7 @@ static int process_command(const char* line) {
|
||||
: montauk::abi::POWER_REQ_SHUTDOWN;
|
||||
int rc = montauk::power_request(action);
|
||||
if (rc == 0) montauk::exit(0);
|
||||
montauk::print(rc == montauk::abi::SYS_ERR_PERMISSION
|
||||
montauk::print(rc == montauk::CapabilityDenied
|
||||
? "power: permission denied\n"
|
||||
: "power: request failed\n");
|
||||
return 1;
|
||||
@@ -202,7 +202,7 @@ static int process_command(const char* line) {
|
||||
|
||||
if (streq(cmd, "suspend")) {
|
||||
int rc = montauk::suspend();
|
||||
if (rc == montauk::abi::SYS_ERR_PERMISSION)
|
||||
if (rc == montauk::CapabilityDenied)
|
||||
montauk::print("suspend: permission denied\n");
|
||||
return rc == 0 ? 0 : 1;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user