-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sys/mman: Set errno on mmap and munmap
JIRA: RTOS-808
- Loading branch information
1 parent
5687309
commit 72389ef
Showing
2 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Phoenix-RTOS | ||
* | ||
* libphoenix | ||
* | ||
* mmap/munmap | ||
* | ||
* Copyright 2024 Phoenix Systems | ||
* Author: Aleksander Kaminski | ||
* | ||
* This file is part of Phoenix-RTOS. | ||
* | ||
* %LICENSE% | ||
*/ | ||
|
||
#include <stddef.h> | ||
#include <sys/types.h> | ||
#include <sys/mman.h> | ||
#include <errno.h> | ||
|
||
|
||
WRAP_ERRNO_DEF(int, munmap, (void *vadddr, size_t size), (vadddr, size)) | ||
|
||
|
||
extern int sys_mmap(void **vaddr, size_t size, int prot, int flags, int fildes, off_t offs); | ||
|
||
|
||
void *mmap(void *vaddr, size_t size, int prot, int flags, int fildes, off_t offs) | ||
{ | ||
int err = sys_mmap(&vaddr, size, prot, flags, fildes, offs); | ||
if (err < 0) { | ||
vaddr = MAP_FAILED; | ||
SET_ERRNO(err); | ||
} | ||
|
||
return vaddr; | ||
} |