From: Francesco Chemolli <5175948+kinkie@users.noreply.github.com> Date: Tue, 25 Mar 2025 13:01:41 +0000 (+0000) Subject: MingGW: implement compat/pipe.h (#2029) X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=25a99dc6ea7e13b2cc1376ae60aa28a46e4c21d1;p=thirdparty%2Fsquid.git MingGW: implement compat/pipe.h (#2029) 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'? --- diff --git a/compat/Makefile.am b/compat/Makefile.am index eeb856709a..818d615fa8 100644 --- a/compat/Makefile.am +++ b/compat/Makefile.am @@ -62,6 +62,7 @@ libcompatsquid_la_SOURCES = \ os/solaris.h \ os/sunos.h \ osdetect.h \ + pipe.h \ shm.cc \ shm.h \ statvfs.cc \ diff --git a/compat/os/mswindows.h b/compat/os/mswindows.h index 9370a914a9..1dd1647cbf 100644 --- a/compat/os/mswindows.h +++ b/compat/os/mswindows.h @@ -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 index 0000000000..8ccabc7e36 --- /dev/null +++ b/compat/pipe.h @@ -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 +#endif + +#endif /* _SQUID_WINDOWS_ || _SQUID_MINGW_ */ + +#endif /* SQUID_COMPAT_PIPE_H */ diff --git a/src/DiskIO/DiskThreads/CommIO.cc b/src/DiskIO/DiskThreads/CommIO.cc index 6e4305a031..3dfeb25778 100644 --- a/src/DiskIO/DiskThreads/CommIO.cc +++ b/src/DiskIO/DiskThreads/CommIO.cc @@ -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" diff --git a/src/auth/negotiate/wrapper/negotiate_wrapper.cc b/src/auth/negotiate/wrapper/negotiate_wrapper.cc index 68c428ea5b..d94ed2887a 100644 --- a/src/auth/negotiate/wrapper/negotiate_wrapper.cc +++ b/src/auth/negotiate/wrapper/negotiate_wrapper.cc @@ -32,6 +32,7 @@ #include "squid.h" #include "base64.h" +#include "compat/pipe.h" #include #include diff --git a/src/ipc.cc b/src/ipc.cc index 0de228439e..93c3c31caa 100644 --- a/src/ipc.cc +++ b/src/ipc.cc @@ -10,6 +10,7 @@ #include "squid.h" #include "comm/Connection.h" +#include "compat/pipe.h" #include "fd.h" #include "fde.h" #include "globals.h"