Something installed this library on my machine, so it came up when
looking for future fallout.

Patch looks simple, 'nm libtbb.so.* | grep syscall' shows the symbol
gone and check_syms agrees:

        /l/lib/libtbb.so.1.0 --> 
/p/pobj/tbb-2020.3.3/fake-amd64/usr/local/lib/libtbb.so.1.0
        Dynamic export changes:
        removed:
                _ZN3tbb8internal3rml14private_worker14wake_or_launchEv

        External reference changes:
        removed:
                syscall

        PLT removed:
                _ZN3tbb8internal3rml14private_worker14wake_or_launchEv

I don't know or use tbb or any of its reverse dependencies, hence this
diff not being tested;  'make test' is still running...

Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/tbb/Makefile,v
diff -u -p -r1.7 Makefile
--- Makefile    29 May 2023 17:50:03 -0000      1.7
+++ Makefile    27 Oct 2023 20:15:27 -0000
@@ -7,8 +7,9 @@ GH_ACCOUNT =            oneapi-src
 GH_PROJECT =           oneTBB
 GH_TAGNAME =           v${V}
 PKGNAME =              tbb-${V}
+REVISION =             0
 
-SHARED_LIBS +=         tbb             1.0     #2020.3
+SHARED_LIBS +=         tbb             2.0     #2020.3
 SHARED_LIBS +=         tbbmalloc       1.0     #2020.3
 
 CATEGORIES =           devel
Index: patches/patch-include_tbb_machine_linux_common_h
===================================================================
RCS file: patches/patch-include_tbb_machine_linux_common_h
diff -N patches/patch-include_tbb_machine_linux_common_h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-include_tbb_machine_linux_common_h    27 Oct 2023 20:15:58 
-0000
@@ -0,0 +1,44 @@
+Use futex(2) not syscall(2)
+
+Index: include/tbb/machine/linux_common.h
+--- include/tbb/machine/linux_common.h.orig
++++ include/tbb/machine/linux_common.h
+@@ -22,8 +22,6 @@
+ #define __TBB_Yield()  sched_yield()
+ 
+ #include <unistd.h>
+-/* Futex definitions */
+-#include <sys/syscall.h>
+ 
+ #if defined(SYS_futex)
+ /* This header file is included for Linux and some other systems that may 
support futexes.*/
+@@ -77,8 +75,8 @@ namespace tbb {
+ 
+ namespace internal {
+ 
+-inline int futex_wait( void *futex, int comparand ) {
+-    int r = syscall( SYS_futex,futex,__TBB_FUTEX_WAIT,comparand,NULL,NULL,0 );
++inline int futex_wait( void *uaddr, int comparand ) {
++    int r = futex(uaddr,FUTEX_WAIT,comparand,NULL,NULL );
+ #if TBB_USE_ASSERT
+     int e = errno;
+     __TBB_ASSERT( r==0||r==EWOULDBLOCK||(r==-1&&(e==EAGAIN||e==EINTR)), 
"futex_wait failed." );
+@@ -86,14 +84,14 @@ inline int futex_wait( void *futex, int comparand ) {
+     return r;
+ }
+ 
+-inline int futex_wakeup_one( void *futex ) {
+-    int r = ::syscall( SYS_futex,futex,__TBB_FUTEX_WAKE,1,NULL,NULL,0 );
++inline int futex_wakeup_one( void *uaddr ) {
++    int r = futex(uaddr,__TBB_FUTEX_WAKE,1,NULL,NULL );
+     __TBB_ASSERT( r==0||r==1, "futex_wakeup_one: more than one thread woken 
up?" );
+     return r;
+ }
+ 
+-inline int futex_wakeup_all( void *futex ) {
+-    int r = ::syscall( SYS_futex,futex,__TBB_FUTEX_WAKE,INT_MAX,NULL,NULL,0 );
++inline int futex_wakeup_all( void *uaddr ) {
++    int r = futex(uaddr,__TBB_FUTEX_WAKE,INT_MAX,NULL,NULL );
+     __TBB_ASSERT( r>=0, "futex_wakeup_all: error in waking up threads" );
+     return r;
+ }

Reply via email to