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
--- Makefile    24 Dec 2023 00:26:12 -0000      1.140
+++ Makefile    24 Dec 2023 04:57:15 -0000
@@ -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 <bsd.port.mk>
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 -0000      
1.1
+++ patches/patch-boost_atomic_detail_futex_hpp 21 Dec 2023 13:01:02 -0000
@@ -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 <sys/syscall.h>
  
-@@ -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 <cstddef>
  #if defined(__linux__)
  #include <linux/futex.h>
-@@ -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_config_hpp
===================================================================
RCS file: patches/patch-boost_fiber_detail_config_hpp
diff -N patches/patch-boost_fiber_detail_config_hpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-boost_fiber_detail_config_hpp 24 Dec 2023 04:46:44 -0000
@@ -0,0 +1,12 @@
+Index: boost/fiber/detail/config.hpp
+--- boost/fiber/detail/config.hpp.orig
++++ boost/fiber/detail/config.hpp
+@@ -38,7 +38,7 @@
+ # include <boost/config/auto_link.hpp>
+ #endif
+ 
+-#if BOOST_OS_LINUX || BOOST_OS_WINDOWS
++#if BOOST_OS_LINUX || BOOST_OS_BSD_OPEN || BOOST_OS_WINDOWS
+ # define BOOST_FIBERS_HAS_FUTEX
+ #endif
+ 
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 -0000      
1.1
+++ patches/patch-boost_fiber_detail_futex_hpp  21 Dec 2023 13:01:02 -0000
@@ -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 <linux/futex.h>
+ #include <sys/syscall.h>
+ }
++#elif BOOST_OS_BSD_OPEN
++extern "C" {
++#include <sys/futex.h>
++}
+ #elif BOOST_OS_WINDOWS
+ #include <windows.h>
+ #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 ::futex(addr, op, x, nullptr, nullptr, 0);
++#if BOOST_OS_BSD_OPEN
++    return ::futex( static_cast < volatile uint32_t * >(addr), op, x, 
nullptr, nullptr);
 +#else
      return ::syscall( SYS_futex, addr, op, x, nullptr, nullptr, 0);
 +#endif

Reply via email to