An open API service indexing awesome lists of open source software.

https://github.com/catern/rsyscall

Process-independent interface to Linux system calls
https://github.com/catern/rsyscall

linux

Last synced: 12 months ago
JSON representation

Process-independent interface to Linux system calls

Awesome Lists containing this project

README

          

* Summary
rsyscall is a library which provides a interface to an ever-growing subset of Linux system calls.
This interface is:
- *process-independent*: all system calls are called as methods on process objects,
which can refer to the "local" process or to other processes under our control, possibly on remote hosts.
- *type-safe*: many Linux API constraints, which are usually left to user code to enforce,
are made explicit in the type system.
- *low-level*: any action which is possible with the underlying Linux APIs,
is possible with rsyscall; nothing is forbidden or discouraged.

For more detail on the concepts and motivation behind rsyscall,
read the [[file:docs/conceptual.org][conceptual introduction]].
* Quick Start
Check out the docs at [[http://rsyscall.org/rsyscall][rsyscall.org]].

Note that the rsyscall Python API uses some recent Python 3 features:
async/await and type annotations.
If you haven't seen those before, skim the [[file:docs/background.org][background tutorial]] first.
* Installation
There's no official release of rsyscall yet.

But, if you want to try it, you can do so with Nix:
#+begin_src bash
git clone https://github.com/catern/rsyscall
cd rsyscall/python
nix-shell
python
#+end_src

Or you can build it by hand in a virtual environment:
#+begin_src bash
git clone https://github.com/catern/rsyscall
cd rsyscall
python3 -m venv venv
. venv/bin/activate
pip install -U pip

cd c
autoreconf -fvi
./configure --prefix=$PWD/../venv
make install
cd ..
export LD_LIBRARY_PATH=$PWD/venv/lib
export PKG_CONFIG_PATH=$PWD/venv/lib/pkgconfig

pip install -e python/
python
#+end_src
* Getting started
rsyscall is an async library that uses [[https://trio.readthedocs.io][Trio]], so the easiest way to
try it out is with an async Python REPL. [[https://ipython.org/][IPython]] provides a convenient
REPL:
#+begin_example
$ pip install ipython
$ ipython
In [1]: %autoawait trio

In [2]: import rsyscall

In [3]: t = await rsyscall.local_process.fork()

In [4]: await t.stdout.write(await t.ptr("Hello world!\n"))
Hello world!
#+end_example
* Discussion
irc://irc.oftc.net/#rsyscall