[PATCH] <bits/syscall.h>: Use an arch-independent system call list on Linux

Florian Weimer fweimer@redhat.com
Wed Apr 5 19:40:00 GMT 2017


Downstream, we have the problem that we need to deliver our glibc 
packages before the kernel team finishes backporting system calls.  This 
means that the final glibc build before a release does not contain all 
the SYS_* macros supported by the kernel headers.

I would have liked to address this by phasing out the SYS_* macros, but 
this suggestion was not received favorably during a previous discussion.

An ideal solution would generate the SYS_* macros when the glibc 
development package is installed, based on the already-installed kernel 
headers.  Our RPM version does not support delayed script execution, so 
there is significant risk that we end up with a dependency loop, due to 
which the generation step could fail.

So I'm proposing the attached patch as an alternative.  It uses a list 
of system call names and generates a <bits/syscall.h> file from that 
which has items of the form

#ifdef __NR_write
# define SYS_write __NR_write
#endif

The idea is to define only those SYS_ macros which actually exist in the 
kernel headers as __NR_ macros.  Therefore, we only need a single system 
call list across all architectures, and the generated header file is no 
longer architecture-specific, either.  The -dM-based macro extraction 
remains as a (much simplified) test case.  It fails if the kernel 
headers contain __NR_ macros not currently listed in the glibc source tree.

I think the increased predictability of glibc builds might be worth it 
upstream as well.  The cost is that we now have to update the list 
periodically, but that can be done when the kernel version embedded in 
scripts/build-many-glibcs.py is increased.

The included list of system call names is based on the currently 
building build-many-glibcs.py targets (that is, hppa and coldfire are 
missing).  We can easily adjust it once we get more buildable architectures.

Comments?

Thanks,
Florian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: syscalls.patch
Type: text/x-patch
Size: 20682 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20170405/3bde815b/attachment.bin>


More information about the Libc-alpha mailing list