Coder Social home page Coder Social logo

list_syscalls's Introduction

list_syscalls: Get a programmatic description of Linux x86_64 syscalls

This project aims at automating the description of Linux x86_64 syscalls for use in other programs. Currently, the program builds a C array and a HTML table, but other languages could be adapted.

This project is meant as an extension to, and was heavily inspired by, Filippo Valsorda's Searchable Linux Syscall Table.

How to use

Run (Internet connection required):

$ ./list_syscalls.py [-s <SOURCES>] [-f <FORMATS>]

This will fetch resources based on the SOURCES parameter, and create files based on the FORMATS parameter. See ./list_syscalls.py --help for more info.

The ability to connect to the Internet is required by the live retrieval and building of files from the sources, including a mandatory one. The files are then cached for subsequent runs, for up to 24 hours.

What is the issue exactly?

For multiple reasons, no single source describes Linux syscalls:

  • They exist at a boundary between kernel and userspace, there is no need for them to be described uniformly across that boundary.
  • They are not restricted to being called from C code, there is no need to describe their interface in C.
  • Their calling convention is different from regular C functions, so most use of them in C is actually done through wrappers, which are usually part of your libc.

Some notable sources for syscall information, and how many are actually described (at the time of writing):

  • Linux' arch/x86/entry/syscalls/syscall_64.tbl lists all the syscalls by name and ties them to their number and entry point function, but does not list parameters or return values. (409 syscalls, 373 for x86_64)
  • Linux' include/linux/syscalls.h references a lot of the entry point functions and their parameters, but not return values. This file is complemented by include/asm-generic/syscalls.h. (456 entry point functions, with some duplicates)
  • Linux' /usr/include/asm/unistd_64.h (build artefact generated from syscall_64.tbl, should also be provided with your distribution) provides macros for all the available syscalls on a given system, but that is only for the syscall number. (368 syscalls on my machine)
  • The GNU C Library has syscalls.lists, from which the wrappers are generated, but they are very terse regarding parameters and return values. (188 syscalls)
  • libcs also have headers that describe the wrappers, but they are neither centralised nor described in a central place.
  • The Linux man-pages provide documentation for syscalls wrappers in section 2, but they are loosely formatted. (502 entries, not all for x86_64)

Current implementation

The current implementation uses the following data sources on syscalls:

all fetched at runtime from branch master on their respective repository.

The current implementation can output C arrays and structures, and a HTML table.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.