[CRIU] [PATCH 09/19] compel: plugins -- Add prologue.h from compel, drop hand-made prologue_init_args
Cyrill Gorcunov
gorcunov at openvz.org
Wed Sep 21 13:54:24 PDT 2016
From: Dmitry Safonov <dsafonov at virtuozzo.com>
Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
compel/arch/x86/plugins/include/asm/prologue.h | 36 ++++++++++++++++++++++++++
compel/plugins/include/uapi/plugin-std.h | 8 ------
compel/plugins/std/std.c | 2 ++
3 files changed, 38 insertions(+), 8 deletions(-)
create mode 100644 compel/arch/x86/plugins/include/asm/prologue.h
diff --git a/compel/arch/x86/plugins/include/asm/prologue.h b/compel/arch/x86/plugins/include/asm/prologue.h
new file mode 100644
index 000000000000..9d812eec9f06
--- /dev/null
+++ b/compel/arch/x86/plugins/include/asm/prologue.h
@@ -0,0 +1,36 @@
+#ifndef __ASM_PROLOGUE_H__
+#define __ASM_PROLOGUE_H__
+
+#ifndef __ASSEMBLY__
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+
+#include <errno.h>
+
+#define sys_recv(sockfd, ubuf, size, flags) \
+ sys_recvfrom(sockfd, ubuf, size, flags, NULL, NULL)
+
+typedef struct prologue_init_args {
+ struct sockaddr_un ctl_sock_addr;
+ unsigned int ctl_sock_addr_len;
+
+ unsigned int arg_s;
+ void *arg_p;
+
+ void *sigframe;
+} prologue_init_args_t;
+
+#endif /* __ASSEMBLY__ */
+
+/*
+ * Reserve enough space for sigframe.
+ *
+ * FIXME It is rather should be taken from sigframe header.
+ */
+#define PROLOGUE_SGFRAME_SIZE 4096
+
+#define PROLOGUE_INIT_ARGS_SIZE 1024
+
+#endif /* __ASM_PROLOGUE_H__ */
diff --git a/compel/plugins/include/uapi/plugin-std.h b/compel/plugins/include/uapi/plugin-std.h
index 5eaa31f04e45..b77a7b44975b 100644
--- a/compel/plugins/include/uapi/plugin-std.h
+++ b/compel/plugins/include/uapi/plugin-std.h
@@ -4,12 +4,4 @@
#include "uapi/plugins.h"
#include "uapi/std/syscall.h"
-struct prologue_init_args {
- struct sockaddr *ctl_sock_addr;
- socklen_t ctl_sock_addr_len;
-
- unsigned int arg_s;
- void *arg_p;
-};
-
#endif /* COMPEL_PLUGIN_STD_STD_H__ */
diff --git a/compel/plugins/std/std.c b/compel/plugins/std/std.c
index 69bbb9bed20a..19090d7f7a18 100644
--- a/compel/plugins/std/std.c
+++ b/compel/plugins/std/std.c
@@ -4,6 +4,8 @@
#include "uapi/plugins.h"
#include "uapi/plugin-std.h"
+#include "asm/prologue.h"
+
extern int main(void *arg_p, unsigned int arg_s);
static struct prologue_init_args *init_args;
--
2.7.4
More information about the CRIU
mailing list