[PATCH 2/5] nptl: Add __pthread_kill_self

Florian Weimer fweimer@redhat.com
Fri Aug 29 20:26:37 GMT 2025


* Adhemerval Zanella:

> +int
> +__pthread_kill_self (int signo)
> +{
> +  /* Use the actual TID from the kernel, so that it refers to the
> +     current thread even if called after vfork.  There is no
> +     signal blocking in this case, so that the signal is delivered
> +     immediately, before __pthread_kill_internal returns: a signal
> +     sent to the thread itself needs to be delivered
> +     synchronously.  (It is unclear if Linux guarantees the
> +     delivery of all pending signals after unblocking in the code
> +     below.  POSIX only guarantees delivery of a single signal,
> +     which may not be the right one.)  */
> +  pid_t tid = INTERNAL_SYSCALL_CALL (gettid);
> +  pid_t pid = INTERNAL_SYSCALL_CALL (getpid);
> +  int ret = INTERNAL_SYSCALL_CALL (tgkill, pid, tid, signo);
> +  return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;
> +}

Part of the comment makes not much sense in the new context.

This could be called __raise_nostatus or something like that.

Thanks,
Florian



More information about the Libc-alpha mailing list