[lxc-devel] [lxd/master] lxd/main_checkfeature: don't depend on kcmp header

brauner on Github lxc-bot at linuxcontainers.org
Wed Feb 5 23:10:57 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 379 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200205/7f5c8612/attachment.bin>
-------------- next part --------------
From db5cb1f1db01c0986681f70de34a0c82f43a96f7 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Thu, 6 Feb 2020 00:09:56 +0100
Subject: [PATCH] lxd/main_checkfeature: don't depend on kcmp header

Closes #6843.
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 lxd/main_checkfeature.go | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lxd/main_checkfeature.go b/lxd/main_checkfeature.go
index a584b00e8a..ac167bdbbc 100644
--- a/lxd/main_checkfeature.go
+++ b/lxd/main_checkfeature.go
@@ -10,7 +10,6 @@ import (
 #endif
 #include <errno.h>
 #include <fcntl.h>
-#include <linux/kcmp.h>
 #include <linux/types.h>
 #include <poll.h>
 #include <stdbool.h>
@@ -161,7 +160,10 @@ static int user_trap_syscall(int nr, unsigned int flags)
 static int filecmp(pid_t pid1, pid_t pid2, int fd1, int fd2)
 {
 #ifdef __NR_kcmp
-	return syscall(__NR_kcmp, pid1, pid2, KCMP_FILE, fd1, fd2);
+#ifndef KCMP_FILE
+#define KCMP_FILE 0
+#endif
+	return syscall(__NR_kcmp, pid1, pid2, 0, fd1, fd2);
 #else
 	errno = ENOSYS;
 	return -1;


More information about the lxc-devel mailing list