mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
Kernel+LibC: Add stubs for POSIX shared memory API.
Specifically shm_open() and shm_unlink(). This patch just adds stubs.
This commit is contained in:
parent
7f2eeb0b35
commit
99f3cc26c3
Notes:
sideshowbarker
2024-07-19 14:47:25 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/99f3cc26c3e
6 changed files with 36 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -96,6 +96,8 @@
|
|||
__ENUMERATE_SYSCALL(gettid) \
|
||||
__ENUMERATE_SYSCALL(donate) \
|
||||
__ENUMERATE_SYSCALL(rename) \
|
||||
__ENUMERATE_SYSCALL(shm_open) \
|
||||
__ENUMERATE_SYSCALL(shm_close) \
|
||||
|
||||
|
||||
namespace Syscall {
|
||||
|
|
|
@ -28,4 +28,16 @@ int set_mmap_name(void* addr, size_t size, const char* name)
|
|||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
int shm_open(const char* name, int flags, mode_t mode)
|
||||
{
|
||||
int rc = syscall(SC_shm_open, name, flags, mode);
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
int shm_unlink(const char* name)
|
||||
{
|
||||
int rc = syscall(SC_unlink, name);
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,6 +21,8 @@ __BEGIN_DECLS
|
|||
void* mmap(void* addr, size_t, int prot, int flags, int fd, off_t);
|
||||
int munmap(void*, size_t);
|
||||
int set_mmap_name(void*, size_t, const char*);
|
||||
int shm_open(const char* name, int flags, mode_t);
|
||||
int shm_unlink(const char* name);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
|
Loading…
Reference in a new issue