Re: boost futex diff
On Sun, Dec 24, 2023 at 05:22:49PM +, Lucas Gabriel Vuotto wrote: > On Sun, Dec 24, 2023 at 06:18:03AM +0100, Theo Buehler wrote: > > Index: Makefile > > === > > RCS file: /cvs/ports/devel/boost/Makefile,v > > diff -u -p -r1.140 Makefile > > --- Makefile24 Dec 2023 00:26:12 - 1.140 > > +++ Makefile24 Dec 2023 04:57:15 - > > @@ -11,8 +11,8 @@ COMMENT-md= machine-dependent libraries > > VERSION= 1.84.0 > > DISTNAME= boost_${VERSION:S/./_/g} > > PKGNAME= boost-${VERSION} > > -REVISION= 0 > > -EPOCH =0 > > +REVISION= 1 > > +EPOCH= 0 > > CATEGORIES=devel > > SITES= > > https://boostorg.jfrog.io/artifactory/main/release/${VERSION}/source/ > > EXTRACT_SUFX= .tar.bz2 > > @@ -151,7 +151,7 @@ do-install: > > ${INSTALL_DATA_DIR} ${PREFIX}/include/boost > > ${INSTALL_DATA} ${WRKSRC}/stage/lib/lib!(*.so) ${PREFIX}/lib > > cd ${WRKSRC}/boost && \ > > - pax -rw -s ':^.*\.orig$$::' . ${PREFIX}/include/boost > > + pax -rw -s ':^.*${PATCHORIG}$$::' . ${PREFIX}/include/boost > > find ${PREFIX}/include/boost -type d -exec chmod ${DIRMODE} {} + > > find ${PREFIX}/include/boost -type f -exec chmod ${SHAREMODE} {} + > > # boost-build: > > @@ -159,11 +159,11 @@ do-install: > > ${PREFIX}/bin > > ${INSTALL_DATA_DIR} ${PREFIX}/share/b2 > > @cd ${WRKSRC}/tools/build/src && \ > > - pax -r -w -p pm -s ':^./engine.*$$::' -s ':^.*\.orig$$::' . \ > > + pax -r -w -p pm -s ':^./engine.*$$::' -s ':^.*${PATCHORIG}$$::' > > . \ > > ${PREFIX}/share/b2 > > ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/b2 > > @cd ${WRKSRC}/tools/build/example && \ > > - pax -r -w -p pm -s ':^.*\.orig$$::' . \ > > + pax -r -w -p pm -s ':^.*${PATCHORIG}$$::' . \ > > ${PREFIX}/share/examples/b2 > > > > .include > > Shouldn't those "${PATCHORIG}" be replaced by "\.orig\.port"? It isn't > an issue right now: "find $(make show=WRKSRC) -name '*?orig?port'" > only returns the files actually ending in ${PATCHORIG} and I guess that > if it actually becomes an issue in here, that also means that PATCHORIG > should have been changed before. I don't think so. I could do something like ${PATCHORIG:S/./\\./g} to make extra sure that the two dots don't match anything but a '.'. This is overdoing it and it isn't done elsewhere in the ports tree either. Hardcoding \.orig\.port creates a problem for people having their PATCHORIG set to thing else in their /etc/mk.conf. On several of my oder dev machines where I have it set to .port.orig from the time when PATCHORIG=.orig was the default and created a lot of pain with Rust ports for example. This is a lot more likely to bite people than a file foo.cppXorigYport appearing in boost sources in the next 30 years.
Re: boost futex diff
On Sun, Dec 24, 2023 at 06:18:03AM +0100, Theo Buehler wrote: > Index: Makefile > === > RCS file: /cvs/ports/devel/boost/Makefile,v > diff -u -p -r1.140 Makefile > --- Makefile 24 Dec 2023 00:26:12 - 1.140 > +++ Makefile 24 Dec 2023 04:57:15 - > @@ -11,8 +11,8 @@ COMMENT-md= machine-dependent libraries > VERSION= 1.84.0 > DISTNAME=boost_${VERSION:S/./_/g} > PKGNAME= boost-${VERSION} > -REVISION=0 > -EPOCH = 0 > +REVISION=1 > +EPOCH= 0 > CATEGORIES= devel > SITES= > https://boostorg.jfrog.io/artifactory/main/release/${VERSION}/source/ > EXTRACT_SUFX=.tar.bz2 > @@ -151,7 +151,7 @@ do-install: > ${INSTALL_DATA_DIR} ${PREFIX}/include/boost > ${INSTALL_DATA} ${WRKSRC}/stage/lib/lib!(*.so) ${PREFIX}/lib > cd ${WRKSRC}/boost && \ > - pax -rw -s ':^.*\.orig$$::' . ${PREFIX}/include/boost > + pax -rw -s ':^.*${PATCHORIG}$$::' . ${PREFIX}/include/boost > find ${PREFIX}/include/boost -type d -exec chmod ${DIRMODE} {} + > find ${PREFIX}/include/boost -type f -exec chmod ${SHAREMODE} {} + > # boost-build: > @@ -159,11 +159,11 @@ do-install: > ${PREFIX}/bin > ${INSTALL_DATA_DIR} ${PREFIX}/share/b2 > @cd ${WRKSRC}/tools/build/src && \ > - pax -r -w -p pm -s ':^./engine.*$$::' -s ':^.*\.orig$$::' . \ > + pax -r -w -p pm -s ':^./engine.*$$::' -s ':^.*${PATCHORIG}$$::' > . \ > ${PREFIX}/share/b2 > ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/b2 > @cd ${WRKSRC}/tools/build/example && \ > - pax -r -w -p pm -s ':^.*\.orig$$::' . \ > + pax -r -w -p pm -s ':^.*${PATCHORIG}$$::' . \ > ${PREFIX}/share/examples/b2 > > .include Shouldn't those "${PATCHORIG}" be replaced by "\.orig\.port"? It isn't an issue right now: "find $(make show=WRKSRC) -name '*?orig?port'" only returns the files actually ending in ${PATCHORIG} and I guess that if it actually becomes an issue in here, that also means that PATCHORIG should have been changed before.
Re: boost futex diff
On Sat, Dec 23, 2023 at 08:44:28PM -0500, Brad Smith wrote: > On 2023-12-23 4:47 a.m., Theo Buehler wrote: > > This is based on a diff from Brad who noticed that the diff disabling > > syscall(2) accidentally disabled futexes altogether. This diff reverts > > to the state prior to that commit by taking the intended approach: > > replace syscall(SYS_futex, ...) with a call to futex(2) itself. > > > > The second part of the diff enables futexes for fiber. > > > > I think this is an improvement over the current state. It went through a > > bulk without fallout. Unless I hear objections, I plan on committing > > this in a few days. > > A piece of the diff is missing. The fiber/detail/config.hpp part. Without > that the > other piece is not built. Ah yes, forgotten cvs add. I'll commit this, then, including the PATCHORIG bit pointed out by gkoehler. Index: Makefile === RCS file: /cvs/ports/devel/boost/Makefile,v diff -u -p -r1.140 Makefile --- Makefile24 Dec 2023 00:26:12 - 1.140 +++ Makefile24 Dec 2023 04:57:15 - @@ -11,8 +11,8 @@ COMMENT-md= machine-dependent libraries VERSION= 1.84.0 DISTNAME= boost_${VERSION:S/./_/g} PKGNAME= boost-${VERSION} -REVISION= 0 -EPOCH =0 +REVISION= 1 +EPOCH= 0 CATEGORIES=devel SITES= https://boostorg.jfrog.io/artifactory/main/release/${VERSION}/source/ EXTRACT_SUFX= .tar.bz2 @@ -151,7 +151,7 @@ do-install: ${INSTALL_DATA_DIR} ${PREFIX}/include/boost ${INSTALL_DATA} ${WRKSRC}/stage/lib/lib!(*.so) ${PREFIX}/lib cd ${WRKSRC}/boost && \ - pax -rw -s ':^.*\.orig$$::' . ${PREFIX}/include/boost + pax -rw -s ':^.*${PATCHORIG}$$::' . ${PREFIX}/include/boost find ${PREFIX}/include/boost -type d -exec chmod ${DIRMODE} {} + find ${PREFIX}/include/boost -type f -exec chmod ${SHAREMODE} {} + # boost-build: @@ -159,11 +159,11 @@ do-install: ${PREFIX}/bin ${INSTALL_DATA_DIR} ${PREFIX}/share/b2 @cd ${WRKSRC}/tools/build/src && \ - pax -r -w -p pm -s ':^./engine.*$$::' -s ':^.*\.orig$$::' . \ + pax -r -w -p pm -s ':^./engine.*$$::' -s ':^.*${PATCHORIG}$$::' . \ ${PREFIX}/share/b2 ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/b2 @cd ${WRKSRC}/tools/build/example && \ - pax -r -w -p pm -s ':^.*\.orig$$::' . \ + pax -r -w -p pm -s ':^.*${PATCHORIG}$$::' . \ ${PREFIX}/share/examples/b2 .include Index: patches/patch-boost_atomic_detail_futex_hpp === RCS file: /cvs/ports/devel/boost/patches/patch-boost_atomic_detail_futex_hpp,v diff -u -p -r1.1 patch-boost_atomic_detail_futex_hpp --- patches/patch-boost_atomic_detail_futex_hpp 28 Oct 2023 14:03:31 - 1.1 +++ patches/patch-boost_atomic_detail_futex_hpp 21 Dec 2023 13:01:02 - @@ -1,44 +1,44 @@ Index: boost/atomic/detail/futex.hpp --- boost/atomic/detail/futex.hpp.orig +++ boost/atomic/detail/futex.hpp -@@ -23,7 +23,7 @@ - #pragma once - #endif +@@ -25,6 +25,7 @@ --#if defined(__linux__) || defined(__OpenBSD__) || defined(__NETBSD__) || defined(__NetBSD__) -+#if defined(__linux__) || defined(__NETBSD__) || defined(__NetBSD__) + #if defined(__linux__) || defined(__OpenBSD__) || defined(__NETBSD__) || defined(__NetBSD__) ++#ifndef __OpenBSD__ #include -@@ -45,8 +45,9 @@ + #if defined(SYS_futex) +@@ -44,9 +45,10 @@ + #define BOOST_ATOMIC_DETAIL_SYS_FUTEX SYS___futex #define BOOST_ATOMIC_DETAIL_NETBSD_FUTEX #endif ++#endif -#if defined(BOOST_ATOMIC_DETAIL_SYS_FUTEX) +#if defined(BOOST_ATOMIC_DETAIL_SYS_FUTEX) || defined(__OpenBSD__) -+ #include #if defined(__linux__) #include -@@ -74,7 +75,9 @@ namespace detail { +@@ -74,7 +76,9 @@ namespace detail { //! Invokes an operation on the futex BOOST_FORCEINLINE int futex_invoke(void* addr1, int op, unsigned int val1, const void* timeout = NULL, void* addr2 = NULL, unsigned int val3 = 0) BOOST_NOEXCEPT { -#if !defined(BOOST_ATOMIC_DETAIL_NETBSD_FUTEX) +#if defined(__OpenBSD__) -+return ::futex(addr1, op, val1, timeout, addr2, 0u, val3); ++return ::futex(static_cast < volatile uint32_t * >(addr1), op, val1, static_cast < const struct timespec * >(timeout), static_cast < volatile uint32_t * >(addr2)); +#elif !defined(BOOST_ATOMIC_DETAIL_NETBSD_FUTEX) return ::syscall(BOOST_ATOMIC_DETAIL_SYS_FUTEX, addr1, op, val1, timeout, addr2, val3); #else // Pass 0 in val2. -@@ -85,7 +88,9 @@ BOOST_FORCEINLINE int futex_invoke(void* addr1, int op +@@ -85,7 +89,9 @@ BOOST_FORCEINLINE int futex_invoke(void* addr1, int op //! Invokes an operation on the futex BOOST_FORCEINLINE int futex_invoke(void* addr1, int op, unsigned int val1, unsigned int val2, void* addr2 = NULL, unsigned int val3 = 0) BOOST_NOEXCEPT
Re: boost futex diff
On 2023-12-23 4:47 a.m., Theo Buehler wrote: This is based on a diff from Brad who noticed that the diff disabling syscall(2) accidentally disabled futexes altogether. This diff reverts to the state prior to that commit by taking the intended approach: replace syscall(SYS_futex, ...) with a call to futex(2) itself. The second part of the diff enables futexes for fiber. I think this is an improvement over the current state. It went through a bulk without fallout. Unless I hear objections, I plan on committing this in a few days. A piece of the diff is missing. The fiber/detail/config.hpp part. Without that the other piece is not built. Index: Makefile === RCS file: /cvs/ports/devel/boost/Makefile,v diff -u -p -r1.139 Makefile --- Makefile19 Dec 2023 06:14:25 - 1.139 +++ Makefile21 Dec 2023 06:43:23 - @@ -11,7 +11,8 @@ COMMENT-md= machine-dependent libraries VERSION= 1.84.0 DISTNAME= boost_${VERSION:S/./_/g} PKGNAME= boost-${VERSION} -EPOCH =0 +REVISION= 0 +EPOCH= 0 CATEGORIES= devel SITES= https://boostorg.jfrog.io/artifactory/main/release/${VERSION}/source/ EXTRACT_SUFX= .tar.bz2 Index: patches/patch-boost_atomic_detail_futex_hpp === RCS file: /cvs/ports/devel/boost/patches/patch-boost_atomic_detail_futex_hpp,v diff -u -p -r1.1 patch-boost_atomic_detail_futex_hpp --- patches/patch-boost_atomic_detail_futex_hpp 28 Oct 2023 14:03:31 - 1.1 +++ patches/patch-boost_atomic_detail_futex_hpp 21 Dec 2023 07:22:52 - @@ -1,44 +1,44 @@ Index: boost/atomic/detail/futex.hpp --- boost/atomic/detail/futex.hpp.orig +++ boost/atomic/detail/futex.hpp -@@ -23,7 +23,7 @@ - #pragma once - #endif +@@ -25,6 +25,7 @@ --#if defined(__linux__) || defined(__OpenBSD__) || defined(__NETBSD__) || defined(__NetBSD__) -+#if defined(__linux__) || defined(__NETBSD__) || defined(__NetBSD__) + #if defined(__linux__) || defined(__OpenBSD__) || defined(__NETBSD__) || defined(__NetBSD__) ++#ifndef __OpenBSD__ #include -@@ -45,8 +45,9 @@ + #if defined(SYS_futex) +@@ -44,9 +45,10 @@ + #define BOOST_ATOMIC_DETAIL_SYS_FUTEX SYS___futex #define BOOST_ATOMIC_DETAIL_NETBSD_FUTEX #endif ++#endif -#if defined(BOOST_ATOMIC_DETAIL_SYS_FUTEX) +#if defined(BOOST_ATOMIC_DETAIL_SYS_FUTEX) || defined(__OpenBSD__) -+ #include #if defined(__linux__) #include -@@ -74,7 +75,9 @@ namespace detail { +@@ -74,7 +76,9 @@ namespace detail { //! Invokes an operation on the futex BOOST_FORCEINLINE int futex_invoke(void* addr1, int op, unsigned int val1, const void* timeout = NULL, void* addr2 = NULL, unsigned int val3 = 0) BOOST_NOEXCEPT { -#if !defined(BOOST_ATOMIC_DETAIL_NETBSD_FUTEX) +#if defined(__OpenBSD__) -+return ::futex(addr1, op, val1, timeout, addr2, 0u, val3); ++return ::futex(static_cast < volatile uint32_t * >(addr1), op, val1, static_cast < const struct timespec * >(timeout), static_cast < volatile uint32_t * >(addr2)); +#elif !defined(BOOST_ATOMIC_DETAIL_NETBSD_FUTEX) return ::syscall(BOOST_ATOMIC_DETAIL_SYS_FUTEX, addr1, op, val1, timeout, addr2, val3); #else // Pass 0 in val2. -@@ -85,7 +88,9 @@ BOOST_FORCEINLINE int futex_invoke(void* addr1, int op +@@ -85,7 +89,9 @@ BOOST_FORCEINLINE int futex_invoke(void* addr1, int op //! Invokes an operation on the futex BOOST_FORCEINLINE int futex_invoke(void* addr1, int op, unsigned int val1, unsigned int val2, void* addr2 = NULL, unsigned int val3 = 0) BOOST_NOEXCEPT { -#if !defined(BOOST_ATOMIC_DETAIL_NETBSD_FUTEX) +#if defined(__OpenBSD__) -+return futex(addr1, op, val1, static_cast< void* >(NULL), addr2, val2, val3); ++return futex(static_cast < volatile uint32_t * >(addr1), op, val1, nullptr, static_cast < volatile uint32_t * >(addr2)); +#elif !defined(BOOST_ATOMIC_DETAIL_NETBSD_FUTEX) return ::syscall(BOOST_ATOMIC_DETAIL_SYS_FUTEX, addr1, op, val1, static_cast< atomics::detail::uintptr_t >(val2), addr2, val3); #else Index: patches/patch-boost_fiber_detail_futex_hpp === RCS file: /cvs/ports/devel/boost/patches/patch-boost_fiber_detail_futex_hpp,v diff -u -p -r1.1 patch-boost_fiber_detail_futex_hpp --- patches/patch-boost_fiber_detail_futex_hpp 28 Oct 2023 14:03:31 - 1.1 +++ patches/patch-boost_fiber_detail_futex_hpp 21 Dec 2023 07:28:14 - @@ -1,12 +1,27 @@ Index: boost/fiber/detail/futex.hpp --- boost/fiber/detail/futex.hpp.orig +++ boost/fiber/detail/futex.hpp -@@ -32,7 +32,11 @@ namespace detail { - #if BOOST_OS_LINUX +@@ -21,6 +21,10 @@ extern "C" { + #include + #include + } ++#elif BOOST_OS_BSD_OPEN ++extern "C" { ++#include ++} + #elif BOOST_OS_WINDOWS + #include + #endif +@@ -29,10 +33,14 @@ namespace boost { + namespace fibers { + names
boost futex diff
This is based on a diff from Brad who noticed that the diff disabling syscall(2) accidentally disabled futexes altogether. This diff reverts to the state prior to that commit by taking the intended approach: replace syscall(SYS_futex, ...) with a call to futex(2) itself. The second part of the diff enables futexes for fiber. I think this is an improvement over the current state. It went through a bulk without fallout. Unless I hear objections, I plan on committing this in a few days. Index: Makefile === RCS file: /cvs/ports/devel/boost/Makefile,v diff -u -p -r1.139 Makefile --- Makefile19 Dec 2023 06:14:25 - 1.139 +++ Makefile21 Dec 2023 06:43:23 - @@ -11,7 +11,8 @@ COMMENT-md= machine-dependent libraries VERSION= 1.84.0 DISTNAME= boost_${VERSION:S/./_/g} PKGNAME= boost-${VERSION} -EPOCH =0 +REVISION= 0 +EPOCH= 0 CATEGORIES=devel SITES= https://boostorg.jfrog.io/artifactory/main/release/${VERSION}/source/ EXTRACT_SUFX= .tar.bz2 Index: patches/patch-boost_atomic_detail_futex_hpp === RCS file: /cvs/ports/devel/boost/patches/patch-boost_atomic_detail_futex_hpp,v diff -u -p -r1.1 patch-boost_atomic_detail_futex_hpp --- patches/patch-boost_atomic_detail_futex_hpp 28 Oct 2023 14:03:31 - 1.1 +++ patches/patch-boost_atomic_detail_futex_hpp 21 Dec 2023 07:22:52 - @@ -1,44 +1,44 @@ Index: boost/atomic/detail/futex.hpp --- boost/atomic/detail/futex.hpp.orig +++ boost/atomic/detail/futex.hpp -@@ -23,7 +23,7 @@ - #pragma once - #endif +@@ -25,6 +25,7 @@ --#if defined(__linux__) || defined(__OpenBSD__) || defined(__NETBSD__) || defined(__NetBSD__) -+#if defined(__linux__) || defined(__NETBSD__) || defined(__NetBSD__) + #if defined(__linux__) || defined(__OpenBSD__) || defined(__NETBSD__) || defined(__NetBSD__) ++#ifndef __OpenBSD__ #include -@@ -45,8 +45,9 @@ + #if defined(SYS_futex) +@@ -44,9 +45,10 @@ + #define BOOST_ATOMIC_DETAIL_SYS_FUTEX SYS___futex #define BOOST_ATOMIC_DETAIL_NETBSD_FUTEX #endif ++#endif -#if defined(BOOST_ATOMIC_DETAIL_SYS_FUTEX) +#if defined(BOOST_ATOMIC_DETAIL_SYS_FUTEX) || defined(__OpenBSD__) -+ #include #if defined(__linux__) #include -@@ -74,7 +75,9 @@ namespace detail { +@@ -74,7 +76,9 @@ namespace detail { //! Invokes an operation on the futex BOOST_FORCEINLINE int futex_invoke(void* addr1, int op, unsigned int val1, const void* timeout = NULL, void* addr2 = NULL, unsigned int val3 = 0) BOOST_NOEXCEPT { -#if !defined(BOOST_ATOMIC_DETAIL_NETBSD_FUTEX) +#if defined(__OpenBSD__) -+return ::futex(addr1, op, val1, timeout, addr2, 0u, val3); ++return ::futex(static_cast < volatile uint32_t * >(addr1), op, val1, static_cast < const struct timespec * >(timeout), static_cast < volatile uint32_t * >(addr2)); +#elif !defined(BOOST_ATOMIC_DETAIL_NETBSD_FUTEX) return ::syscall(BOOST_ATOMIC_DETAIL_SYS_FUTEX, addr1, op, val1, timeout, addr2, val3); #else // Pass 0 in val2. -@@ -85,7 +88,9 @@ BOOST_FORCEINLINE int futex_invoke(void* addr1, int op +@@ -85,7 +89,9 @@ BOOST_FORCEINLINE int futex_invoke(void* addr1, int op //! Invokes an operation on the futex BOOST_FORCEINLINE int futex_invoke(void* addr1, int op, unsigned int val1, unsigned int val2, void* addr2 = NULL, unsigned int val3 = 0) BOOST_NOEXCEPT { -#if !defined(BOOST_ATOMIC_DETAIL_NETBSD_FUTEX) +#if defined(__OpenBSD__) -+return futex(addr1, op, val1, static_cast< void* >(NULL), addr2, val2, val3); ++return futex(static_cast < volatile uint32_t * >(addr1), op, val1, nullptr, static_cast < volatile uint32_t * >(addr2)); +#elif !defined(BOOST_ATOMIC_DETAIL_NETBSD_FUTEX) return ::syscall(BOOST_ATOMIC_DETAIL_SYS_FUTEX, addr1, op, val1, static_cast< atomics::detail::uintptr_t >(val2), addr2, val3); #else Index: patches/patch-boost_fiber_detail_futex_hpp === RCS file: /cvs/ports/devel/boost/patches/patch-boost_fiber_detail_futex_hpp,v diff -u -p -r1.1 patch-boost_fiber_detail_futex_hpp --- patches/patch-boost_fiber_detail_futex_hpp 28 Oct 2023 14:03:31 - 1.1 +++ patches/patch-boost_fiber_detail_futex_hpp 21 Dec 2023 07:28:14 - @@ -1,12 +1,27 @@ Index: boost/fiber/detail/futex.hpp --- boost/fiber/detail/futex.hpp.orig +++ boost/fiber/detail/futex.hpp -@@ -32,7 +32,11 @@ namespace detail { - #if BOOST_OS_LINUX +@@ -21,6 +21,10 @@ extern "C" { + #include + #include + } ++#elif BOOST_OS_BSD_OPEN ++extern "C" { ++#include ++} + #elif BOOST_OS_WINDOWS + #include + #endif +@@ -29,10 +33,14 @@ namespace boost { + namespace fibers { + namespace detail { + +-#if BOOST_OS_LINUX ++#if BOOST_OS_LINUX || BOOST_OS_BSD_OPEN BOOST_FORCEINLINE int sys_futex( void * addr, std::int32_t op, std::int32_t x) { -+if defined(__OpenBSD__) -+return ::f