[CRIU] [PATCHv4 3/4] libcriu: add criu_dump_me() and libcriu header

Pavel Emelyanov xemul at parallels.com
Tue Sep 3 14:48:27 EDT 2013


On 09/03/2013 06:44 PM, Ruslan Kuprieiev wrote:
> criu_dump_me() can be used by program to dump itself.
> Program need to call criu_allocate_args() to prepare arguments and then 
> it can set them using criu_set* functions. criu_set* functions are used 
> instead of give user access to arguments itself, so user will not mess 
> with protobuf. libcriu.h is to be used by user program.
> 
> 


> @@ -0,0 +1,40 @@
> +#ifndef __CRIU_LIB__
> +#define __CRIU_LIB__
> +#include <stdint.h>
> +
> +#define CR_DEFAULT_SERVICE_ADDRESS "/tmp/criu_service.socket"
> +
> +/* dump flags */
> +#define CRIU_DUMP_AND_KILL	0
> +#define CRIU_DUMP_AND_CONTINUE	(1 << 0)
> +
> +/* return codes */
> +#define CRIU_DUMP_FAIL		-1
> +#define CRIU_RESUME		1	/* when program is restored */
> +#define CRIU_DUMP_SUCCESS	0	/* when CRIU_DUMP_AND_CONTINUE is set */
> +#define CRIU_OLD_VERSION	-2	/* when libcriu ver. > criu ver. */

I'd turn ">" into "!="

> +
> +/* MUST be called BEFORE using criu_set* functions */
> +int criu_alloc_args(void); /* 0 if success, -1 if fail*/
> +
> +/* criu_set_* functions are to be used to set dump arguments */
> +
> +/*---------- REQUIRED arguments ----------*/
> +
> +/* opened dir fd for images */
> +void criu_set_images_dir_fd(int32_t fd);
> +
> +/*----------------------------------------*/
> +
> +/*---------- OPTIONAL arguments ----------*/
> +
> +/* dump flags. see macros above */
> +void criu_set_flags(uint64_t flags);	/* def: CRIU_DUMP_AND_KILL */
> +/* service socket address */
> +void criu_set_service_addr(char *addr); /* def: CR_DEFAUL_SERVICE_ADDRESS */
> +
> +/*----------------------------------------*/
> +
> +int criu_dump_me(void);
> +



More information about the CRIU mailing list