Module Name: src Committed By: christos Date: Sat Jun 11 13:39:26 UTC 2016
Modified Files: src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common: sanitizer_linux.cc sanitizer_syscall_generic.inc Log Message: More fixed from Rin Okuyama fix waitpid, getdents, explain ptrace, cleanup redefinitions To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 \ src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc cvs rdiff -u -r1.3 -r1.4 \ src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_syscall_generic.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc diff -u src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc:1.5 src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc:1.6 --- src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc:1.5 Thu Jun 9 10:37:06 2016 +++ src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc Sat Jun 11 09:39:26 2016 @@ -56,6 +56,7 @@ extern "C" { extern char **environ; // provided by crt1 #endif // SANITIZER_FREEBSD #if SANITIZER_NETBSD +#include <limits.h> // For NAME_MAX #include <sys/sysctl.h> extern char **environ; // provided by crt1 #endif // SANITIZER_NETBSD @@ -494,6 +495,17 @@ void BlockingMutex::CheckLocked() { // The actual size of this structure is specified by d_reclen. // Note that getdents64 uses a different structure format. We only provide the // 32-bit syscall here. +#if SANITIZER_NETBSD +// struct dirent is different for Linux and us. At this moment, we use only +// d_fileno (Linux call this d_ino), d_reclen, and d_name. +struct linux_dirent { + u64 d_ino; // d_fileno + u16 d_reclen; + u16 d_namlen; // not used + u8 d_type; // not used + char d_name[NAME_MAX + 1]; +}; +#else struct linux_dirent { #if SANITIZER_X32 u64 d_ino; @@ -505,10 +517,18 @@ struct linux_dirent { unsigned short d_reclen; char d_name[256]; }; +#endif // Syscall wrappers. uptr internal_ptrace(int request, int pid, void *addr, void *data) { #if SANITIZER_NETBSD +// XXX We need additional work for ptrace: +// - for request, we use PT_FOO whereas Linux uses PTRACE_FOO +// - data is int for us, but void * for Linux +// - Linux sometimes uses data in the case where we use addr instead +// At this moment, this function is used only within +// "#if SANITIZER_LINUX && defined(__x86_64__)" block in +// sanitizer_stoptheworld_linux_libcdep.cc. return internal_syscall_ptr(SYSCALL(ptrace), request, pid, (uptr)addr, (uptr)data); #else @@ -518,8 +538,13 @@ uptr internal_ptrace(int request, int pi } uptr internal_waitpid(int pid, int *status, int options) { ++#if SANITIZER_NETBSD + return internal_syscall(SYSCALL(wait4), pid, status, options, + NULL /* rusage */); +#else return internal_syscall(SYSCALL(wait4), pid, (uptr)status, options, 0 /* rusage */); +#endif } uptr internal_getpid() { Index: src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_syscall_generic.inc diff -u src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_syscall_generic.inc:1.3 src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_syscall_generic.inc:1.4 --- src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_syscall_generic.inc:1.3 Thu Jun 9 10:37:06 2016 +++ src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_syscall_generic.inc Sat Jun 11 09:39:26 2016 @@ -38,9 +38,7 @@ # else # define internal_syscall_ptr syscall # endif -#endif - -#if (SANITIZER_FREEBSD && defined(__x86_64__)) +#elif (SANITIZER_FREEBSD && defined(__x86_64__)) # define internal_syscall __syscall # else # define internal_syscall syscall