Skip to content

Commit

Permalink
Reformulate two comments in mmap
Browse files Browse the repository at this point in the history
  • Loading branch information
shym committed Jul 19, 2024
1 parent 5ad3cc3 commit 0b3b7ff
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions nolibc/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ void *mmap(void *addr, size_t len, int prot, int flags, int fildes, off_t off) {
* since the OCaml code base simply ignores the returned value (as MAP_FIXED
* enforces the returned value to be either addr or MAP_FAILED).
*
* The OCaml usage of [mmap()] is only to allocate some spaces, only [fildes
* == -1] is handled so.
* The OCaml runtime uses [mmap()] only to allocate memory, so only
* [fildes == 1] is handled.
*/
(void)prot; // unused argument

Expand All @@ -38,9 +38,9 @@ void *mmap(void *addr, size_t len, int prot, int flags, int fildes, off_t off) {
void *ptr = NULL;

if (addr == NULL) {
/* Solo5 may returns -1 and set errno on error, just return MAP_FAILED.
It doesn't modify ptr on error: ptr will still be NULL
*/
/* posix_memalign doesn't modify ptr on error: ptr will still be NULL and
* so we will return MAP_FAILED with no need to check explicitly the value
* returned by posix_memalign */
posix_memalign(&ptr, OCAML_SOLO5_PAGESIZE, len);
} else {
if ((flags & MAP_FIXED) != 0) {
Expand Down

0 comments on commit 0b3b7ff

Please sign in to comment.