]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Darwin: add sigwait syscall wrapper
authorPaul Floyd <pjfloyd@wanadoo.fr>
Thu, 23 Nov 2023 06:24:11 +0000 (07:24 +0100)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Thu, 23 Nov 2023 06:24:11 +0000 (07:24 +0100)
The FreeBSD testcase doesn't work, but the problem seems
to be with the initial signal()/raise(). Needs more work.

coregrind/m_syswrap/priv_syswrap-darwin.h
coregrind/m_syswrap/syswrap-darwin.c
include/vki/vki-scnums-darwin.h

index cb31fb51b11417e0fef770ac99bc5f0fcaf0b168..c2dd3507f07e2b5955ca2cebdd01a68634101b1d 100644 (file)
@@ -421,7 +421,7 @@ DECL_TEMPLATE(darwin, aio_write);              // 319
 DECL_TEMPLATE(darwin, issetugid);               // 327
 DECL_TEMPLATE(darwin, __pthread_kill);          // 328
 DECL_TEMPLATE(darwin, __pthread_sigmask);       // 329
-// NYI __sigwait 330
+DECL_TEMPLATE(darwin, __sigwait);               // 330
 DECL_TEMPLATE(darwin, __disable_threadsignal);  // 331
 DECL_TEMPLATE(darwin, __pthread_markcancel);    // 332
 DECL_TEMPLATE(darwin, __pthread_canceled);      // 333
index 8de5ae737947f66f1d03b5999a1ccddda8428e11..175ea27b32d2277a79a69c8d98900d9dcbad695c 100644 (file)
@@ -2325,6 +2325,30 @@ POST(__pthread_sigmask)
 }
 
 
+// SYS___sigwait 330
+// int  sigwait(const sigset_t * __restrict, int * __restrict) __DARWIN_ALIAS_C(sigwait);
+PRE(__sigwait)
+{
+    *flags |= SfMayBlock;
+    PRINT("sys_sigwait ( %#" FMT_REGWORD "x, %#" FMT_REGWORD "x )",
+          ARG1,ARG2);
+    PRE_REG_READ2(int, "sigwait",
+                  const vki_sigset_t *, set, int *, sig);
+    if (ARG1 != 0) {
+        PRE_MEM_READ(  "sigwait(set)",  ARG1, sizeof(vki_sigset_t));
+    }
+    if (ARG2 != 0) {
+        PRE_MEM_WRITE( "sigwait(sig)", ARG2, sizeof(int));
+    }
+}
+
+POST(__sigwait)
+{
+    if (ARG2 != 0) {
+        POST_MEM_WRITE( ARG2, sizeof(int));
+    }
+}
+
 PRE(__pthread_canceled)
 {
    *flags |= SfMayBlock; /* might kill this thread??? */
@@ -10597,7 +10621,7 @@ const SyscallTableEntry ML_(syscall_table)[] = {
    MACX_(__NR_issetugid,               issetugid), 
    MACX_(__NR___pthread_kill,          __pthread_kill),
    MACX_(__NR___pthread_sigmask,       __pthread_sigmask), 
-// _____(__NR___sigwait), 
+   MACXY(__NR___sigwait,               __sigwait),  // 330
    MACX_(__NR___disable_threadsignal,  __disable_threadsignal), 
    MACX_(__NR___pthread_markcancel,    __pthread_markcancel), 
    MACX_(__NR___pthread_canceled,      __pthread_canceled),
index 7af0465c54319d8e04ad1ade55975bcb24b03569..3aa35d1fc66df398b7c7c30eddf85f4584f9a402 100644 (file)
 #define        __NR_issetugid      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(327)
 #define        __NR___pthread_kill VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(328)
 #define        __NR___pthread_sigmask VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(329)
-#define        __NR___sigwait        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(330)
+#define __NR___sigwait      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(330)
 #define        __NR___disable_threadsignal VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(331)
 #define        __NR___pthread_markcancel VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(332)
 #define        __NR___pthread_canceled VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(333)