Add mmap and munmap to SysCalls

Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe
2021-06-17 18:25:55 +00:00
committed by Compute-Runtime-Automation
parent 8523747f91
commit 3c1288de09
3 changed files with 22 additions and 0 deletions

View File

@ -40,6 +40,8 @@ constexpr unsigned long int invalidIoctl = static_cast<unsigned long int>(-1);
int setErrno = 0;
int fstatFuncRetVal = 0;
uint32_t preadFuncCalled = 0u;
uint32_t mmapFuncCalled = 0u;
uint32_t munmapFuncCalled = 0u;
int close(int fileDescriptor) {
closeFuncCalled++;
@ -137,5 +139,15 @@ ssize_t pread(int fd, void *buf, size_t count, off_t offset) {
return 0;
}
void *mmap(void *addr, size_t size, int prot, int flags, int fd, off_t off) {
mmapFuncCalled++;
return 0;
}
int munmap(void *addr, size_t size) {
munmapFuncCalled++;
return 0;
}
} // namespace SysCalls
} // namespace NEO

View File

@ -8,6 +8,7 @@
#pragma once
#include <iostream>
#include <poll.h>
#include <sys/mman.h>
#include <sys/stat.h>
namespace NEO {
@ -22,5 +23,7 @@ int readlink(const char *path, char *buf, size_t bufsize);
int poll(struct pollfd *pollFd, unsigned long int numberOfFds, int timeout);
int fstat(int fd, struct stat *buf);
ssize_t pread(int fd, void *buf, size_t count, off_t offset);
void *mmap(void *addr, size_t size, int prot, int flags, int fd, off_t off);
int munmap(void *addr, size_t size);
} // namespace SysCalls
} // namespace NEO

View File

@ -65,5 +65,12 @@ ssize_t pread(int fd, void *buf, size_t count, off_t offset) {
return ::pread(fd, buf, count, offset);
}
void *mmap(void *addr, size_t size, int prot, int flags, int fd, off_t off) {
return ::mmap(addr, size, prot, flags, fd, off);
}
int munmap(void *addr, size_t size) {
return ::munmap(addr, size);
}
} // namespace SysCalls
} // namespace NEO