Home | History | Annotate | Download | only in minijail
      1 # Hacking on Minijail
      2 
      3 ## Dependencies
      4 
      5 You'll need these to build the source:
      6 * [libcap]
      7 * Linux kernel headers
      8 
      9 You'll need to install the relevant packages from your distro.
     10 
     11 ## Building
     12 
     13 For local experimentation (using Minijail libraries from the source directory):
     14 
     15 ```
     16 $ make LIBDIR=/lib64
     17 $ sudo ./minijail0 --preload-library=./libminijailpreload.so \
     18   -u ${USER} -g 5000 -- /usr/bin/id
     19 ```
     20 
     21 For system-wide usage, install `libminijail.so` and `libminijailpreload.so` to
     22 `/lib64` and `minijail0` to a directory in your `PATH` (e.g. `/usr/bin`).
     23 
     24 ## Testing
     25 
     26 We use [Google Test] (i.e. `gtest` & `gmock`) for unit tests.
     27 You can download a suitable copy of Google Test using the
     28 [get_googletest.sh](./get_googletest.sh) script.
     29 
     30 ```
     31 $ ./get_googletest.sh
     32 googletest-release-1.8.0/
     33 ...
     34 $ make tests
     35 ```
     36 
     37 Building the tests will automatically execute them.
     38 
     39 ## Source Style
     40 
     41 *   Minijail uses kernel coding style:
     42     https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst
     43 *   Utility functions with no side-effects should go in `util.{h|c}`.
     44 *   Functions with side effects or with dependencies on operating system
     45     details, but that don't take a `struct minijail` argument, should go
     46     in `system.{h|c}`.
     47 
     48 ## Documentation
     49 
     50 ### Markdown
     51 
     52 Minijail uses markdown for general/source documentation.
     53 We follow the [Google Markdown style guide].
     54 
     55 ### Man Pages
     56 
     57 For users of Minijail (e.g. `minijail0`), we use man pages.
     58 For style guides, check out the [Linux man-pages project] for general guidance.
     59 It has a number of useful references for syntax and such.
     60 
     61 * [man-pages(7)](http://man7.org/linux/man-pages/man7/man-pages.7.html)
     62 * [groff-man(7)](http://man7.org/linux/man-pages/man7/groff_man.7.html)
     63 * [groff(7)](http://man7.org/linux/man-pages/man7/groff.7.html)
     64 
     65 [minijail0.1] documents the command line interface.
     66 Please keep it in sync with [minijail0_cli.c].
     67 
     68 [minijail0.5] documents the syntax of config files (e.g. seccomp filters).
     69 
     70 [libcap]: https://git.kernel.org/pub/scm/linux/kernel/git/morgan/libcap.git/
     71 [minijail0.1]: ./minijail0.1
     72 [minijail0.5]: ./minijail0.5
     73 [minijail0_cli.c]: ./minijail0_cli.c
     74 [Google Markdown style guide]: https://github.com/google/styleguide/blob/gh-pages/docguide/style.md
     75 [Google Test]: https://github.com/google/googletest
     76