mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-22 01:51:51 +00:00
compel: Add fds plugin (v2)
This is just export by reasonable name of the existing code, that sends and receives FDs via compel RPC socket. v2: Rebase on recent criu-dev Fix parallel build Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
parent
b502d7fd6b
commit
6794c8c2a9
@ -22,7 +22,7 @@ compel-deps += compel/include/asm
|
||||
compel-deps += $(COMPEL_VERSION_HEADER)
|
||||
compel-deps += $(CONFIG_HEADER)
|
||||
compel-deps += include/common/asm
|
||||
compel-plugins += compel/plugins/std.built-in.o
|
||||
compel-plugins += compel/plugins/std.built-in.o compel/plugins/fds.built-in.o
|
||||
|
||||
LIBCOMPEL_SO := libcompel.so
|
||||
LIBCOMPEL_A := libcompel.a
|
||||
@ -50,7 +50,10 @@ compel/plugins/%: $(compel-deps) .FORCE
|
||||
compel/plugins/std.built-in.o: $(compel-deps) .FORCE
|
||||
$(Q) $(MAKE) $(build)=compel/plugins $@
|
||||
|
||||
compel/plugins/shmem.built-in.o: $(compel-deps) .FORCE
|
||||
compel/plugins/shmem.built-in.o: $(compel-deps) compel/plugins/std.built-in.o .FORCE
|
||||
$(Q) $(MAKE) $(build)=compel/plugins $@
|
||||
|
||||
compel/plugins/fds.built-in.o: $(compel-deps) compel/plugins/std.built-in.o .FORCE
|
||||
$(Q) $(MAKE) $(build)=compel/plugins $@
|
||||
|
||||
compel/compel: compel/built-in.o compel/$(LIBCOMPEL_A) | $(compel-deps)
|
||||
|
@ -48,6 +48,11 @@ std-obj-y += std/string.o
|
||||
std-obj-y += std/infect.o
|
||||
std-obj-y += ./$(PLUGIN_ARCH_DIR)/std/parasite-head.o
|
||||
|
||||
#
|
||||
# FDS plugin
|
||||
target += fds
|
||||
fds-obj-y += fds/fds.o
|
||||
|
||||
ifeq ($(SRCARCH),x86)
|
||||
std-obj-y += ./$(PLUGIN_ARCH_DIR)/std/memcpy.o
|
||||
endif
|
||||
|
25
compel/plugins/fds/fds.c
Normal file
25
compel/plugins/fds/fds.c
Normal file
@ -0,0 +1,25 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include "uapi/plugins.h"
|
||||
#include "uapi/plugins/std.h"
|
||||
#include <compel/plugins/std/infect.h>
|
||||
|
||||
#define pr_err(fmt, ...)
|
||||
|
||||
#include "common/compiler.h"
|
||||
#include "common/bug.h"
|
||||
|
||||
#define __sys(foo) sys_##foo
|
||||
#define __sys_err(ret) ret
|
||||
|
||||
#include "common/scm.h"
|
||||
|
||||
int fds_send_fd(int fd)
|
||||
{
|
||||
return send_fd(parasite_get_rpc_sock(), NULL, 0, fd);
|
||||
}
|
||||
|
||||
int fds_recv_fd(void)
|
||||
{
|
||||
return recv_fd(parasite_get_rpc_sock());
|
||||
}
|
7
compel/plugins/include/uapi/plugin-fds.h
Normal file
7
compel/plugins/include/uapi/plugin-fds.h
Normal file
@ -0,0 +1,7 @@
|
||||
#ifndef COMPEL_PLUGIN_STD_STD_H__
|
||||
#define COMPEL_PLUGIN_STD_STD_H__
|
||||
|
||||
extern int fds_send_fd(int fd);
|
||||
extern int fds_recv_fd(void);
|
||||
|
||||
#endif /* COMPEL_PLUGIN_STD_STD_H__ */
|
Loading…
x
Reference in New Issue
Block a user