rune/libenclave: Work around nanosleep() issue
nanosleep() may return the remaining duration longer than
requested one due to timer slack.
package enclave_runtime_pal // import "github.com/opencontainers/runc/libenclave/internal/runtime/pal"
+/*
+#include <sys/prctl.h>
+
+static void workaround_nanosleep(void) {
+ // nanosleep() may return the remaining duration longer than
+ // requested one due to timer slack.
+ prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0);
+}
+*/
import "C"
import (
@@ -26,6 +35,8 @@ func (pal *enclaveRuntimePal) Init(args string, logLevel string) error {
}
pal.version = ver
+ C.workaround_nanosleep();
+
return api.init(args, logLevel)
}
