diff --git a/Makefile.compel b/Makefile.compel index 408f0a701..ab479f79d 100644 --- a/Makefile.compel +++ b/Makefile.compel @@ -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) diff --git a/compel/plugins/Makefile b/compel/plugins/Makefile index f26081f55..79ed21dce 100644 --- a/compel/plugins/Makefile +++ b/compel/plugins/Makefile @@ -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 diff --git a/compel/plugins/fds/fds.c b/compel/plugins/fds/fds.c new file mode 100644 index 000000000..7ed94509d --- /dev/null +++ b/compel/plugins/fds/fds.c @@ -0,0 +1,25 @@ +#include + +#include "uapi/plugins.h" +#include "uapi/plugins/std.h" +#include + +#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()); +} diff --git a/compel/plugins/include/uapi/plugin-fds.h b/compel/plugins/include/uapi/plugin-fds.h new file mode 100644 index 000000000..cececb21d --- /dev/null +++ b/compel/plugins/include/uapi/plugin-fds.h @@ -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__ */