am 8a6abe38: am bd014c2e: Merge "Remove some dead script code and fix a script comment."

* commit '8a6abe380d2ba513bb714e54a74f4289089cbc18':
  Remove some dead script code and fix a script comment.
This commit is contained in:
Elliott Hughes 2013-03-25 14:36:24 -07:00 committed by Android Git Automerger
commit da2c158645
2 changed files with 1 additions and 114 deletions

View File

@ -72,117 +72,6 @@ def find_file_from_upwards(from_path,target_file):
path = os.path.dirname(path)
def find_bionic_root():
file = find_file_from_upwards(None, "SYSCALLS.TXT")
if file:
return os.path.dirname(file)
else:
return None
def find_kernel_headers():
"""try to find the directory containing the kernel headers for this machine"""
status, version = commands.getstatusoutput( "uname -r" ) # get Linux kernel version
if status != 0:
D("could not execute 'uname -r' command properly")
return None
# get rid of the "-xenU" suffix that is found in Xen virtual machines
if len(version) > 5 and version[-5:] == "-xenU":
version = version[:-5]
path = "/usr/src/linux-headers-" + version
D("probing %s for kernel headers" % (path+"/include"))
ret = os.path.isdir( path )
if ret:
D("found kernel headers in: %s" % (path + "/include"))
return path
return None
# parser for the SYSCALLS.TXT file
#
class SysCallsTxtParser:
def __init__(self):
self.syscalls = []
self.lineno = 0
def E(msg):
print "%d: %s" % (self.lineno, msg)
def parse_line(self, line):
pos_lparen = line.find('(')
E = self.E
if pos_lparen < 0:
E("missing left parenthesis in '%s'" % line)
return
pos_rparen = line.rfind(')')
if pos_rparen < 0 or pos_rparen <= pos_lparen:
E("missing or misplaced right parenthesis in '%s'" % line)
return
return_type = line[:pos_lparen].strip().split()
if len(return_type) < 2:
E("missing return type in '%s'" % line)
return
syscall_func = return_type[-1]
return_type = string.join(return_type[:-1],' ')
pos_colon = syscall_func.find(':')
if pos_colon < 0:
syscall_name = syscall_func
else:
if pos_colon == 0 or pos_colon+1 >= len(syscall_func):
E("misplaced colon in '%s'" % line)
return
syscall_name = syscall_func[pos_colon+1:]
syscall_func = syscall_func[:pos_colon]
if pos_rparen > pos_lparen+1:
syscall_params = line[pos_lparen+1:pos_rparen].split(',')
params = string.join(syscall_params,',')
else:
syscall_params = []
params = "void"
number = line[pos_rparen+1:].strip()
if number == "stub":
syscall_id = -1
syscall_id2 = -1
else:
try:
if number[0] == '#':
number = number[1:].strip()
numbers = string.split(number,',')
syscall_id = int(numbers[0])
syscall_id2 = syscall_id
if len(numbers) > 1:
syscall_id2 = int(numbers[1])
except:
E("invalid syscall number in '%s'" % line)
return
t = { "id" : syscall_id,
"id2" : syscall_id2,
"name" : syscall_name,
"func" : syscall_func,
"params" : syscall_params,
"decl" : "%-15s %s (%s);" % (return_type, syscall_func, params) }
self.syscalls.append(t)
def parse_file(self, file_path):
fp = open(file_path)
for line in fp.xreadlines():
self.lineno += 1
line = line.strip()
if not line: continue
if line[0] == '#': continue
self.parse_line(line)
fp.close()
class StringOutput:
def __init__(self):

View File

@ -5,7 +5,7 @@ import sys, os, string, re
def usage():
print """\
usage: genserv < /etc/services > netbsd/net/services.h
usage: genserv < /etc/services > libc/netbsd/net/services.h
this program is used to generate the hard-coded internet service list for the
Bionic C library.
@ -72,5 +72,3 @@ for s in services:
line += str(s)+"\\\n"
line += '\\0";\n'
print line