[nolibc] Change internal syscall API to remove reliance on libc's errno.
This change moves to a model where the error value of a system call is
potentially contained in the return value itself rather than being
implicit in errno. The helper function internal_iserror can be used
to extract the error value from a return value. On platforms other
than Linux/x86_64 this still uses errno, but other platforms are free
to port their error handling to this new model.
Differential Revision: http://llvm-reviews.chandlerc.com/D756
llvm-svn: 181436
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_win.cc b/compiler-rt/lib/sanitizer_common/sanitizer_win.cc
index 95445be..ab0d78d 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_win.cc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_win.cc
@@ -29,6 +29,8 @@
namespace __sanitizer {
+#include "sanitizer_syscall_generic.inc"
+
// --------------------- sanitizer_common.h
uptr GetPageSize() {
return 1U << 14; // FIXME: is this configurable?
@@ -217,7 +219,7 @@
UNIMPLEMENTED();
}
-int internal_close(fd_t fd) {
+uptr internal_close(fd_t fd) {
UNIMPLEMENTED();
}
@@ -233,7 +235,7 @@
UNIMPLEMENTED();
}
-fd_t OpenFile(const char *filename, bool write) {
+uptr OpenFile(const char *filename, bool write) {
UNIMPLEMENTED();
}
@@ -253,15 +255,15 @@
return ret;
}
-int internal_stat(const char *path, void *buf) {
+uptr internal_stat(const char *path, void *buf) {
UNIMPLEMENTED();
}
-int internal_lstat(const char *path, void *buf) {
+uptr internal_lstat(const char *path, void *buf) {
UNIMPLEMENTED();
}
-int internal_fstat(fd_t fd, void *buf) {
+uptr internal_fstat(fd_t fd, void *buf) {
UNIMPLEMENTED();
}
@@ -269,7 +271,7 @@
UNIMPLEMENTED();
}
-int internal_dup2(int oldfd, int newfd) {
+uptr internal_dup2(int oldfd, int newfd) {
UNIMPLEMENTED();
}
@@ -277,7 +279,7 @@
UNIMPLEMENTED();
}
-int internal_sched_yield() {
+uptr internal_sched_yield() {
Sleep(0);
return 0;
}