Created
March 16, 2020 14:32
-
-
Save npentrel/e602db9143fae92678487e6d567faf8a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
read_mmap: | |
/* Atomically increment the reference counter, | |
* so no one unmaps the buffer while we use it. */ | |
atomic_add(mmap_use_count, 1); | |
/* If the buffer is being resized, use the system call instead of the mapped buffer. */ | |
if (mmap_resizing) | |
atomic_decr(mmap_use_count, 1); | |
read_syscall(...); | |
else | |
memcpy(dst_buffer, mapped_buffer, …); | |
atomic_decr(mmap_use_count, 1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment