Stop generating <sys/linux-syscalls.h>.

The <asm/unistd.h> files contain the canonical data, and
<sys/glibc-syscalls.h> contain new glibc-compatible names,
and if you #include the standard <sys/syscall.h> you get
both sets of names.

Change-Id: I9919c080931c0ba1660f5e37c6a6265ea716d603
This commit is contained in:
Elliott Hughes
2013-03-22 18:56:24 -07:00
parent c019345a3a
commit 1b91c6c11f
2 changed files with 5 additions and 536 deletions

View File

@@ -311,10 +311,8 @@ class State:
t["asm-mips"] = self.mips_genstub(syscall_func, make__NR_name(syscall_name))
def gen_NR_syscall(self, linux_fp, name, id):
linux_fp.write("#define %-30s (__NR_SYSCALL_BASE + %d)\n" % (make__NR_name(name),id))
# Scan a Linux kernel asm/unistd.h file containing __NR_* constants
# and write out equivalent SYS_* constants for glibc source compatibility.
def scan_linux_unistd_h(self, fp, path):
pattern = re.compile(r'^#define __NR_([a-z]\S+) .*')
syscalls = set() # MIPS defines everything three times; work around that.
@@ -326,9 +324,10 @@ class State:
fp.write("#define SYS_%s %s\n" % (syscall, make__NR_name(syscall)))
def gen_linux_syscalls_h(self):
def gen_glibc_syscalls_h(self):
# TODO: generate a separate file for each architecture, like glibc's bits/syscall.h.
glibc_syscalls_h_path = "include/sys/glibc-syscalls.h"
D("generating " + glibc_syscalls_h_path)
glibc_fp = create_file(glibc_syscalls_h_path)
glibc_fp.write("/* Auto-generated by gensyscalls.py; do not edit. */\n")
glibc_fp.write("#ifndef _BIONIC_GLIBC_SYSCALLS_H_\n")
@@ -346,62 +345,6 @@ class State:
glibc_fp.close()
self.other_files.append(glibc_syscalls_h_path)
# TODO: stop generating this. it's useless.
linux_syscalls_h_path = "include/sys/linux-syscalls.h"
D("generating " + linux_syscalls_h_path)
fp = create_file(linux_syscalls_h_path)
fp.write( "/* Auto-generated by gensyscalls.py; do not edit. */\n" )
fp.write( "#ifndef _BIONIC_LINUX_SYSCALLS_H_\n" )
fp.write( "#define _BIONIC_LINUX_SYSCALLS_H_\n\n" )
fp.write( "#if !defined __ASM_ARM_UNISTD_H && !defined __ASM_I386_UNISTD_H && !defined __ASM_MIPS_UNISTD_H\n" )
fp.write( "#if defined(__mips__)\n" )
fp.write( " # define __NR_SYSCALL_BASE 4000\n" )
fp.write( "#else\n" )
fp.write( " # define __NR_SYSCALL_BASE 0\n" )
fp.write( "#endif\n\n" )
# first, all common syscalls
for sc in sorted(self.syscalls,key=lambda x:x["common"]):
sc_id = sc["common"]
sc_name = sc["name"]
if sc_id >= 0:
self.gen_NR_syscall(fp, sc_name, sc_id)
# now, all arm-specific syscalls
fp.write("\n#ifdef __arm__\n")
for sc in self.syscalls:
sc_id = sc["armid"]
sc_name = sc["name"]
if sc_id >= 0:
self.gen_NR_syscall(fp, sc_name, sc_id)
fp.write("#endif\n")
gen_syscalls = {}
# all i386-specific syscalls
fp.write("\n#ifdef __i386__\n")
for sc in sorted(self.syscalls,key=lambda x:x["x86id"]):
sc_id = sc["x86id"]
sc_name = sc["name"]
if sc_id >= 0 and sc_name not in gen_syscalls:
self.gen_NR_syscall(fp, sc_name, sc_id)
gen_syscalls[sc_name] = True
fp.write("#endif\n")
# all mips-specific syscalls
fp.write("\n#ifdef __mips__\n")
for sc in sorted(self.syscalls,key=lambda x:x["mipsid"]):
sc_id = sc["mipsid"]
if sc_id >= 0:
self.gen_NR_syscall(fp, sc["name"], sc_id)
fp.write( "#endif\n" );
fp.write( "\n#endif\n" )
fp.write( "\n#endif /* _BIONIC_LINUX_SYSCALLS_H_ */\n" );
fp.close()
self.other_files.append(linux_syscalls_h_path)
# now dump the contents of syscalls.mk
def gen_arch_syscalls_mk(self, arch):
@@ -471,7 +414,7 @@ class State:
D( "re-generating stubs and support files" )
self.gen_linux_syscalls_h()
self.gen_glibc_syscalls_h()
for arch in all_archs:
self.gen_arch_syscalls_mk(arch)
self.gen_syscall_stubs()