Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kernel 4.x #1

Open
wants to merge 39 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
faa0e24
working on 3.X port
paolostivanin Apr 13, 2014
0b10d83
CHANGELOG:
paolostivanin Apr 15, 2014
f5f1934
updated readme
paolostivanin Apr 15, 2014
73702b8
Update index.html
polslinux Apr 16, 2014
4e00d3e
updated to kernel version 3.15.1
paolostivanin Jun 25, 2014
d34bf5b
updated to Linux kernel v3.16.0
paolostivanin Aug 4, 2014
99ffc11
CHANGELOG:
paolostivanin Oct 14, 2014
5797a75
updated to linux 4.0.2
paolostivanin May 10, 2015
1bdcc08
syscall updated to match kernel version 4.1.1
paolostivanin Jul 5, 2015
685f1c2
small changes
paolostivanin Jul 5, 2015
95aaeca
v4.1.2
paolostivanin Jul 11, 2015
cd6405c
reverted
paolostivanin Jul 11, 2015
90838b4
update
paolostivanin Jul 11, 2015
dbbfe58
small fix
paolostivanin Aug 15, 2015
9734a54
updated to v4.2
paolostivanin Sep 16, 2015
c6ceb5a
updated to v4.2
paolostivanin Sep 16, 2015
2443c6a
from 10 to 20
paolostivanin Nov 15, 2015
29a773e
from 10 to 20
paolostivanin Nov 15, 2015
083fc91
from 10 to 20
paolostivanin Nov 15, 2015
4936278
kernel 4.4.2
paolostivanin Feb 22, 2016
de91da7
Update index.html
paolostivanin Aug 26, 2016
e095171
Update index.html
paolostivanin Aug 26, 2016
561be3a
Update README.md
paolostivanin Aug 26, 2016
23254df
Update README.md
paolostivanin Aug 26, 2016
3ebe49c
Update prepare-files.sh
paolostivanin Aug 26, 2016
2a229ef
Add files via upload
paolostivanin Aug 26, 2016
c520311
kernel 4.7
paolostivanin Sep 18, 2016
4005f68
small fix
paolostivanin Sep 18, 2016
0e711e7
fixes
paolostivanin Sep 18, 2016
a2b4f5d
fixes
paolostivanin Sep 18, 2016
f732056
change site subdomain
paolostivanin Sep 18, 2016
6534ca8
update
paolostivanin Sep 18, 2016
76073fb
updates
paolostivanin Sep 18, 2016
326807e
Missing curly bracket
faissaloo Jan 13, 2017
117ceb1
Merge pull request #1 from faissaloo/patch-1
paolostivanin Jan 14, 2017
42a3bee
kernel 4.10
paolostivanin Feb 22, 2017
3c127f2
fix
paolostivanin Feb 22, 2017
c02d537
fix
paolostivanin Feb 22, 2017
e346d7f
update to linux v4.14
paolostivanin Jan 21, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions .gitignore

This file was deleted.

30 changes: 13 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
# syscall-table

Generate JSON system call table from Linux source. Hosted at http://syscalls.kernelgrok.com.
# syscall-table (32-bit)
Generate JSON system call table from Linux source. Hosted at https://syscalls32.paolostivanin.com.

## Generating JSON
```
$ brew install ctags
$ easy_install python-ctags simplejson
$ tar -zxvf linux-2.6.35.4.tar.gz
$ cd linux-2.6.35.4
$ ctags --fields=afmikKlnsStz --c-kinds=+pc -R
```
:coffee: or :beer:
```
$ python ../gen_syscalls.py > ../www/syscalls-2.6.35.4.json
```
* Install ctags (http://ctags.sourceforge.net)
* `easy_install python-ctags simplejson`
* Download and extract the Linux kernel sources (https://www.kernel.org)
* Move the extraced folder to `/usr/src/linux-$VERSION`
* `chmod +x prepare-files.sh && ./prepare-files.sh`
* :coffee: or :beer:

## Web
* uses [jQuery DataTables](http://datatables.net/) to pull JSON file and format table
* links to http://lxr.free-electrons.com for source cross-reference and http://www.kernel.org for manpages
* `www` dir checked into gh-pages branch w/ JSON file using `deploy.sh`

## Other
* only tested on 2.6 kernel versions, needs to be updated
* largely unmaintained, feel free to open a PR and help out!
## Kernel version
Generated from Linux kernel 4.14

## Contributors
* Paolo Stivanin (https://github.com/paolostivanin)
134 changes: 63 additions & 71 deletions gen_syscalls.py
Original file line number Diff line number Diff line change
@@ -1,86 +1,78 @@
#!/usr/bin/env python2

import ctags, re, simplejson, sys, os
from ctags import CTags, TagEntry

# file generated by ctags --fields=afmikKlnsStz --c-kinds=+pc -R
tags = CTags('tags')
entry = TagEntry()

sct_file = open('arch/x86/kernel/syscall_table_32.S', 'r')
sct_file = open('syscall_32.tbl', 'r')

sys_calls = []
i = 0

for line in sct_file:
name = re.search(".long (\w*)", line)
if(name):
name = name.group(1)
is_ptregs = False
if(name == "sys_ni_syscall"):
sys_calls.append([i, "not implemented", "", "%0#4x"%(i), "", "", "", "", "", "", ""])
i += 1
continue
# take care of ptregs
elif(name.find('ptregs_') == 0):
name = name.replace("ptregs_", "sys_")
is_ptregs = True
if tags.find(entry, name, ctags.TAG_FULLMATCH | ctags.TAG_OBSERVECASE):
found_sym = False
while(not found_sym):
if(entry['kind'] == 'prototype'):
found_sym = True
details = [i, name, entry['signature']]
if(entry['signature'] != "(void)"):
sig = entry['signature'].strip('()').split(',')
else:
sig = [];
regs = {};
details.append("%0#4x"%(i));
if(len(sig) < 6):
for param in sig:
par = param.strip()
par_def = None
parts = line.split()
if(len(parts) > 3 and parts[0] >= '0'):
name = parts[3]
if tags.find(entry, name, ctags.TAG_FULLMATCH | ctags.TAG_OBSERVECASE):
found_sym = False
while(not found_sym):
if(entry['kind'] == 'prototype'):
found_sym = True
details = [i, name, entry['signature']]
if(entry['signature'] != "(void)"):
sig = entry['signature'].strip('()').split(',')
else:
sig = [];
regs = {};
details.append("%0#4x"%(i));
if(len(sig) < 6):
for param in sig:
par = param.strip()
par_def = None

if(param.find("struct") != -1):
type_match = re.search("struct (\w+)", param)
if(type_match):
par_entry = TagEntry()
if(tags.find(par_entry, type_match.group(1), ctags.TAG_FULLMATCH|ctags.TAG_OBSERVECASE)):
if(par_entry['kind'] == 'struct'):
par_def = {'file': par_entry['file'], 'line': int(par_entry['lineNumber'])}
details.append({'type': par, 'def': par_def})
else:
details.append("param addr*")
remaining = 9 - len(details)
for x in range(0, remaining):
details.append("")

if(param.find("struct") != -1):
type_match = re.search("struct (\w+)", param)
if(type_match):
par_entry = TagEntry()
if(tags.find(par_entry, type_match.group(1), ctags.TAG_FULLMATCH|ctags.TAG_OBSERVECASE)):
if(par_entry['kind'] == 'struct'):
par_def = {'file': par_entry['file'], 'line': int(par_entry['lineNumber'])}
details.append({'type': par, 'def': par_def})
else:
details.append("param addr*")
remaining = 9 - len(details)
for x in range(0, remaining):
details.append("")
# try to get the line now
if(not is_ptregs):
pattern = "SYSCALL_DEFINE%d(%s"%(len(sig), name.replace("sys_", ""))
search = "SYSCALL_DEFINE%d"%(len(sig))
else:
pattern = name
search = name
if tags.find(entry, search, ctags.TAG_FULLMATCH | ctags.TAG_OBSERVECASE):
found = False
while(found == False):
if(entry['pattern'].find(pattern) == 2):
#details['found'] = entry['pattern']
details.append(entry['file'])
details.append(int(entry['lineNumber']))
found = True
break
if(not tags.findNext(entry)):
details.append("not found")
details.append("")
break
else:
details.append("not found")
details.append("")
sys_calls.append(details)
else:
if(not tags.findNext(entry)):
sys_calls.append([i, "", "", "", "", "", "", "", "", "", ""])
break
i += 1
pattern = "SYSCALL_DEFINE%d(%s"%(len(sig), name.replace("sys_", ""))
search = "SYSCALL_DEFINE%d"%(len(sig))
if tags.find(entry, search, ctags.TAG_FULLMATCH | ctags.TAG_OBSERVECASE):
found = False
while(found == False):
if(entry['pattern'].find(pattern) == 2):
#details['found'] = entry['pattern']
details.append(entry['file'])
details.append(int(entry['lineNumber']))
found = True
break
if(not tags.findNext(entry)):
details.append("not found")
details.append("")
break
else:
details.append("not found")
details.append("")
sys_calls.append(details)
else:
if(not tags.findNext(entry)):
sys_calls.append([i, "", "", "", "", "", "", "", "", "", ""])
break
i += 1
else:
sys_calls.append([i, "not implemented", "", "%0#4x"%(i), "", "", "", "", "", "", ""])
i += 1

print simplejson.dumps({'aaData': sys_calls}, indent=" ")
31 changes: 31 additions & 0 deletions prepare-files.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

KERNEL_VERSION="4.14"
LINK="https://www.kernel.org/pub/linux/kernel/v4.x/linux-${KERNEL_VERSION}.tar.xz"

TBL_32="/tmp/linux-${KERNEL_VERSION}/arch/x86/entry/syscalls/syscall_32.tbl"

if [ ! -d ${DIR}/linux-${KERNEL_VERSION} ];then
curl $LINK > /tmp/linux-${KERNEL_VERSION}.tar.xz
tar xf /tmp/linux-${KERNEL_VERSION}.tar.xz -C /tmp/
fi

if [ ! -f ${TBL_32} ]; then
echo "File syscall_32.tbl doesn't exist"
exit -1
fi

echo "[+] Generating tags, this may take a while..."
ctags --fields=afmikKlnsStz --c-kinds=+pc -R /tmp/linux-${KERNEL_VERSION}
echo "[+] Tags generated"
echo "[+] Preparing the syscall table file..."
cp -v $TBL_32 .
sed -i '1,8d' syscall_32.tbl
echo "[+] Done :)"
rm -rf "/tmp/linux-${KERNEL_VERSION}"
rm -rf "/tmp/linux-${KERNEL_VERSION}.tar.xz"
echo "[I] Calling gen_syscalls..."
./gen_syscalls.py > www/syscalls-x86.js
rm -rf tags
rm -rf syscall_32.tbl
sed -i "s/\/tmp\/linux-${KERNEL_VERSION}\///g" www/syscalls-x86.js
2 changes: 1 addition & 1 deletion www/CNAME
Original file line number Diff line number Diff line change
@@ -1 +1 @@
syscalls.kernelgrok.com
syscalls32.paolostivanin.com
Empty file modified www/css/images/ui-bg_flat_0_aaaaaa_40x100.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified www/css/images/ui-bg_flat_75_ffffff_40x100.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified www/css/images/ui-bg_glass_55_fbf9ee_1x400.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified www/css/images/ui-bg_glass_65_ffffff_1x400.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified www/css/images/ui-bg_glass_75_dadada_1x400.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified www/css/images/ui-bg_glass_75_e6e6e6_1x400.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified www/css/images/ui-bg_glass_95_fef1ec_1x400.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified www/css/images/ui-bg_highlight-soft_75_cccccc_1x100.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified www/css/images/ui-icons_222222_256x240.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified www/css/images/ui-icons_2e83ff_256x240.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified www/css/images/ui-icons_454545_256x240.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified www/css/images/ui-icons_888888_256x240.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified www/css/images/ui-icons_cd0a0a_256x240.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified www/css/jquery-ui-1.7.2.custom.css
100755 → 100644
Empty file.
24 changes: 6 additions & 18 deletions www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@
$(document).ready(function() {
$('#syscall_table').dataTable( {
"sDom": '<"H"rlf>t<"F"ip>',
"iDisplayLength": 10,
"iDisplayLength": 20,
"oLanguage": {
"sLengthMenu": 'Show <select><option value="10">10</option><option value="25">25</option><option value="50">50</option><option value="100">100</option><option value="-1">All</option></select> entries'
},
"bJQueryUI": true,
"bProcessing": true,
"sPaginationType": "full_numbers",
"sAjaxSource": './syscalls-2.6.35.4.js',
"sAjaxSource": './syscalls-x86.js',
"aoColumns": [
/* Number */ { "sClass": "center"},
/* Name */ { "sClass": "bold", "sType": "html", "fnRender": function (obj) {
Expand All @@ -60,7 +60,7 @@
/* esi */ { "sType": "html", "fnRender": renderReg, "bSearchable": false },
/* edi */ { "sType": "html", "fnRender": renderReg, "bSearchable": false },
/* URL */ { "sType": "html", "bSearchable": false, "fnRender": function (oObj) {
if(oObj.aData[9] != "")
if(oObj.aData[19] != "")
return "<a target='_blank' href='http://lxr.free-electrons.com/source/"+oObj.aData[9]+"#L"+oObj.aData[10]+"'>"+oObj.aData[9]+":"+oObj.aData[10]+"</a>";
else
return oObj.aData[9];
Expand All @@ -71,24 +71,12 @@
} );
} );
</script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-12723311-2']);
_gaq.push(['_setDomainName', '.kernelgrok.com']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body>
<div id="header">
<div class="site">
<div id="headline">
<h2 class="chunk">Linux Syscall Reference</h2>
<h2 class="chunk">Linux Syscall Reference (32 bit)</h2>
</div>
</div>
</div>
Expand Down Expand Up @@ -119,11 +107,11 @@ <h2 class="chunk">Linux Syscall Reference</h2>
</div>
<div id="footer" class="site">
<h4 class="chunk">
Generated from Linux kernel 2.6.35.4 using <a target="_blank" href="http://ctags.sourceforge.net/">Exuberant Ctags</a>,
Generated from Linux kernel 4.14 using <a target="_blank" href="http://ctags.sourceforge.net/">Exuberant Ctags</a>,
<a target="_blank" href="http://www.python.org/">Python</a>, and
<a target="_blank" href="http://www.datatables.net/">DataTables</a>.
<br>
Project on <a href="https://github.com/gregose/syscall-table">GitHub</a>. Hosted on <a href="http://pages.github.com">GitHub Pages</a>.
Project on <a href="https://github.com/paolostivanin/syscall-table">GitHub</a>. Hosted on <a href="https://github.com">GitHub</a>.
</h4>
</div>
<script type="text/javascript">Cufon.now();</script>
Expand Down
8 changes: 4 additions & 4 deletions www/js/jquery.dataTables.js
Original file line number Diff line number Diff line change
Expand Up @@ -1106,9 +1106,9 @@
* Notes: These variable must NOT be used externally to get the data length. Rather, use
* the fnRecordsTotal() (etc) functions.
*/
this._iDisplayLength = 10;
this._iDisplayLength = 20;
this._iDisplayStart = 0;
this._iDisplayEnd = 10;
this._iDisplayEnd = 20;

/*
* Variable: _iRecordsTotal, _iRecordsDisplay
Expand Down Expand Up @@ -3761,7 +3761,7 @@
{
if ( oSettings._iDisplayLength >= 0 )
{
var iPages = parseInt( (oSettings.fnRecordsDisplay()-1) / oSettings._iDisplayLength, 10 ) + 1;
var iPages = parseInt( (oSettings.fnRecordsDisplay()-1) / oSettings._iDisplayLength, 20 ) + 1;
oSettings._iDisplayStart = (iPages-1) * oSettings._iDisplayLength;
}
else
Expand Down Expand Up @@ -3925,7 +3925,7 @@
}

/* Redraw the table */
oSettings._iDisplayLength = parseInt(iVal, 10);
oSettings._iDisplayLength = parseInt(iVal, 20);
_fnCalculateEnd( oSettings );

/* If we have space to show extra rows (backing up from the end point - then do so */
Expand Down
Loading