Line 1: |
Line 1: |
− | '''libcriu''' is a C API for CRIU, which is a simple wrapper around our [[RPC]]. Although you can use [[RPC]] directly, libcriu is a wrapper providing the interface that is much easier to use from C code. Note that [[RPC]] is supported in the first place, and if you want the most recent set of features you should probably use [[RPC]] directly. | + | '''libcriu''' is a C API for CRIU, a simple wrapper around our [[RPC]]. Although you can use [[RPC]] directly, libcriu is a wrapper providing the interface that is much easier to use from C code. Note that [[RPC]] is supported in the first place, and if you want the most recent set of features you should probably use [[RPC]] directly. |
| | | |
| == Introduction == | | == Introduction == |
Line 6: |
Line 6: |
| | | |
| To create a library <code>lib/libcriu.so</code>, run <code>make</code> in the main directory. | | To create a library <code>lib/libcriu.so</code>, run <code>make</code> in the main directory. |
− |
| |
− | The library is not thread- and fork- safe.
| |
| | | |
| == Preparation == | | == Preparation == |
Line 36: |
Line 34: |
| void criu_set_log_file(char *log_file); | | void criu_set_log_file(char *log_file); |
| </source> | | </source> |
| + | |
| + | {{Note|This set of calls is not thread safe! For thread safety the same calls with _local suffix should be used}} |
| | | |
| If no pid is set on dump, CRIU will dump the calling process itself. | | If no pid is set on dump, CRIU will dump the calling process itself. |
Line 78: |
Line 78: |
| int criu_restore(void); | | int criu_restore(void); |
| | | |
− | === restore as child === | + | === restore as a child === |
− | This one is special. It will fork and exec criu swrk(Service WoRKer) to allow restoring process as a caller child. Calling "exec" implies some restrictions, as, for example, one should make sure, that criu binary is present in PATH and has suid bit set(see [[Usage#Security]]). | + | |
| + | This one is special. It will fork and exec criu swrk (Service WoRKer) to allow restoring process as a caller child. Calling "exec" implies some restrictions, as, for example, one should make sure, that criu binary is present in PATH and has suid bit set (see [[Usage#Security]]). |
| | | |
| int criu_restore_child(void); | | int criu_restore_child(void); |
Line 130: |
Line 131: |
| == Examples == | | == Examples == |
| | | |
− | You could find example of using libcriu at [http://git.criu.org/?p=criu.git;a=tree;f=test/libcriu test/libcriu]. | + | You could find example of using libcriu at [https://github.com/xemul/criu/tree/master/test/others/libcriu test/others/ibcriu]. |
| | | |
| [[Category: API]] | | [[Category: API]] |
| + | [[Category: Outdated]] |