Skip to content

[SystemZ][z/OS] Add guard for SI_USER - #213101

Merged
abhina-sree merged 1 commit into
llvm:mainfrom
abhina-sree:abhina/fix_zos_build
Aug 4, 2026
Merged

[SystemZ][z/OS] Add guard for SI_USER #213101
abhina-sree merged 1 commit into
llvm:mainfrom
abhina-sree:abhina/fix_zos_build

Conversation

@abhina-sree

Copy link
Copy Markdown
Member

SI_USER is not defined on z/OS and is causing the following build failure. This patch adds a guard to check whether SI_USER is defined before using it.

error: use of undeclared identifier 'SI_USER'

@llvmorg-github-actions

Copy link
Copy Markdown

@llvm/pr-subscribers-llvm-support

Author: Abhina Sree (abhina-sree)

Changes

SI_USER is not defined on z/OS and is causing the following build failure. This patch adds a guard to check whether SI_USER is defined before using it.

error: use of undeclared identifier 'SI_USER'


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

1 Files Affected:

  • (modified) llvm/lib/Support/Unix/Signals.inc (+4-1)
diff --git a/llvm/lib/Support/Unix/Signals.inc b/llvm/lib/Support/Unix/Signals.inc
index 69a80839c99d2..9453222cae546 100644
--- a/llvm/lib/Support/Unix/Signals.inc
+++ b/llvm/lib/Support/Unix/Signals.inc
@@ -477,7 +477,10 @@ static void SignalHandler(int Sig, siginfo_t *Info, void *Context) {
 #endif
 
   // Was the signal generated by kill(), sigqueue(), etc?
-  bool ReraiseSignal = Info->si_code == SI_USER || Info->si_code == SI_QUEUE;
+  bool ReraiseSignal = Info->si_code == SI_QUEUE;
+#if defined(SI_USER)
+  ReraiseSignal |= Info->si_code == SI_USER;
+#endif
 #if defined(SI_LWP)
   // _lwp_kill() on BSDs, Solaris/illumos, possibly others.
   ReraiseSignal |= Info->si_code == SI_LWP;

@abhina-sree
abhina-sree requested a review from alexrp July 30, 2026 19:14
@alexrp

alexrp commented Jul 31, 2026

Copy link
Copy Markdown
Member

Fairly unusual for SI_USER to not be defined. In fact, probably not POSIX-compliant. What does z/OS use when you use kill(2) to send a signal?

@abhina-sree

Copy link
Copy Markdown
Member Author

Fairly unusual for SI_USER to not be defined. In fact, probably not POSIX-compliant. What does z/OS use when you use kill(2) to send a signal?

On z/OS, based on the documentation here I think si_code will be less than or equal to zero if the signal was generated by another process. Then si_pid and si_uid will have the process id and user id respectively

@alexrp

alexrp commented Aug 4, 2026

Copy link
Copy Markdown
Member

If the signal came from another process -- i.e. SI_ASYNCIO or si_code <= 0 -- we definitely want to reraise it. Unfortunately that documentation doesn't really clarify what happens in the case of kill(getpid(), sig)...

@abhina-sree

Copy link
Copy Markdown
Member Author

If the signal came from another process -- i.e. SI_ASYNCIO or si_code <= 0 -- we definitely want to reraise it. Unfortunately that documentation doesn't really clarify what happens in the case of kill(getpid(), sig)...

I agree, I'm still working on investigating what the proper fix should be. In the interim, is this patch ok to unblock our build? https://lab.llvm.org/staging/#/builders/237/builds/26

@abhina-sree
abhina-sree merged commit c740c54 into llvm:main Aug 4, 2026
14 checks passed
@abhina-sree
abhina-sree deleted the abhina/fix_zos_build branch August 4, 2026 19:58
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.

2 participants