*syscalls

This commit is contained in:
Costa Shulyupin 2018-07-26 08:31:32 +03:00
parent 0f52b7263c
commit 731f7acc93
1 changed files with 23 additions and 9 deletions

View File

@ -310,8 +310,10 @@ def syscalls():
if not os.path.isfile(scd): if not os.path.isfile(scd):
os.system("grep SYSCALL_DEFINE -r --include='*.c' > " + scd) os.system("grep SYSCALL_DEFINE -r --include='*.c' > " + scd)
with open(scd, 'r') as f: with open(scd, 'r') as f:
v = set() v = set('sigsuspend', 'llseek', 'sysfs', 'sync_file_range2', 'ustat', 'bdflush')
for s in f: for s in f:
if any(x in s.lower() for x in ['compat', 'stub']):
continue
m = re.match(r'(.*?):.*SYSCALL.*\(([\w]+)', s) m = re.match(r'(.*?):.*SYSCALL.*\(([\w]+)', s)
if m: if m:
for p in { for p in {
@ -327,18 +329,30 @@ def syscalls():
if m: if m:
syscall = m.group(2) syscall = m.group(2)
syscall = re.sub('^new', '', syscall) syscall = re.sub('^new', '', syscall)
if 'compat' in m.group(1):
continue
if syscall in v or 'compat' in m.group(1):
continue
v.add(syscall)
path = m.group(1).split('/') path = m.group(1).split('/')
if (m.group(1).startswith('arch/') if (m.group(1).startswith('mm/nommu.c')
or m.group(1).startswith('arch/x86/ia32')
or m.group(1).startswith('arch/')
or syscall.startswith('vm86')
and not m.group(1).startswith('arch/x86')): and not m.group(1).startswith('arch/x86')):
continue continue
if syscall in v:
continue
v.add(syscall)
p2 = '/'.join(path[1:]) p2 = '/'.join(path[1:])
sc.add_edge(path[0] + '/', p2) p2 = m.group(1)
sc.add_edge(p2, syscall) # if log(difflib.get_close_matches(syscall,v) or ''):
# log(syscall)
# log(syscall + ' ' + (includes.get(syscall) or '------'))
# man -s 2 timerfd_settime | head -n 20
# sc.add_edge('syscalls', path[0] + '/')
# sc.add_edge(path[0] + '/', p2)
# sc.add_edge(p2, syscall)
i = includes(syscall)
log(p2 + ' ' + str(i) + ' ' + syscall)
sc.add_edge(i, i+' - '+p2)
sc.add_edge(i+' - '+p2, syscall)
# sc.add_edge(includes(syscall), syscall)
return sc return sc