This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Linux: Add the tgkill function
On 5/14/19 3:34 PM, Florian Weimer wrote:
> * Carlos O'Donell:
>
>>> diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list
>>> index 25424e1399..75a2f23a17 100644
>>> --- a/sysdeps/unix/sysv/linux/syscalls.list
>>> +++ b/sysdeps/unix/sysv/linux/syscalls.list
>>> @@ -111,3 +111,4 @@ memfd_create EXTRA memfd_create i:si memfd_create
>>> pkey_alloc EXTRA pkey_alloc i:ii pkey_alloc
>>> pkey_free EXTRA pkey_free i:i pkey_free
>>> gettid EXTRA gettid Ei: __gettid gettid
>>> +tgkill EXTRA tgkill i:ii __tgkill tgkill
>>
>> The signature for tgkill should be i:iii (missing an 'i').
>
> Oops. This probably worked on x86-64 only. 8-/
No worries. Happy to not be seen as a rubber stamp :-)
>> I'll be honest and admit I never paid attention to the semantic
>> meaning of EXTRA.
>>
>> Why does tgkill have caller EXTRA?
>>
>> As far as I know 'EXTRA' triggers the object to be added to
>> unix-extra-syscalls, whose only effect is to put the syscall into
>> sysdep_routines for subdir misc, and beyond that it isn't clear why
>> it's needed at all (even for all the other syscalls). What does
>> sysdep_routines really provide here?
>
> Oh. There's no stub for tgkill, which is why I think the system call
> has to be to routines somewhere, and EXTRA does that.
>
> Are you satisfied with this explanation?
Yes.
If you don't define EXTRA then the build infrastructure expects that
you will define a stub yourself.
When you define EXTRA the following sequence is executed ($caller == EXTRA).
sysdeps/unix/make-syscalls.sh:
209 case x$srcfile"$callnum" in
210 x--)
211 # Undefined callnum for an extra syscall.
212 if [ x$caller != x- ]; then
213 if [ $noerrno != 0 ]; then
214 echo >&2 "$0: no number for $fileno, no-error syscall ($strong $weak)"
215 exit 2
216 fi
217 echo "unix-stub-syscalls += $strong $weak"
218 fi
219 ;;
If you build glibc with kernel headers that don't define the syscall
number for tgkill you will have strong/weak aliases from tgkill to the
single stub created sysdeps/unix/Makefile (stub-syscalls.c).
In this sense "EXTRA" means "extra syscalls not overriding any other
sysdep implementations"
Thanks.
--
Cheers,
Carlos.