Re: The unfamiliar world of OS X syscalls

Published on Christian Mayer's Weblog


Alex Clemmer in his post:

I don’t know what shared_region_check_np is doing - I couldn’t find it on google.

When dealing with OS X functions it is often a good choice to grep all over the source files from OS X: The extracted 734 MB gzip files from OS X 10.10 are about 2.3 GB big.

In this case you can find the shared_region_check_np function in xnu-2782.1.97/bsd/vm/vm_unix.c. Described as followed:


This system call is intended for dyld.

dyld calls this when any process starts to see if the process's shared region is already set up and ready to use. This call returns the base address of the first mapping in the process's shared region's first mapping. dyld will then check what's mapped at that address.

If the shared region is empty, dyld will then attempt to map the shared cache file in the shared region via the shared_region_map_np() system call.

If something's already mapped in the shared region, dyld will check if it matches the shared cache it would like to use for that process. If it matches, evrything's ready and the process can proceed and use the shared region. If it doesn't match, dyld will unmap the shared region and map the shared cache into the process's address space via mmap().

More Resources

Recent Posts

About the Author

Christian is a professional software developer living in Vienna, Austria. He loves coffee and is strongly addicted to music. In his spare time he writes open source software. He is known for developing automatic data processing systems on Debian Linux server.

Categories: Commented, Programming
Tags: Mac, OS, X, Apple, syscalls, XNU, UNIX, Dynamic, Linker, shared, process

Archive | Categories | RSS Feed | Usage | Imprint
Copyright © 2006 by