From: Paul Floyd Date: Sun, 26 Jan 2025 06:21:08 +0000 (+0100) Subject: Darwin syscall: add wrapper for mkdirat X-Git-Tag: VALGRIND_3_25_0~161 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=de365595060cf454056c166096a9e3ddaf14c8dd;p=thirdparty%2Fvalgrind.git Darwin syscall: add wrapper for mkdirat --- diff --git a/coregrind/m_syswrap/priv_syswrap-darwin.h b/coregrind/m_syswrap/priv_syswrap-darwin.h index c0313fd7c..4435f8b57 100644 --- a/coregrind/m_syswrap/priv_syswrap-darwin.h +++ b/coregrind/m_syswrap/priv_syswrap-darwin.h @@ -592,7 +592,7 @@ DECL_TEMPLATE(darwin, fstatat64); // 470 // NYI unlinkat // 472 DECL_TEMPLATE(darwin, readlinkat); // 473 // NYI symlinkat // 474 -// NYI mkdirat // 475 +DECL_TEMPLATE(darwin, mkdirat); // 475 // NYI getattrlistat // 476 // NYI proc_trace_log // 477 DECL_TEMPLATE(darwin, bsdthread_ctl); // 478 diff --git a/coregrind/m_syswrap/syswrap-darwin.c b/coregrind/m_syswrap/syswrap-darwin.c index 6b0f59149..8aaf8fc83 100644 --- a/coregrind/m_syswrap/syswrap-darwin.c +++ b/coregrind/m_syswrap/syswrap-darwin.c @@ -2339,7 +2339,7 @@ POST(__pthread_sigmask) PRE(__sigwait) { *flags |= SfMayBlock; - PRINT("sys_sigwait ( %#" FMT_REGWORD "x, %#" FMT_REGWORD "x )", + PRINT("__sigwait ( %#" FMT_REGWORD "x, %#" FMT_REGWORD "x )", ARG1,ARG2); PRE_REG_READ2(int, "sigwait", const vki_sigset_t *, set, int *, sig); @@ -3074,7 +3074,7 @@ PRE(mount) // We are conservative and check everything, except the memory pointed to // by 'data'. *flags |= SfMayBlock; - PRINT("sys_mount( %#lx(%s), %#lx(%s), %#lx, %#lx )", + PRINT("mount( %#lx(%s), %#lx(%s), %#lx, %#lx )", ARG1, (HChar*)ARG1, ARG2, (HChar*)ARG2, ARG3, ARG4); PRE_REG_READ4(long, "mount", const char *, type, const char *, dir, @@ -9979,13 +9979,13 @@ PRE(openat) { if (ARG3 & VKI_O_CREAT) { // 4-arg version - PRINT("sys_openat ( %ld, %#" FMT_REGWORD "x(%s), %ld, %ld )", + PRINT("openat ( %ld, %#" FMT_REGWORD "x(%s), %ld, %ld )", SARG1, ARG2, (HChar*)(Addr)ARG2, SARG3, SARG4); PRE_REG_READ4(long, "openat", int, dfd, const char *, filename, int, flags, int, mode); } else { // 3-arg version - PRINT("sys_openat ( %ld, %#" FMT_REGWORD "x(%s), %ld )", + PRINT("openat ( %ld, %#" FMT_REGWORD "x(%s), %ld )", SARG1, ARG2, (HChar*)(Addr)ARG2, SARG3); PRE_REG_READ3(long, "openat", int, dfd, const char *, filename, int, flags); @@ -10017,6 +10017,15 @@ POST(openat) } } +PRE(mkdirat) +{ + PRINT("mkdirat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), %" FMT_REGWORD "u )", ARG1,ARG2,(char*)ARG2,ARG3); + PRE_REG_READ3(int, "mkdirat", + int, fd, const char *, path, unsigned int, mode); + PRE_MEM_RASCIIZ( "mkdirat(path)", ARG2 ); + *flags |= SfMayBlock; +} + #endif /* DARWIN_VERS >= DARWIN_10_10 */ @@ -11085,6 +11094,7 @@ const SyscallTableEntry ML_(syscall_table)[] = { MACXY(__NR_necp_match_policy, necp_match_policy), // 460 MACXY(__NR_getattrlistbulk, getattrlistbulk), // 461 MACXY(__NR_openat, openat), // 463 + MACX_(__NR_mkdirat, mkdirat), // 475 #if DARWIN_VERS >= DARWIN_10_13 MACXY(__NR_openat_nocancel, openat_nocancel), // 464 #endif diff --git a/include/vki/vki-scnums-darwin.h b/include/vki/vki-scnums-darwin.h index 2abc8aea8..8eee21ec4 100644 --- a/include/vki/vki-scnums-darwin.h +++ b/include/vki/vki-scnums-darwin.h @@ -776,6 +776,7 @@ #if DARWIN_VERS >= DARWIN_10_10 #define __NR_openat VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(463) +#define __NR_mkdirat VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(475) #if DARWIN_VERS >= DARWIN_10_13 #define __NR_openat_nocancel VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(464) #endif