bsd-user: Propagate alignment argument to mmap_find_vma()

Propagate the alignment to mmap_find_vma(), effectively
embedding mmap_find_vma_aligned() within mmap_find_vma().

Add a comment in do_bsd_shmat() to clarify alignment above
page size is not required.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Warner Losh <imp@bsdimp.com>
Message-Id: <20250308122842.76377-3-philmd@linaro.org>
This commit is contained in:
Philippe Mathieu-Daudé 2025-03-07 13:47:21 +01:00
parent 019b4e84ed
commit 84d66261be
3 changed files with 6 additions and 10 deletions

View file

@ -370,9 +370,11 @@ static inline abi_long do_bsd_shmat(int shmid, abi_ulong shmaddr, int shmflg)
if (shmaddr) {
host_raddr = shmat(shmid, (void *)g2h_untagged(shmaddr), shmflg);
} else {
abi_ulong alignment;
abi_ulong mmap_start;
mmap_start = mmap_find_vma(0, shm_info.shm_segsz);
alignment = 0; /* alignment above page size not required */
mmap_start = mmap_find_vma(0, shm_info.shm_segsz, alignment);
if (mmap_start == -1) {
return -TARGET_ENOMEM;