Browse Source

[LibOS] Add dummy implementation of Linux-specific mbind()

This call is used by libnuma. Always returning success is currently enough.
Dmitrii Kuvaiskii 4 years ago
parent
commit
186f41e65c
3 changed files with 17 additions and 2 deletions
  1. 2 0
      LibOS/shim/include/shim_table.h
  2. 2 2
      LibOS/shim/src/shim_syscalls.c
  3. 13 0
      LibOS/shim/src/sys/shim_mmap.c

+ 2 - 0
LibOS/shim/include/shim_table.h

@@ -465,6 +465,8 @@ int shim_do_clock_gettime(clockid_t which_clock, struct timespec* tp);
 int shim_do_clock_getres(clockid_t which_clock, struct timespec* tp);
 noreturn int shim_do_exit_group(int error_code);
 int shim_do_tgkill(int tgid, int pid, int sig);
+int shim_do_mbind(void* start, unsigned long len, int mode, unsigned long* nmask,
+                  unsigned long maxnode, int flags);
 int shim_do_openat(int dfd, const char* filename, int flags, int mode);
 int shim_do_mkdirat(int dfd, const char* pathname, int mode);
 int shim_do_newfstatat(int dirfd, const char* pathname, struct stat* statbuf, int flags);

+ 2 - 2
LibOS/shim/src/shim_syscalls.c

@@ -815,8 +815,8 @@ SHIM_SYSCALL_PASSTHROUGH(utimes, 2, int, char*, filename, struct timeval*, utime
    TODO: vserver syscall is not implemented (kernel always returns -ENOSYS),
    how should we handle this?*/
 
-SHIM_SYSCALL_PASSTHROUGH(mbind, 6, int, void*, start, unsigned long, len, int, mode, unsigned long*,
-                         nmask, unsigned long, maxnode, int, flags)
+DEFINE_SHIM_SYSCALL(mbind, 6, shim_do_mbind, int, void*, start, unsigned long, len, int, mode,
+                    unsigned long*, nmask, unsigned long, maxnode, int, flags)
 
 SHIM_SYSCALL_PASSTHROUGH(set_mempolicy, 3, int, int, mode, unsigned long*, nmask, unsigned long,
                          maxnode)

+ 13 - 0
LibOS/shim/src/sys/shim_mmap.c

@@ -247,3 +247,16 @@ int shim_do_mincore(void* addr, size_t len, unsigned char* vec) {
 
     return 0;
 }
+
+
+int shim_do_mbind(void* start, unsigned long len, int mode, unsigned long* nmask,
+                  unsigned long maxnode, int flags) {
+    /* dummy implementation, always return success */
+    __UNUSED(start);
+    __UNUSED(len);
+    __UNUSED(mode);
+    __UNUSED(nmask);
+    __UNUSED(maxnode);
+    __UNUSED(flags);
+    return 0;
+}