From 921f679ee4809bdd564246c7dd38de84efc6b5f3 Mon Sep 17 00:00:00 2001 From: Mark Seaborn Date: Thu, 1 Jan 2009 11:40:48 +0000 Subject: [PATCH] Fix up auto-generated syscalls - don't use syscall instruction; print debug message instead --- hellow.c | 1 + misc/Makefile | 2 +- sysdeps/nacl/unimpl_syscall.c | 18 ++++++++++++++++++ sysdeps/unix/Makefile | 2 +- sysdeps/unix/make-syscalls.sh | 7 +++---- 5 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 sysdeps/nacl/unimpl_syscall.c diff --git a/hellow.c b/hellow.c index cc230a40ad..da88af3177 100644 --- a/hellow.c +++ b/hellow.c @@ -5,5 +5,6 @@ int main() { write(1, "Hello (via write())\n", 20); printf("Hello world (%s)\n", "via printf()"); + open("file", 0); return 0; } diff --git a/misc/Makefile b/misc/Makefile index eb97ac1767..4ca47f3b60 100644 --- a/misc/Makefile +++ b/misc/Makefile @@ -64,7 +64,7 @@ routines := brk sbrk sstk ioctl \ getloadavg getclktck \ fgetxattr flistxattr fremovexattr fsetxattr getxattr \ listxattr lgetxattr llistxattr lremovexattr lsetxattr \ - removexattr setxattr + removexattr setxattr unimpl_syscall distribute := device-nrs.h diff --git a/sysdeps/nacl/unimpl_syscall.c b/sysdeps/nacl/unimpl_syscall.c new file mode 100644 index 0000000000..6e044f613b --- /dev/null +++ b/sysdeps/nacl/unimpl_syscall.c @@ -0,0 +1,18 @@ + +#include +#include +#include + +static void debug(const char *str) +{ + write(2, str, strlen(str)); +} + +int __unimplemented_syscall(const char *name) +{ + debug("syscall "); + debug(name); + debug("\n"); + errno = ENOSYS; + return -1; +} diff --git a/sysdeps/unix/Makefile b/sysdeps/unix/Makefile index 2696e7fb62..6f24544334 100644 --- a/sysdeps/unix/Makefile +++ b/sysdeps/unix/Makefile @@ -308,7 +308,7 @@ endif # This is the end of the pipeline for compiling the syscall stubs. # The stdin in assembler with cpp using sysdep.h macros. # Be sure to disable debugging info since it would all just say "". -compile-syscall = $(filter-out -g%,$(COMPILE.S)) -x assembler-with-cpp -o $@ - +compile-syscall = $(filter-out -g%,$(COMPILE.c)) -x c -o $@ - ifndef avoid-generated $(common-objpfx)sysd-syscalls: $(..)sysdeps/unix/make-syscalls.sh \ diff --git a/sysdeps/unix/make-syscalls.sh b/sysdeps/unix/make-syscalls.sh index ca82e1f331..d953d012a1 100644 --- a/sysdeps/unix/make-syscalls.sh +++ b/sysdeps/unix/make-syscalls.sh @@ -151,6 +151,7 @@ shared-only-routines += $file ;; esac + echo " \$(common-objpfx)sysd-syscalls \\" echo " \$(common-objpfx)s-proto$cancellable.d" case x"$callnum" in x_) @@ -160,10 +161,8 @@ shared-only-routines += $file x*) echo "\ \$(make-target-directory) - (echo '#include '; \\ - echo 'PSEUDO$noerrno ($strong, $syscall, $nargs)'; \\ - echo ' ret$noerrno'; \\ - echo 'PSEUDO_END$noerrno($strong)'; \\ + (echo 'int $strong() { return __unimplemented_syscall(\"$syscall\"); }'; \\ + echo 'strong_alias ($strong, __${syscall}_nocancel)'; \\ echo 'libc_hidden_def ($strong)'; \\" ;; esac -- 2.11.4.GIT