summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-04-08 23:44:12 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-04-08 23:44:12 +0200
commit99f3cc26c3e69b0ad7f104cd20189cd6fd4c3cf1 (patch)
tree3de12393e11c46222ffaffe6be06c4c347f45c8f /Kernel
parent7f2eeb0b35d07469815f8221c8f5e0d300899f58 (diff)
downloadserenity-99f3cc26c3e69b0ad7f104cd20189cd6fd4c3cf1.zip
Kernel+LibC: Add stubs for POSIX shared memory API.
Specifically shm_open() and shm_unlink(). This patch just adds stubs.
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/Process.cpp14
-rw-r--r--Kernel/Process.h2
-rw-r--r--Kernel/Syscall.cpp4
-rw-r--r--Kernel/Syscall.h2
4 files changed, 22 insertions, 0 deletions
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp
index 9638f6399b..9c7612ed4d 100644
--- a/Kernel/Process.cpp
+++ b/Kernel/Process.cpp
@@ -2454,3 +2454,17 @@ int Process::sys$rename(const char* oldpath, const char* newpath)
return -EFAULT;
return VFS::the().rename(String(oldpath), String(newpath), cwd_inode());
}
+
+int Process::sys$shm_open(const char* name, int flags, mode_t mode)
+{
+ if (!validate_read_str(name))
+ return -EFAULT;
+ return -ENOTIMPL;
+}
+
+int Process::sys$shm_unlink(const char* name)
+{
+ if (!validate_read_str(name))
+ return -EFAULT;
+ return -ENOTIMPL;
+}
diff --git a/Kernel/Process.h b/Kernel/Process.h
index 14b5328cdc..135fa7edcb 100644
--- a/Kernel/Process.h
+++ b/Kernel/Process.h
@@ -99,6 +99,8 @@ public:
int sys$gettid();
int sys$donate(int tid);
+ int sys$shm_open(const char* name, int flags, mode_t);
+ int sys$shm_unlink(const char* name);
pid_t sys$setsid();
pid_t sys$getsid(pid_t);
int sys$setpgid(pid_t pid, pid_t pgid);
diff --git a/Kernel/Syscall.cpp b/Kernel/Syscall.cpp
index cbba530e9b..812cc7d828 100644
--- a/Kernel/Syscall.cpp
+++ b/Kernel/Syscall.cpp
@@ -243,6 +243,10 @@ static dword handle(RegisterDump& regs, dword function, dword arg1, dword arg2,
return current->process().sys$create_thread((int(*)(void*))arg1, (void*)arg2);
case Syscall::SC_rename:
return current->process().sys$rename((const char*)arg1, (const char*)arg2);
+ case Syscall::SC_shm_open:
+ return current->process().sys$shm_open((const char*)arg1, (int)arg2, (mode_t)arg3);
+ case Syscall::SC_shm_close:
+ return current->process().sys$shm_unlink((const char*)arg1);
default:
kprintf("<%u> int0x82: Unknown function %u requested {%x, %x, %x}\n", current->process().pid(), function, arg1, arg2, arg3);
break;
diff --git a/Kernel/Syscall.h b/Kernel/Syscall.h
index f609e16553..b11a079d1e 100644
--- a/Kernel/Syscall.h
+++ b/Kernel/Syscall.h
@@ -96,6 +96,8 @@
__ENUMERATE_SYSCALL(gettid) \
__ENUMERATE_SYSCALL(donate) \
__ENUMERATE_SYSCALL(rename) \
+ __ENUMERATE_SYSCALL(shm_open) \
+ __ENUMERATE_SYSCALL(shm_close) \
namespace Syscall {