REORG: listener: move xfer_sock_list to sock.{c,h}.
This will be used for receivers as well thus it is not specific to
listeners but to sockets.
diff --git a/include/haproxy/listener-t.h b/include/haproxy/listener-t.h
index 7198669..cb30af1 100644
--- a/include/haproxy/listener-t.h
+++ b/include/haproxy/listener-t.h
@@ -265,17 +265,6 @@
struct bind_kw kw[VAR_ARRAY];
};
-
-struct xfer_sock_list {
- int fd;
- char *iface;
- char *namespace;
- int options; /* socket options LI_O_* */
- struct xfer_sock_list *prev;
- struct xfer_sock_list *next;
- struct sockaddr_storage addr;
-};
-
/* This is used to create the accept queue, optimized to be 64 bytes long. */
struct accept_queue_entry {
struct listener *listener; // 8 bytes
diff --git a/include/haproxy/listener.h b/include/haproxy/listener.h
index c2ac75e..996f3d8 100644
--- a/include/haproxy/listener.h
+++ b/include/haproxy/listener.h
@@ -184,8 +184,6 @@
return states[st];
}
-extern struct xfer_sock_list *xfer_sock_list;
-
extern struct accept_queue_ring accept_queue_rings[MAX_THREADS] __attribute__((aligned(64)));
#endif /* _HAPROXY_LISTENER_H */
diff --git a/include/haproxy/sock-t.h b/include/haproxy/sock-t.h
new file mode 100644
index 0000000..999c16f
--- /dev/null
+++ b/include/haproxy/sock-t.h
@@ -0,0 +1,48 @@
+/*
+ * include/haproxy/sock-t.h
+ * This file contains type definitions for native (BSD-compatible) sockets.
+ *
+ * Copyright (C) 2000-2020 Willy Tarreau - w@1wt.eu
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, version 2.1
+ * exclusively.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef _HAPROXY_SOCK_T_H
+#define _HAPROXY_SOCK_T_H
+
+#include <sys/socket.h>
+#include <sys/types.h>
+
+#include <haproxy/api-t.h>
+
+/* The list used to transfer sockets between old and new processes */
+struct xfer_sock_list {
+ int fd;
+ int options; /* socket options as LI_O_* */
+ char *iface;
+ char *namespace;
+ struct xfer_sock_list *prev;
+ struct xfer_sock_list *next;
+ struct sockaddr_storage addr;
+};
+
+#endif /* _HAPROXY_SOCK_T_H */
+
+/*
+ * Local variables:
+ * c-indent-level: 8
+ * c-basic-offset: 8
+ * End:
+ */
diff --git a/include/haproxy/sock.h b/include/haproxy/sock.h
index 79904e2..b3690d7 100644
--- a/include/haproxy/sock.h
+++ b/include/haproxy/sock.h
@@ -27,6 +27,9 @@
#include <haproxy/api.h>
#include <haproxy/connection-t.h>
+#include <haproxy/sock-t.h>
+
+extern struct xfer_sock_list *xfer_sock_list;
int sock_create_server_socket(struct connection *conn);
int sock_get_src(int fd, struct sockaddr *sa, socklen_t salen, int dir);
diff --git a/src/haproxy.c b/src/haproxy.c
index 3744547..8381269 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -117,6 +117,7 @@
#include <haproxy/server.h>
#include <haproxy/session.h>
#include <haproxy/signal.h>
+#include <haproxy/sock.h>
#include <haproxy/sock_inet.h>
#include <haproxy/ssl_sock.h>
#include <haproxy/stream.h>
diff --git a/src/listener.c b/src/listener.c
index 6e635e3..894c93a 100644
--- a/src/listener.c
+++ b/src/listener.c
@@ -44,8 +44,6 @@
.list = LIST_HEAD_INIT(bind_keywords.list)
};
-struct xfer_sock_list *xfer_sock_list = NULL;
-
/* there is one listener queue per thread so that a thread unblocking the
* global queue can wake up listeners bound only to foreign threads by
* moving them to the remote queues and waking up the associated tasklet.
diff --git a/src/sock.c b/src/sock.c
index 2eb4b6f..56a4a5c 100644
--- a/src/sock.c
+++ b/src/sock.c
@@ -24,10 +24,13 @@
#include <haproxy/api.h>
#include <haproxy/connection.h>
+#include <haproxy/listener-t.h>
#include <haproxy/namespace.h>
#include <haproxy/sock.h>
#include <haproxy/tools.h>
+/* the list of remaining sockets transferred from an older process */
+struct xfer_sock_list *xfer_sock_list = NULL;
/* Create a socket to connect to the server in conn->dst (which MUST be valid),
* using the configured namespace if needed, or the one passed by the proxy