From: Paul Floyd Date: Tue, 28 Nov 2023 07:00:19 +0000 (+0100) Subject: Bug 477630 - Include ucontext.h rather than sys/ucontext.h in Solaris sources X-Git-Tag: VALGRIND_3_23_0~236 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=03180d4403b2b6e849d0a311584ed8b1e6528158;p=thirdparty%2Fvalgrind.git Bug 477630 - Include ucontext.h rather than sys/ucontext.h in Solaris sources Patch provided by Jakub Kulik kulikjak@gmail.com --- diff --git a/NEWS b/NEWS index 714f9acc5b..fd581163bc 100644 --- a/NEWS +++ b/NEWS @@ -42,6 +42,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 476787 Build of Valgrind 3.21.0 fails when SOLARIS_PT_SUNDWTRACE_THRP is defined 476887 WARNING: unhandled amd64-freebsd syscall: 578 +477630 Include ucontext.h rather than sys/ucontext.h in Solaris sources To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/coregrind/m_aspacemgr/aspacemgr-common.c b/coregrind/m_aspacemgr/aspacemgr-common.c index 816d2274f4..7ad1b40acf 100644 --- a/coregrind/m_aspacemgr/aspacemgr-common.c +++ b/coregrind/m_aspacemgr/aspacemgr-common.c @@ -223,7 +223,7 @@ SysRes ML_(am_do_extend_mapping_NO_NOTIFY)( /* Extend the mapping old_addr .. old_addr+old_len-1 to have length new_len, WITHOUT moving it. If it can't be extended in place, fail. */ -# if defined(VGO_linux) +# if defined(VGO_linux) || defined(VGO_solaris) return VG_(do_syscall5)( __NR_mremap, old_addr, old_len, new_len, @@ -244,7 +244,7 @@ SysRes ML_(am_do_relocate_nooverlap_mapping_NO_NOTIFY)( location and with the new length. Only needs to handle the case where the two areas do not overlap, neither length is zero, and all args are page aligned. */ -# if defined(VGO_linux) +# if defined(VGO_linux) || defined(VGO_solaris) return VG_(do_syscall5)( __NR_mremap, old_addr, old_len, new_len, diff --git a/coregrind/m_syswrap/syswrap-solaris.c b/coregrind/m_syswrap/syswrap-solaris.c index b5489644c1..5bd0498491 100644 --- a/coregrind/m_syswrap/syswrap-solaris.c +++ b/coregrind/m_syswrap/syswrap-solaris.c @@ -10953,6 +10953,9 @@ static SyscallTableEntry syscall_table[] = { #if defined(SOLARIS_UUIDSYS_SYSCALL) SOLXY(__NR_uuidsys, sys_uuidsys), /* 124 */ #endif /* SOLARIS_UUIDSYS_SYSCALL */ +#if defined(HAVE_MREMAP) + GENX_(__NR_mremap, sys_mremap), /* 126 */ +#endif /* HAVE_MREMAP */ SOLX_(__NR_mmapobj, sys_mmapobj), /* 127 */ GENX_(__NR_setrlimit, sys_setrlimit), /* 128 */ GENXY(__NR_getrlimit, sys_getrlimit), /* 129 */ diff --git a/include/vki/vki-scnums-solaris.h b/include/vki/vki-scnums-solaris.h index 99388091a8..25bde39d84 100644 --- a/include/vki/vki-scnums-solaris.h +++ b/include/vki/vki-scnums-solaris.h @@ -33,6 +33,8 @@ #ifndef __VKI_SCNUMS_SOLARIS_H #define __VKI_SCNUMS_SOLARIS_H +#include "config.h" + /* Note: Basic information about Solaris syscalls can be found in the kernel source file uts/common/os/sysent.c. */ @@ -178,6 +180,9 @@ #if defined(SOLARIS_UUIDSYS_SYSCALL) #define __NR_uuidsys SYS_uuidsys #endif /* SOLARIS_UUIDSYS_SYSCALL */ +#if defined(HAVE_MREMAP) +#define __NR_mremap SYS_mremap +#endif /* HAVE_MREMAP */ #define __NR_mmapobj SYS_mmapobj #define __NR_setrlimit SYS_setrlimit #define __NR_getrlimit SYS_getrlimit diff --git a/include/vki/vki-solaris.h b/include/vki/vki-solaris.h index 9fdf53c419..c0e950bbd9 100644 --- a/include/vki/vki-solaris.h +++ b/include/vki/vki-solaris.h @@ -663,6 +663,11 @@ typedef struct vki_kcf_door_arg_s { #define vki_meminfo_t meminfo_t +#if defined(HAVE_MREMAP) +#define VKI_MREMAP_FIXED MREMAP_FIXED +#define VKI_MREMAP_MAYMOVE MREMAP_MAYMOVE +#endif /* HAVE_MREMAP */ + #include #define VKI_MNTIOC_GETEXTMNTENT MNTIOC_GETEXTMNTENT