The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/6319

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Signed-off-by: Christian Brauner <christian.brau...@ubuntu.com>
From aa531ed5d09dd01cecd9d4f14818072d4b1d8d11 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brau...@ubuntu.com>
Date: Sun, 20 Oct 2019 17:56:00 +0200
Subject: [PATCH] unixfd: split into header.{c,h}

Signed-off-by: Christian Brauner <christian.brau...@ubuntu.com>
---
 shared/netutils/network_linux.go |  7 ++++---
 shared/netutils/unixfd.c         | 14 +++++++-------
 shared/netutils/unixfd.h         | 17 +++++++++++++++++
 3 files changed, 28 insertions(+), 10 deletions(-)
 create mode 100644 shared/netutils/unixfd.h

diff --git a/shared/netutils/network_linux.go b/shared/netutils/network_linux.go
index e593dc87cc..6f633ee0a8 100644
--- a/shared/netutils/network_linux.go
+++ b/shared/netutils/network_linux.go
@@ -19,10 +19,11 @@ import (
 )
 
 /*
-#include "../../shared/netutils/netns_getifaddrs.c"
-#include "../../shared/netutils/unixfd.c"
+#cgo CFLAGS: -std=gnu11 -Wvla
+
+#include "unixfd.h"
+#include "netns_getifaddrs.c"
 */
-// #cgo CFLAGS: -std=gnu11 -Wvla
 import "C"
 
 func NetnsGetifaddrs(initPID int32) (map[string]api.InstanceStateNetwork, 
error) {
diff --git a/shared/netutils/unixfd.c b/shared/netutils/unixfd.c
index 103c808f7f..c27bdd456c 100644
--- a/shared/netutils/unixfd.c
+++ b/shared/netutils/unixfd.c
@@ -1,6 +1,6 @@
-// +build none
-
-#define _GNU_SOURCE
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
 #include <errno.h>
 #include <fcntl.h>
 #include <grp.h>
@@ -17,6 +17,7 @@
 #include <sys/types.h>
 #include <sys/un.h>
 
+#include "unixfd.h"
 #include "../../lxd/include/memory_utils.h"
 
 int lxc_abstract_unix_send_fds(int fd, int *sendfds, int num_sendfds,
@@ -56,9 +57,8 @@ int lxc_abstract_unix_send_fds(int fd, int *sendfds, int 
num_sendfds,
        return sendmsg(fd, &msg, MSG_NOSIGNAL);
 }
 
-static ssize_t lxc_abstract_unix_recv_fds_iov(int fd, int *recvfds,
-                                             int num_recvfds,
-                                             struct iovec *iov, size_t iovlen)
+ssize_t lxc_abstract_unix_recv_fds_iov(int fd, int *recvfds, int num_recvfds,
+                                      struct iovec *iov, size_t iovlen)
 {
        __do_free char *cmsgbuf = NULL;
        ssize_t ret;
@@ -107,7 +107,7 @@ static ssize_t lxc_abstract_unix_recv_fds_iov(int fd, int 
*recvfds,
        return ret;
 }
 
-static ssize_t lxc_abstract_unix_recv_fds(int fd, int *recvfds, int 
num_recvfds,
+ssize_t lxc_abstract_unix_recv_fds(int fd, int *recvfds, int num_recvfds,
                                   void *data, size_t size)
 {
        char buf[1] = {0};
diff --git a/shared/netutils/unixfd.h b/shared/netutils/unixfd.h
new file mode 100644
index 0000000000..6ae46b7414
--- /dev/null
+++ b/shared/netutils/unixfd.h
@@ -0,0 +1,17 @@
+#ifndef LXD_UNIXFD_H
+#define LXD_UNIXFD_H
+
+#include <sys/socket.h>
+#include <sys/types.h>
+
+extern int lxc_abstract_unix_send_fds(int fd, int *sendfds, int num_sendfds,
+                                     void *data, size_t size);
+
+extern ssize_t lxc_abstract_unix_recv_fds_iov(int fd, int *recvfds,
+                                             int num_recvfds,
+                                             struct iovec *iov, size_t iovlen);
+
+extern ssize_t lxc_abstract_unix_recv_fds(int fd, int *recvfds, int 
num_recvfds,
+                                         void *data, size_t size);
+
+#endif // LXD_UNIXFD_H
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to