Page MenuHomePhabricator

[libc] Move the implementation of mmap and munmap into a linux specific area.
ClosedPublic

Authored by sivachandra on Thu, Jan 23, 3:44 PM.

Details

Summary

This allows us to get rid of the PAGE_SIZE macro and use EXEC_PAGESIZE
from linux/param.h.

Few other points about this change:

  1. The linux syscall functions have been moved into a linux specific area

instead of src/unistd/syscall.h. The Linux syscall function from unistd.h
is a public vararg function. What we have currently are linux speciif internal
overloaded C++ functions. So, moving them to a Linux only area is more
meaningful.

  1. The implementations of mmap and munmap are now in a 'linux' directory

within src/sys/mman. The idea here is that platform specific
implementations will live in a platform specific subdirectories like these.
Infrastructure common to a platform will live in the platform's config
directory. For example, the linux syscall implementations live in
config/linux.

Diff Detail

Event Timeline

sivachandra created this revision.Thu, Jan 23, 3:44 PM
abrachet accepted this revision.Thu, Jan 23, 4:29 PM

LGTM. Would it be appropriate for this patch to add non platform specific implementations that always fail and set errno to ENOSYS in libc/src/sys/mman?

This revision is now accepted and ready to land.Thu, Jan 23, 4:29 PM

LGTM. Would it be appropriate for this patch to add non platform specific implementations that always fail and set errno to ENOSYS in libc/src/sys/mman?

Thats a good idea but I am not yet sure if we want to do this for every function for which we have platform specific implementations. As we add more items, we will see if it make sense to incorporate a pattern like this.

This revision was automatically updated to reflect the committed changes.