]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
FreeBSD: fix internal sysctlbyname
authorPaul Floyd <pjfloyd@wanadoo.fr>
Fri, 3 Feb 2023 12:51:04 +0000 (13:51 +0100)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Fri, 3 Feb 2023 12:51:04 +0000 (13:51 +0100)
I used the libc interface rather than the syscall interface.
The syscall also has the name length which libc adds.

coregrind/m_libcproc.c

index 55bb7cbf9761bbf2a8800571dc16c71162777c41..592d69bf139f8f0e2e9dafc5e85114d40d8e157e 100644 (file)
@@ -1200,8 +1200,9 @@ void VG_(do_atfork_child)(ThreadId tid)
 #if defined(VGO_freebsd)
 Int VG_(sysctlbyname)(const HChar *name, void *oldp, SizeT *oldlenp, const void *newp, SizeT newlen)
 {
+   vg_assert(name);
 #if (FREEBSD_VERS >= FREEBSD_12_2)
-   SysRes res = VG_(do_syscall5)(__NR___sysctlbyname, (UWord)name, (UWord)oldp, (UWord)oldlenp, (UWord)newp, (UWord)newlen);
+   SysRes res = VG_(do_syscall6)(__NR___sysctlbyname, (RegWord)name, VG_(strlen)(name), (RegWord)oldp, (RegWord)oldlenp, (RegWord)newp, (RegWord)newlen);
    return sr_isError(res) ? -1 : sr_Res(res);
 #else
    Int oid[2];