'''libcriu''' is a C API for CRIU, which is a simple wrapper around our [[RPC]]. Although you can use [[RPC]] directly, libcriu
provides the interface that is much easier to use in C apps. Note that [[RPC]] is supported in the first place, and if you want the most recent set of features you should probably use [[RPC]].
== Beginning ==
== Setup options ==
=== init options ===
'''int criu_init_opts(void) ''' to init request options. Note: it should be called before using any other functions from libcriu except criu_check(). Also you should use it to reinit options. It return 0 on success and -1 on fail.
=== set service address ===
'''void criu_set_service_address(char *address) ''' to specify path to CRIU service socket. Call it with NULL to make libcriu use default address : /var/run/criu_service.socket.
=== set dump/restore options ===
Use criu_set_* functions to setup dump/restore options.
void criu_set_pid(int pid);
If no pid is set on dump, CRIU will dump
client process by default. '''Note :''' Whole tree <pid> must have the same uid , as a client, or client's uid must be == 0, otherwise CRIU won't dump nothing at all. See [[Usage#Security]].
The logic of setting request is the same as when setting options in console. Here is an example:
is equal to:
== check/dump/restore ==
Use this functions to check/dump/restore:
== Examples ==
You could find example of using libcriu at test/libcriu.