]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
MingGW: implement compat/pipe.h (#2029)
authorFrancesco Chemolli <5175948+kinkie@users.noreply.github.com>
Tue, 25 Mar 2025 13:01:41 +0000 (13:01 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Tue, 25 Mar 2025 15:23:36 +0000 (15:23 +0000)
The pipe(2) function is not available on Windows and mingw,
in favour of a broader _pipe() call.

Fixes the following build error:

    DiskThreads/CommIO.cc:
        In static member function 'static void CommIO::Initialize()':
    DiskThreads/CommIO.cc:26:9: error:
        'pipe' was not declared in this scope; did you mean '_pipe'?

compat/Makefile.am
compat/os/mswindows.h
compat/pipe.h [new file with mode: 0644]
src/DiskIO/DiskThreads/CommIO.cc
src/auth/negotiate/wrapper/negotiate_wrapper.cc
src/ipc.cc

index eeb856709aa9e4ed39275fbf9426ac5fd644462b..818d615fa8cec1679a681b956db9e9546409138d 100644 (file)
@@ -62,6 +62,7 @@ libcompatsquid_la_SOURCES = \
        os/solaris.h \
        os/sunos.h \
        osdetect.h \
+       pipe.h \
        shm.cc \
        shm.h \
        statvfs.cc \
index 9370a914a96ae170e7e77453d5050d49ca76145b..1dd1647cbf3e05ac4d537f64a2b4c6961e57ec0b 100644 (file)
@@ -710,13 +710,6 @@ socket(int f, int t, int p)
 }
 #define socket(f,t,p) Squid::socket(f,t,p)
 
-inline int
-pipe(int pipefd[2])
-{
-    return _pipe(pipefd,4096,_O_BINARY);
-}
-#define pipe(a) Squid::pipe(a)
-
 inline int
 WSAAsyncSelect(int s, HWND h, unsigned int w, long e)
 {
diff --git a/compat/pipe.h b/compat/pipe.h
new file mode 100644 (file)
index 0000000..8ccabc7
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+ */
+
+#ifndef SQUID_COMPAT_PIPE_H
+#define SQUID_COMPAT_PIPE_H
+
+#if _SQUID_WINDOWS_ || _SQUID_MINGW_
+inline int
+pipe(int pipefd[2])
+{
+    return _pipe(pipefd, 4096, _O_BINARY);
+}
+
+#else /* _SQUID_WINDOWS_ || _SQUID_MINGW_ */
+
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#endif /* _SQUID_WINDOWS_ || _SQUID_MINGW_ */
+
+#endif /* SQUID_COMPAT_PIPE_H */
index 6e4305a0314877dfb5cee6754326ef997c3ade88..3dfeb25778a2c52b06b6559f097559a457196177 100644 (file)
@@ -10,6 +10,7 @@
 
 #include "squid.h"
 #include "comm/Loops.h"
+#include "compat/pipe.h"
 #include "DiskIO/DiskThreads/CommIO.h"
 #include "fd.h"
 #include "globals.h"
index 68c428ea5bbe0aa7957d7988babc2d968579677b..d94ed2887a416c90c5b1e5fefc78d9753054f70a 100644 (file)
@@ -32,6 +32,7 @@
 
 #include "squid.h"
 #include "base64.h"
+#include "compat/pipe.h"
 
 #include <cerrno>
 #include <cstring>
index 0de228439ea25663034eec13ef32eee2620748c8..93c3c31caaf4416e852ccd9333e42f58acce6e3e 100644 (file)
@@ -10,6 +10,7 @@
 
 #include "squid.h"
 #include "comm/Connection.h"
+#include "compat/pipe.h"
 #include "fd.h"
 #include "fde.h"
 #include "globals.h"