From: Paul Floyd Date: Sat, 6 Sep 2025 14:49:10 +0000 (+0200) Subject: Solaris 11: fix for VG_(lstat) X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=68f06cbe97ba4d36ab94ad5f3a199d91c2298e5c;p=thirdparty%2Fvalgrind.git Solaris 11: fix for VG_(lstat) This function was using SYS_lstat. It works OK with illumos but not Solaris 11+ which has removed that syscall. Instead do like Linux and FreeBSD, use SYS_fstatat with the flag for no follow link. --- diff --git a/coregrind/m_libcfile.c b/coregrind/m_libcfile.c index 6addb8761..ea8a56b9c 100644 --- a/coregrind/m_libcfile.c +++ b/coregrind/m_libcfile.c @@ -700,9 +700,20 @@ struct vki_stat buf; res = VG_(do_syscall4)(__NR_fstatat, VKI_AT_FDCWD, (UWord)file_name, (UWord)&buf, VKI_AT_SYMLINK_NOFOLLOW); #endif +#elif defined(VGO_solaris) + + struct vki_stat buf; +#if defined(SOLARIS_OLD_SYSCALLS) + // illumos + res = VG_(do_syscall2)(__NR_lstat, (UWord)file_name, (UWord)&buf); +#else + // Solaris 11+ + res = VG_(do_syscall4)(__NR_fstatat, VKI_AT_FDCWD, (UWord)file_name, (UWord)&buf, VKI_AT_SYMLINK_NOFOLLOW); +#endif + #else - /* check this on illumos and Darwin */ + /* check this on Darwin */ struct vki_stat buf; res = VG_(do_syscall2)(__NR_lstat, (UWord)file_name, (UWord)&buf); diff --git a/include/vki/vki-solaris.h b/include/vki/vki-solaris.h index 9c96ed19e..18d976700 100644 --- a/include/vki/vki-solaris.h +++ b/include/vki/vki-solaris.h @@ -100,6 +100,7 @@ typedef uint32_t vki_u32; #include #define VKI_SEEK_SET SEEK_SET +#define VKI_AT_SYMLINK_NOFOLLOW AT_SYMLINK_NOFOLLOW #include