summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/init/syscalls.c4
-rw-r--r--tools/syscall_wrappers.awk10
2 files changed, 10 insertions, 4 deletions
diff --git a/src/init/syscalls.c b/src/init/syscalls.c
index e48043f..5b8950b 100644
--- a/src/init/syscalls.c
+++ b/src/init/syscalls.c
@@ -19,7 +19,7 @@ int _syscall_fork(int flags, handle_t __user *fs_front) {
}
handle_t _syscall_open(const char __user *path, int len, int flags) {
- return _syscall(_SYSCALL_OPEN, (int)path, len, flags, 0);
+ return (handle_t)_syscall(_SYSCALL_OPEN, (int)path, len, flags, 0);
}
int _syscall_mount(handle_t h, const char __user *path, int len) {
@@ -47,6 +47,6 @@ int _syscall_fs_respond(char __user *buf, int ret) {
}
void __user *_syscall_memflag(void __user *addr, size_t len, int flags) {
- return _syscall(_SYSCALL_MEMFLAG, (int)addr, (int)len, flags, 0);
+ return (void __user *)_syscall(_SYSCALL_MEMFLAG, (int)addr, (int)len, flags, 0);
}
diff --git a/tools/syscall_wrappers.awk b/tools/syscall_wrappers.awk
index c1f980e..12cc233 100644
--- a/tools/syscall_wrappers.awk
+++ b/tools/syscall_wrappers.awk
@@ -14,7 +14,10 @@ BEGIN {
sub(/;/, " {");
print $0;
- name = substr($0, match($0, /_syscall_[^(]+/), RLENGTH);
+ name = substr($0, match($0, /_syscall_[^(]+/), RLENGTH);
+ rets = substr($0, 0, RSTART - 1);
+ sub(/ *$/, "", rets)
+
params = substr($0, match($0, /\(.+\)/) + 1, RLENGTH - 2);
if (params == "void") params = ""
@@ -36,7 +39,10 @@ BEGIN {
}
printf "\t";
- if (!index($0, "_Noreturn")) printf "return ";
+ if (!index($0, "_Noreturn")) {
+ printf "return ";
+ if (rets != "int") printf "(%s)", rets;
+ }
printf "_syscall(%s, %s, %s, %s, %s);\n", toupper(name), p[1], p[2], p[3], p[4];
if (index($0, "_Noreturn")) print "\t__builtin_unreachable();";