From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/14498 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] Add gettid and tgkill syscall wrappers. Date: Fri, 2 Aug 2019 23:46:25 +0200 Message-ID: <20190802214625.GC22009@port70.net> References: <20190802202516.GI9017@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="227865"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.10.1 (2018-07-13) To: musl@lists.openwall.com Original-X-From: musl-return-14514-gllmg-musl=m.gmane.org@lists.openwall.com Fri Aug 02 23:46:40 2019 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.89) (envelope-from ) id 1htfNo-000x9w-4e for gllmg-musl@m.gmane.org; Fri, 02 Aug 2019 23:46:40 +0200 Original-Received: (qmail 15441 invoked by uid 550); 2 Aug 2019 21:46:37 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 15423 invoked from network); 2 Aug 2019 21:46:37 -0000 Mail-Followup-To: musl@lists.openwall.com Content-Disposition: inline In-Reply-To: <20190802202516.GI9017@brightrain.aerifal.cx> Xref: news.gmane.org gmane.linux.lib.musl.general:14498 Archived-At: * Rich Felker [2019-08-02 16:25:16 -0400]: > On Thu, Aug 01, 2019 at 04:31:11PM -0400, James Y Knight wrote: > > +++ b/src/linux/tgkill.c > > @@ -0,0 +1,8 @@ > > +#define _GNU_SOURCE > > +#include > > +#include "syscall.h" > > + > > +int tgkill(pid_t pid, pid_t tid, int sig) > > +{ > > + return syscall(SYS_tgkill, pid, tid, sig); > > +} > > -- > > 2.22.0.770.g0f2c4a37fd-goog > > Is pid_t the right type for this? Fundamentally the futex interface > imposes a requirement that tids fit in 29 bits of int. pid_t *is* int > anyway, but it's more a matter of figuring out what the right semantic > type for this is. https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/bits/signal_ext.h > I also question whether tgkill should be a supported API. The idea of > being able to address threads of other processes is dubious. Before we > start adding these, I think we should think about which ones make > sense as APIs that applications can safely use. i think the idea is that there will be thin wrappers for linux syscalls even if they may be misused. > Also, pthread_gettid_np or something like that is probably important > to being able to use any interfaces involving tids; otherwise you can > only address yourself without explicit communication with a thread to > query its tid. i dont think glibc has such api now. > Is there a list of which interfaces glibc will be adding and their > rationale? not that i know of, the apis are added one by one with separate reviews. https://sourceware.org/glibc/wiki/Consensus#WIP:_Kernel_syscalls_wrappers