Skip to content

Commit

Permalink
unix: add PthreadSigmask
Browse files Browse the repository at this point in the history
Add a syscall wrapper for SYS_RT_SIGPROCMASK and export it as PthreadSigmask.
The latter is defined by POSIX and can therefore be implemented by Darwin, etc.
later on.

Follow the approach used by Signalfd of passing _C__NSIG/8 as sigsetsize. This
avoids exporting _C__NSIG and allows the syscall to work with the current
definition of Sigset_t, which doesn't match the kernel definition of Sigset_t.

Updates golang/go#55349
  • Loading branch information
lmb committed Sep 26, 2022
1 parent fb04ddd commit beb6663
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
7 changes: 6 additions & 1 deletion unix/syscall_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -2368,6 +2368,12 @@ func Setitimer(which ItimerWhich, it Itimerval) (Itimerval, error) {
return prev, nil
}

//sysnb rtSigprocmask(how int, set *Sigset_t, oldset *Sigset_t, sigsetsize uintptr) (err error) = SYS_RT_SIGPROCMASK

func PthreadSigmask(how int, set, oldset *Sigset_t) error {
return rtSigprocmask(how, set, oldset, _C__NSIG/8)
}

/*
* Unimplemented
*/
Expand Down Expand Up @@ -2426,7 +2432,6 @@ func Setitimer(which ItimerWhich, it Itimerval) (Itimerval, error) {
// RestartSyscall
// RtSigaction
// RtSigpending
// RtSigprocmask
// RtSigqueueinfo
// RtSigreturn
// RtSigsuspend
Expand Down
10 changes: 10 additions & 0 deletions unix/zsyscall_linux.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit beb6663

Please sign in to comment.