msync and Sytem V semaphore dummies

Ref #2467
This commit is contained in:
Emery Hemingway 2017-07-25 18:53:01 -05:00 committed by Christian Helmuth
parent c2c47d2e35
commit 604ff9ca2c
5 changed files with 32 additions and 0 deletions

View File

@ -120,6 +120,7 @@ namespace Libc {
virtual void *mmap(void *addr, ::size_t length, int prot, int flags,
File_descriptor *, ::off_t offset);
virtual int munmap(void *addr, ::size_t length);
virtual int msync(void *addr, ::size_t len, int flags);
virtual File_descriptor *open(const char *pathname, int flags);
virtual int pipe(File_descriptor *pipefd[2]);
virtual ssize_t read(File_descriptor *, void *buf, ::size_t count);

View File

@ -428,6 +428,7 @@ mktime T
mmap T
mprotect W
mrand48 T
msync T
munmap T
nanosleep W
nextwctype T
@ -594,6 +595,8 @@ seekdir T
select W
semctl T
semctl T
semget W
semop W
send T
sendto T
setbuf T
@ -1002,6 +1005,7 @@ _ZN4Libc6Plugin5ioctlEPNS_15File_descriptorEiPc T
_ZN4Libc6Plugin5lseekEPNS_15File_descriptorEli T
_ZN4Libc6Plugin5lseekEPNS_15File_descriptorExi T
_ZN4Libc6Plugin5mkdirEPKct T
_ZN4Libc6Plugin5msyncEPvmi T
_ZN4Libc6Plugin5rmdirEPKc T
_ZN4Libc6Plugin5writeEPNS_15File_descriptorEPKvj T
_ZN4Libc6Plugin5writeEPNS_15File_descriptorEPKvm T

View File

@ -124,6 +124,8 @@ DUMMY(mode_t, 0, umask, (mode_t))
DUMMY(int , 0, utimes, (const char *, const timeval *))
DUMMY(pid_t , -1, vfork, (void))
DUMMY(pid_t , -1, _wait4, (pid_t, int *, int, struct rusage *))
DUMMY(int, -1, semget, (key_t, int, int))
DUMMY(int, -1, semop, (key_t, int, int))
void ksem_init(void)

View File

@ -472,6 +472,30 @@ extern "C" int munmap(void *start, ::size_t length)
}
extern "C" int msync(void *start, ::size_t len, int flags)
{
if (!mmap_registry()->registered(start)) {
Genode::warning("munmap: could not lookup plugin for address ", start);
errno = EINVAL;
return -1;
}
/*
* Lookup plugin that was used for mmap
*
* If the pointer is NULL, 'start' refers to an anonymous mmap.
*/
Plugin *plugin = mmap_registry()->lookup_plugin_by_addr(start);
int ret = 0;
if (plugin)
ret = plugin->msync(start, len, flags);
return ret;
}
extern "C" int _open(const char *pathname, int flags, ::mode_t mode)
{
Absolute_path resolved_path;

View File

@ -203,6 +203,7 @@ DUMMY(int, -1, mkdir, (const char*, mode_t));
DUMMY(void *, (void *)(-1), mmap, (void *addr, ::size_t length, int prot, int flags,
File_descriptor *, ::off_t offset));
DUMMY(int, -1, munmap, (void *, ::size_t));
DUMMY(int, -1, msync, (void *addr, ::size_t len, int flags));
DUMMY(int, -1, pipe, (File_descriptor*[2]));
DUMMY(ssize_t, -1, readlink, (const char *, char *, ::size_t));
DUMMY(int, -1, rename, (const char *, const char *));