mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:14:58 +00:00
syscall: Translate errno to something human-readable
This commit is contained in:
parent
c706b2c142
commit
99b8750154
1 changed files with 6 additions and 3 deletions
|
@ -9,6 +9,7 @@
|
|||
#include <AK/Iterator.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <errno_numbers.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -93,12 +94,14 @@ int main(int argc, char** argv)
|
|||
|
||||
dbgln_if(SYSCALL_1_DEBUG, "Calling {} {:p} {:p} {:p}\n", arg[0], arg[1], arg[2], arg[3]);
|
||||
int rc = syscall(arg[0], arg[1], arg[2], arg[3]);
|
||||
if (rc == -1)
|
||||
perror("syscall");
|
||||
if (output_buffer)
|
||||
fwrite(outbuf, 1, sizeof(outbuf), stdout);
|
||||
|
||||
warnln("Syscall return: {}", rc);
|
||||
if (-rc >= 0 && -rc < EMAXERRNO) {
|
||||
warnln("Syscall return: {} ({})", rc, strerror(-rc));
|
||||
} else {
|
||||
warnln("Syscall return: {} (?)", rc);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue