musec/libpreopen

Add example to README

Opened this issue · 0 comments

I think the README could use a basic "getting started" example, like:
Pre-open the files in the application and enter the sandbox:

struct po_map *pmap;
pmap = po_map_create(2);
po_set_libc_map(pmap);
po_preopen(pmap, "/usr/local/etc", O_DIRECTORY);
po_preopen(pmap, "/usr/local/share", O_DIRECTORY);
caph_enter(); // enter sandbox

Build the application with -lpreopen, then add path to libpreopen.so to LD_PRELOAD.