Don't use clock_nanosleep on PASE (mono/mono#15988)
authorCalvin Buckley <calvin@cmpct.info>
Fri, 2 Aug 2019 21:04:50 +0000 (18:04 -0300)
committerAlexander Köplinger <alex.koeplinger@outlook.com>
Fri, 2 Aug 2019 21:04:50 +0000 (23:04 +0200)
* Don't use clock_nanosleep on PASE

PASE exports this AIX syscall so autoconf detects it, but using it
will trigger SIGILL (for unimplemented syscall), which emits a LIC
log entry type of 4700-000F.

* Change ifdef guard for clock_nanosleep in threads

It only used clock_nanosleep on Linux, but enable it for all except
PASE. Android used to be guarded against, but the reasoning was
unknown, so @akoeplinger requested to have that guard removed.

Commit migrated from https://github.com/mono/mono/commit/9ea07610ee4c2879f5d598aa6f34b6df79401047

src/mono/mono/eglib/gdate-unix.c
src/mono/mono/mini/mini-posix.c
src/mono/mono/utils/mono-threads.c

index cdcf226..53f4bbb 100644 (file)
@@ -46,7 +46,7 @@ g_get_current_time (GTimeVal *result)
 void
 g_usleep (gulong microseconds)
 {
-#ifdef HAVE_CLOCK_NANOSLEEP
+#if defined(HAVE_CLOCK_NANOSLEEP) && !defined(__PASE__)
        struct timespec target;
 
        /*
index adcff6b..79e0193 100644 (file)
@@ -579,7 +579,7 @@ clock_init (MonoProfilerSampleMode mode)
         * makes very little sense as we can only use nanosleep () to sleep on
         * real time.
         */
-#ifdef HAVE_CLOCK_NANOSLEEP
+#if defined(HAVE_CLOCK_NANOSLEEP) && !defined(__PASE__)
                struct timespec ts = { 0 };
 
                /*
@@ -619,7 +619,7 @@ clock_get_time_ns (void)
 static void
 clock_sleep_ns_abs (guint64 ns_abs)
 {
-#ifdef HAVE_CLOCK_NANOSLEEP
+#if defined(HAVE_CLOCK_NANOSLEEP) && !defined(__PASE__)
        int ret;
        struct timespec then;
 
index ddce7c4..f2e45d8 100644 (file)
@@ -1678,7 +1678,7 @@ mono_thread_info_sleep (guint32 ms, gboolean *alerted)
                } while (1);
        } else {
                int ret;
-#if defined (__linux__) && !defined(HOST_ANDROID)
+#if defined (HAVE_CLOCK_NANOSLEEP) && !defined(__PASE__)
                struct timespec start, target;
 
                /* Use clock_nanosleep () to prevent time drifting problems when nanosleep () is interrupted by signals */