On Fri, 2018-04-13 at 05:56 -0400, IMoL wrote:
> git-1f08787cf (of 11 April) fails to build on macOS:
> 
> m_syswrap/syswrap-generic.c:1797:26: error: variable has incomplete type 
> 'struct vki_semid64_ds'
>    struct vki_semid64_ds buf;
>                          ^
> m_syswrap/syswrap-generic.c:1797:11: note: forward declaration of 'struct 
> vki_semid64_ds'
>    struct vki_semid64_ds buf;
>           ^
> m_syswrap/syswrap-generic.c:1798:8: error: no member named 'buf64' in 'union 
> semun'
>    arg.buf64 = &buf;
>    ~~~ ^
> 
> 
> Looks related to this commit from 1 April (git-54145019b):
> 
> "n-i-bz Fix possible stack trashing by semctl syscall wrapping" 
Can you try the attached patch ?
Thanks
Philippe
diff --git a/coregrind/m_syswrap/syswrap-generic.c 
b/coregrind/m_syswrap/syswrap-generic.c
index 5bb6f47df..8b3d6fc72 100644
--- a/coregrind/m_syswrap/syswrap-generic.c
+++ b/coregrind/m_syswrap/syswrap-generic.c
@@ -1794,13 +1794,20 @@ UInt get_sem_count( Int semid )
    SysRes res;
 
 #  if defined(__NR_semctl)
+#  if defined(VGO_darwin)
+   /* Darwin has no specific 64 bit semid_ds, but has __NR_semctl. */
+   struct vki_semid_ds buf;
+   arg.buf = &buf;
+#  else
    struct vki_semid64_ds buf;
    arg.buf64 = &buf;
+#  endif
    res = VG_(do_syscall4)(__NR_semctl, semid, 0, VKI_IPC_STAT, *(UWord *)&arg);
    if (sr_isError(res))
       return 0;
 
    return buf.sem_nsems;
+
 #  elif defined(__NR_semsys) /* Solaris */
    struct vki_semid_ds buf;
    arg.buf = &buf;
@@ -1810,6 +1817,7 @@ UInt get_sem_count( Int semid )
       return 0;
 
    return buf.sem_nsems;
+
 #  else
    struct vki_semid_ds buf;
    arg.buf = &buf;
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to