Skip to content

[SystemZ][z/OS] z/OS does not support nanosleep, use usleep instead #109823

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 25, 2024

Conversation

abhina-sree
Copy link
Contributor

Use usleep instead of nanosleep to resolve a build error on z/OS because there is no support for nanosleep.

@llvmbot
Copy link
Member

llvmbot commented Sep 24, 2024

@llvm/pr-subscribers-llvm-support

Author: Abhina Sree (abhina-sree)

Changes

Use usleep instead of nanosleep to resolve a build error on z/OS because there is no support for nanosleep.


Full diff: https://github.com/llvm/llvm-project/pull/109823.diff

1 Files Affected:

  • (modified) llvm/unittests/Support/TimerTest.cpp (+4)
diff --git a/llvm/unittests/Support/TimerTest.cpp b/llvm/unittests/Support/TimerTest.cpp
index 09545eb6939aeb..30f9f132a8d15a 100644
--- a/llvm/unittests/Support/TimerTest.cpp
+++ b/llvm/unittests/Support/TimerTest.cpp
@@ -27,6 +27,10 @@ void SleepMS() {
   struct timespec Interval;
   Interval.tv_sec = 0;
   Interval.tv_nsec = 1000000;
+#if defined(__MVS__)
+  long Microseconds = (Interval.tv_nsec + 999) / 1000;
+  usleep(Microseconds);
+#else
   nanosleep(&Interval, nullptr);
 #endif
 }

Copy link
Contributor

@zibi2 zibi2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do have nanosleep() under std::__ibm.

Note that this change is temporary only until we move up the LE level having this function.

@zibi2
Copy link
Contributor

zibi2 commented Sep 24, 2024

We do have nanosleep() under std::__ibm.

However, this is internal change which eventually will go away.

@zibi2 zibi2 self-requested a review September 24, 2024 17:56
Copy link
Contributor

@zibi2 zibi2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@abhina-sree abhina-sree force-pushed the abhina/zos_no_nanosleep branch from bc5b97c to 310f0b8 Compare September 24, 2024 18:04
@abhina-sree abhina-sree force-pushed the abhina/zos_no_nanosleep branch from 310f0b8 to b696fbe Compare September 24, 2024 18:08
@abhina-sree abhina-sree merged commit 1e67e4b into llvm:main Sep 25, 2024
8 checks passed
@abhina-sree abhina-sree deleted the abhina/zos_no_nanosleep branch September 25, 2024 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants