[CRIU] [PATCH 08/13] syscalls: Move types definitions needed for syscalls into syscall-types.h

Cyrill Gorcunov gorcunov at openvz.org
Tue Apr 17 17:55:43 EDT 2012


Will need it for syscalls design transition.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 include/syscall-types.h |   56 +++++++++++++++++++++++++++++++++++++++++++++++
 include/syscall.h       |   32 +--------------------------
 2 files changed, 57 insertions(+), 31 deletions(-)
 create mode 100644 include/syscall-types.h

diff --git a/include/syscall-types.h b/include/syscall-types.h
new file mode 100644
index 0000000..8598623
--- /dev/null
+++ b/include/syscall-types.h
@@ -0,0 +1,56 @@
+/*
+ * Please add here type definitions if
+ * syscall prototypes need them.
+ *
+ * Anything else should go to plain type.h
+ */
+
+#ifndef SYSCALL_TYPES_H__
+#define SYSCALL_TYPES_H__
+
+#include <sys/types.h>
+#include <sys/time.h>
+#include <arpa/inet.h>
+#include <fcntl.h>
+
+#include "types.h"
+#include "compiler.h"
+
+#ifndef CONFIG_X86_64
+# error x86-32 bit mode not yet implemented
+#endif
+
+struct cap_header {
+	u32 version;
+	int pid;
+};
+
+struct cap_data {
+	u32 eff;
+	u32 prm;
+	u32 inh;
+};
+
+struct sockaddr;
+struct msghdr;
+struct rusage;
+
+#ifndef F_GETFD
+#define F_GETFD 1
+#endif
+
+#ifndef CLONE_NEWPID
+#define CLONE_NEWPID	0x20000000
+#endif
+
+#ifndef CLONE_NEWUTS
+#define CLONE_NEWUTS	0x04000000
+#endif
+
+#ifndef CLONE_NEWIPC
+#define CLONE_NEWIPC	0x08000000
+#endif
+
+#define setns	sys_setns
+
+#endif /* SYSCALL_TYPES_H__ */
diff --git a/include/syscall.h b/include/syscall.h
index 5baaf7f..1ad4060 100644
--- a/include/syscall.h
+++ b/include/syscall.h
@@ -8,6 +8,7 @@
 #include "types.h"
 #include "compiler.h"
 #include "syscall-codes.h"
+#include "syscall-types.h"
 
 #ifdef CONFIG_X86_64
 
@@ -350,17 +351,6 @@ static long sys_setfsgid(int fsgid)
 	return syscall1(__NR_setfsgid, (long)fsgid);
 }
 
-struct cap_header {
-	u32 version;
-	int pid;
-};
-
-struct cap_data {
-	u32 eff;
-	u32 prm;
-	u32 inh;
-};
-
 static long sys_capset(struct cap_header *h, struct cap_data *d)
 {
 	return syscall2(__NR_capset, (long)h, (long)d);
@@ -371,13 +361,11 @@ static int sys_socket(int domain, int type, int protocol)
 	return syscall3(__NR_socket, (long) domain, (long) type, (long) protocol);
 }
 
-struct sockaddr;
 static int sys_bind(int sockfd, const struct sockaddr *addr, int addrlen)
 {
 	return syscall3(__NR_bind, (long)sockfd, (long)addr, (long) addrlen);
 }
 
-struct msghdr;
 static long sys_sendmsg(int sockfd, const struct msghdr *msg, int flags)
 {
 	return syscall3(__NR_sendmsg, (long)sockfd, (long)msg, (long) flags);
@@ -419,24 +407,6 @@ static long always_inline sys_fcntl(int fd, int type, long arg)
 	return syscall3(__NR_fcntl, (long)fd, (long)type, (long)arg);
 }
 
-#ifndef F_GETFD
-#define F_GETFD 1
-#endif
-
-#ifndef CLONE_NEWPID
-#define CLONE_NEWPID	0x20000000
-#endif
-
-#ifndef CLONE_NEWUTS
-#define CLONE_NEWUTS	0x04000000
-#endif
-
-#ifndef CLONE_NEWIPC
-#define CLONE_NEWIPC	0x08000000
-#endif
-
-#define setns	sys_setns
-
 #else /* CONFIG_X86_64 */
 # error x86-32 bit mode not yet implemented
 #endif /* CONFIG_X86_64 */
-- 
1.7.7.6



More information about the CRIU mailing list