[compiler-rt] r269296 - Fixup for r269288. SleepForSeconds is not available in nolibc builds, let's add an internal_sleep.

Kuba Brecka via llvm-commits llvm-commits at lists.llvm.org
Thu May 12 07:08:56 PDT 2016


Author: kuba.brecka
Date: Thu May 12 09:08:56 2016
New Revision: 269296

URL: http://llvm.org/viewvc/llvm-project?rev=269296&view=rev
Log:
Fixup for r269288.  SleepForSeconds is not available in nolibc builds, let's add an internal_sleep.


Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_nolibc.cc
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.h
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_nolibc.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_nolibc.cc?rev=269296&r1=269295&r2=269296&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_nolibc.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_nolibc.cc Thu May 12 09:08:56 2016
@@ -23,5 +23,6 @@ void LogMessageOnPrintf(const char *str)
 #endif
 void WriteToSyslog(const char *buffer) {}
 void Abort() { internal__exit(1); }
+void SleepForSeconds(int seconds) { internal_sleep(seconds); }
 
 }  // namespace __sanitizer

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.h?rev=269296&r1=269295&r2=269296&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.h Thu May 12 09:08:56 2016
@@ -70,6 +70,7 @@ uptr internal_ftruncate(fd_t fd, uptr si
 
 // OS
 void NORETURN internal__exit(int exitcode);
+unsigned int internal_sleep(unsigned int seconds);
 
 uptr internal_getpid();
 uptr internal_getppid();

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc?rev=269296&r1=269295&r2=269296&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc Thu May 12 09:08:56 2016
@@ -336,6 +336,15 @@ void internal__exit(int exitcode) {
   Die();  // Unreachable.
 }
 
+unsigned int internal_sleep(unsigned int seconds) {
+  struct timespec ts;
+  ts.tv_sec = 1;
+  ts.tv_nsec = 0;
+  int res = internal_syscall(SYSCALL(nanosleep), &ts, &ts);
+  if (res) return ts.tv_sec;
+  return 0;
+}
+
 uptr internal_execve(const char *filename, char *const argv[],
                      char *const envp[]) {
   return internal_syscall(SYSCALL(execve), (uptr)filename, (uptr)argv,

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc?rev=269296&r1=269295&r2=269296&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc Thu May 12 09:08:56 2016
@@ -161,6 +161,10 @@ void internal__exit(int exitcode) {
   _exit(exitcode);
 }
 
+unsigned int internal_sleep(unsigned int seconds) {
+  sleep(seconds);
+}
+
 uptr internal_getpid() {
   return getpid();
 }




More information about the llvm-commits mailing list