[PATCH v7 2/5] nptl: Add __raise_direct
Samuel Thibault
samuel.thibault@ens-lyon.org
Tue Mar 31 22:15:35 GMT 2026
Hello,
Florian Weimer, le lun. 02 mars 2026 10:39:07 +0100, a ecrit:
> * Adhemerval Zanella:
>
> > diff --git a/sysdeps/htl/raise.c b/sysdeps/htl/raise.c
> > index 3200f91634..9c8bccc5a9 100644
> > --- a/sysdeps/htl/raise.c
> > +++ b/sysdeps/htl/raise.c
> > @@ -51,6 +51,9 @@ raise (int signo)
> > else
> > return __kill (__getpid (), signo);
> > }
> > +/* TODO: __raise_direct should not change errno and work during process
> > + startup. */
> > +weak_alias (raise, __raise_direct)
>
> Sam, Guy, could you help with this?
This should be doing it:
diff --git a/include/signal.h b/include/signal.h
index 73f18dddd7..9c85e5bc84 100644
--- a/include/signal.h
+++ b/include/signal.h
@@ -21,6 +21,8 @@ extern const char * const __sys_sigabbrev[_NSIG] attribute_hidden;
extern __sighandler_t __bsd_signal (int __sig, __sighandler_t __handler);
extern int __kill (__pid_t __pid, int __sig);
libc_hidden_proto (__kill)
+/* Similar to kill, but does not set errno. */
+extern int __kill_direct (__pid_t __pid, int __sig) attribute_hidden;
extern int __sigaction (int __sig, const struct sigaction *__restrict __act,
struct sigaction *__restrict __oact);
libc_hidden_proto (__sigaction)
@@ -65,6 +67,9 @@ extern int __xpg_sigpause (int sig);
/* Allocate real-time signal with highest/lowest available priority. */
extern int __libc_allocate_rtsig (int __high);
+/* Similar to raise, but does not set errno. */
+extern int __raise_direct (int signo) attribute_hidden;
+
# if IS_IN (rtld)
extern __typeof (__sigaction) __sigaction attribute_hidden;
extern __typeof (__libc_sigaction) __libc_sigaction attribute_hidden;
diff --git a/sysdeps/htl/raise.c b/sysdeps/htl/raise.c
index 3200f91634..7e0d2d09ee 100644
--- a/sysdeps/htl/raise.c
+++ b/sysdeps/htl/raise.c
@@ -54,3 +54,9 @@ raise (int signo)
libc_hidden_def (raise)
weak_alias (raise, gsignal)
+
+int
+__raise_direct (int signo)
+{
+ return __kill_direct (__getpid (), signo);
+}
diff --git a/sysdeps/mach/hurd/kill.c b/sysdeps/mach/hurd/kill.c
index 630a87243b..e29662004c 100644
--- a/sysdeps/mach/hurd/kill.c
+++ b/sysdeps/mach/hurd/kill.c
@@ -29,7 +29,7 @@
send SIG to all processes in the current process's process group.
If PID is < -1, send SIG to all processes in process group - PID. */
int
-__kill (pid_t pid, int sig)
+__kill_direct (pid_t pid, int sig)
{
int delivered = 0; /* Set when we deliver any signal. */
error_t err;
@@ -153,7 +153,13 @@ __kill (pid_t pid, int sig)
every kill_pid call failed with ESRCH, meaning all the processes in
the pgrp died between proc_getpgrppids and kill_pid; in that case we
fail with ESRCH. */
- return delivered ? 0 : __hurd_fail (err ?: ESRCH);
+ return delivered ? 0 : (err ?: ESRCH);
+}
+
+int
+__kill (pid_t pid, int sig)
+{
+ return __hurd_fail (__kill_direct (pid, sig));
}
libc_hidden_def (__kill)
More information about the Libc-alpha
mailing list