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:
Pavel Emelyanov 2017-03-06 21:38:17 +03:00 committed by Andrei Vagin
parent b502d7fd6b
commit 6794c8c2a9
4 changed files with 42 additions and 2 deletions

View file

@ -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
View 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());
}

View 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__ */