[CRIU] [PATCH v4 3/8] add int(CTL_32)

Pavel Tikhomirov ptikhomirov at parallels.com
Wed Oct 8 06:21:37 PDT 2014


Signed-off-by: Pavel Tikhomirov <ptikhomirov at parallels.com>
---
 include/sysctl.h | 1 +
 sysctl.c         | 7 +++++++
 2 files changed, 8 insertions(+)

diff --git a/include/sysctl.h b/include/sysctl.h
index 4a7682d..50864fb 100644
--- a/include/sysctl.h
+++ b/include/sysctl.h
@@ -23,6 +23,7 @@ enum {
 #define __CTL_U32A	3	/* Array of u32 */
 #define __CTL_U64A	4	/* Array of u64 */
 #define __CTL_STR	5	/* String */
+#define CTL_32		6	/* Single s32 */
 
 #define CTL_U32A(n)	(__CTL_U32A | ((n)   << CTL_SHIFT))
 #define CTL_U64A(n)	(__CTL_U64A | ((n)   << CTL_SHIFT))
diff --git a/sysctl.c b/sysctl.c
index 82d79a4..71591bf 100644
--- a/sysctl.c
+++ b/sysctl.c
@@ -132,17 +132,21 @@ static int sysctl_show_##__type(int fd,					\
 
 GEN_SYSCTL_READ_FUNC(u32, strtoul);
 GEN_SYSCTL_READ_FUNC(u64, strtoull);
+GEN_SYSCTL_READ_FUNC(s32, strtol);
 
 GEN_SYSCTL_WRITE_FUNC(u32, "%u ");
 GEN_SYSCTL_WRITE_FUNC(u64, "%"PRIu64" ");
+GEN_SYSCTL_WRITE_FUNC(s32, "%d ");
 
 GEN_SYSCTL_PRINT_FUNC(u32, "%u ");
 GEN_SYSCTL_PRINT_FUNC(u64, "%"PRIu64" ");
 GEN_SYSCTL_PRINT_FUNC(char, "%c");
+GEN_SYSCTL_PRINT_FUNC(s32, "%d ");
 
 GEN_SYSCTL_SHOW_FUNC(u32, "%u ");
 GEN_SYSCTL_SHOW_FUNC(u64, "%"PRIu64" ");
 GEN_SYSCTL_SHOW_FUNC(char, "%c");
+GEN_SYSCTL_SHOW_FUNC(s32, "%d ");
 
 static int
 sysctl_write_char(int fd, struct sysctl_req *req, char *arg, int nr)
@@ -198,6 +202,9 @@ static int __sysctl_op(int dir, struct sysctl_req *req, int op)
 	case CTL_U32:
 		__SYSCTL_OP(ret, fd, req, u32, nr, op);
 		break;
+	case CTL_32:
+		__SYSCTL_OP(ret, fd, req, s32, nr, op);
+		break;
 	case __CTL_U64A:
 		nr = CTL_LEN(req->type);
 	case CTL_U64:
-- 
1.9.3



More information about the CRIU mailing list