Where could I find the definition of __vm_deallocate() called by __munmap()?
ur bridge
urbridge@outlook.com
Sun Aug 1 13:05:58 GMT 2021
Thank you, Florian,
I tried to locate __vm_deallocate()’s definition in glibc by grep, and found only a hidden_proto in sysdeps/mach/include/mach-shortcuts-hidden, with no actual implementation.
Is its code included in glibc? If not, how could glibc be built from the source?
Given that __mmap() will call the syscall mmap(), I can understand only if __munmap() is a thin wrapper for syscall munmap(), but it calls __vm_deallocate(). How does this mismatch work? How could Hurd’s code touch the necessary structures (e.g. vma, managed by Linux kernel) to handle the unmapping?
Re: Where could I find the definition of __vm_deallocate() called by __munmap()?
* ur bridge via Libc-help:
> I’m reading the malloc.c code, and find that when __munmap() is called
> to free a mmapped chunk, the control flow will fall into
> sysdeps/mach/munmap.c, where __vm_deallocate() will be
> called. However, I cannot find its definition. Where could it be?
This is Hurd code. For Linux, __munmap is indeed a thin system call
wrapper.
Thanks,
Florian
More information about the Libc-help
mailing list