summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimur Iskhodzhanov <timurrrr@google.com>2015-04-09 12:54:06 +0000
committerTimur Iskhodzhanov <timurrrr@google.com>2015-04-09 12:54:06 +0000
commit2b3479961bb23534edc5a39b57df0bb41f79a3a5 (patch)
treedd2e958125923eb8bfe2fa23f8361768b531a17c
parentc1a3f0c3fccdd273ddb1a303f3d6f88a6aafa298 (diff)
Move more POSIX-specific functions to sanitizer_posix.h
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@234482 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/sanitizer_common/sanitizer_libc.h8
-rw-r--r--lib/sanitizer_common/sanitizer_libignore.cc1
-rw-r--r--lib/sanitizer_common/sanitizer_posix.h11
-rw-r--r--lib/sanitizer_common/sanitizer_win.cc24
-rw-r--r--lib/sanitizer_common/tests/sanitizer_libc_test.cc1
5 files changed, 13 insertions, 32 deletions
diff --git a/lib/sanitizer_common/sanitizer_libc.h b/lib/sanitizer_common/sanitizer_libc.h
index edd92fef4..8921fc0bd 100644
--- a/lib/sanitizer_common/sanitizer_libc.h
+++ b/lib/sanitizer_common/sanitizer_libc.h
@@ -68,16 +68,8 @@ uptr internal_write(fd_t fd, const void *buf, uptr count);
uptr internal_ftruncate(fd_t fd, uptr size);
// OS
-uptr internal_filesize(fd_t fd); // -1 on error.
-uptr internal_stat(const char *path, void *buf);
-uptr internal_lstat(const char *path, void *buf);
-uptr internal_fstat(fd_t fd, void *buf);
-uptr internal_dup2(int oldfd, int newfd);
-uptr internal_readlink(const char *path, char *buf, uptr bufsize);
-uptr internal_unlink(const char *path);
uptr internal_rename(const char *oldpath, const char *newpath);
void NORETURN internal__exit(int exitcode);
-uptr internal_lseek(fd_t fd, OFF_T offset, int whence);
uptr internal_getpid();
uptr internal_getppid();
diff --git a/lib/sanitizer_common/sanitizer_libignore.cc b/lib/sanitizer_common/sanitizer_libignore.cc
index cefb1dc97..8c4aeffda 100644
--- a/lib/sanitizer_common/sanitizer_libignore.cc
+++ b/lib/sanitizer_common/sanitizer_libignore.cc
@@ -12,6 +12,7 @@
#include "sanitizer_libignore.h"
#include "sanitizer_flags.h"
+#include "sanitizer_posix.h"
#include "sanitizer_procmaps.h"
namespace __sanitizer {
diff --git a/lib/sanitizer_common/sanitizer_posix.h b/lib/sanitizer_common/sanitizer_posix.h
index 63d5f9e33..fe2e40da2 100644
--- a/lib/sanitizer_common/sanitizer_posix.h
+++ b/lib/sanitizer_common/sanitizer_posix.h
@@ -35,8 +35,19 @@ uptr internal_mmap(void *addr, uptr length, int prot, int flags,
int fd, u64 offset);
uptr internal_munmap(void *addr, uptr length);
+// OS
+uptr internal_filesize(fd_t fd); // -1 on error.
+uptr internal_stat(const char *path, void *buf);
+uptr internal_lstat(const char *path, void *buf);
+uptr internal_fstat(fd_t fd, void *buf);
+uptr internal_dup2(int oldfd, int newfd);
+uptr internal_readlink(const char *path, char *buf, uptr bufsize);
+uptr internal_unlink(const char *path);
+uptr internal_lseek(fd_t fd, OFF_T offset, int whence);
+
uptr internal_ptrace(int request, int pid, void *addr, void *data);
uptr internal_waitpid(int pid, int *status, int options);
+
int internal_fork();
// These functions call appropriate pthread_ functions directly, bypassing
diff --git a/lib/sanitizer_common/sanitizer_win.cc b/lib/sanitizer_common/sanitizer_win.cc
index 7f1b9340b..ec47555af 100644
--- a/lib/sanitizer_common/sanitizer_win.cc
+++ b/lib/sanitizer_common/sanitizer_win.cc
@@ -459,30 +459,6 @@ uptr internal_write(fd_t fd, const void *buf, uptr count) {
return 0;
}
-uptr internal_stat(const char *path, void *buf) {
- UNIMPLEMENTED();
-}
-
-uptr internal_lstat(const char *path, void *buf) {
- UNIMPLEMENTED();
-}
-
-uptr internal_fstat(fd_t fd, void *buf) {
- UNIMPLEMENTED();
-}
-
-uptr internal_filesize(fd_t fd) {
- UNIMPLEMENTED();
-}
-
-uptr internal_dup2(int oldfd, int newfd) {
- UNIMPLEMENTED();
-}
-
-uptr internal_readlink(const char *path, char *buf, uptr bufsize) {
- UNIMPLEMENTED();
-}
-
uptr internal_sched_yield() {
Sleep(0);
return 0;
diff --git a/lib/sanitizer_common/tests/sanitizer_libc_test.cc b/lib/sanitizer_common/tests/sanitizer_libc_test.cc
index 14b63fc6c..3252db776 100644
--- a/lib/sanitizer_common/tests/sanitizer_libc_test.cc
+++ b/lib/sanitizer_common/tests/sanitizer_libc_test.cc
@@ -17,6 +17,7 @@
#if SANITIZER_LINUX || SANITIZER_MAC
# define SANITIZER_TEST_HAS_STAT_H 1
# include <sys/stat.h>
+# include "sanitizer_common/sanitizer_posix.h"
#else
# define SANITIZER_TEST_HAS_STAT_H 0
#endif