MCPcopy Create free account
hub / github.com/LemonOSProject/LemonOS / SysCreateSharedMemory

Function SysCreateSharedMemory

Kernel/src/arch/x86_64/syscalls.cpp:1069–1080  ·  view source on GitHub ↗

* SysCreateSharedMemory (key, size, flags, recipient) - Create Shared Memory * key - Pointer to memory key * size - memory size * flags - flags * recipient - (if private flag) PID of the process that can access memory * * On Success - Return 0, key greater than 1 * On Failure - Return -1, key null */

Source from the content-addressed store, hash-verified

1067 * On Failure - Return -1, key null
1068 */
1069long SysCreateSharedMemory(regs64_t* r){
1070 int64_t* key = (int64_t*)SC_ARG0(r);
1071 uint64_t size = SC_ARG1(r);
1072 uint64_t flags = SC_ARG2(r);
1073 uint64_t recipient = SC_ARG3(r);
1074
1075 *key = Memory::CreateSharedMemory(size, flags, Scheduler::GetCurrentProcess()->pid, recipient);
1076
1077 if(!*key) return -1; // Failed
1078
1079 return 0;
1080}
1081
1082/*
1083 * SysMapSharedMemory (ptr, key, hint) - Map Shared Memory

Callers

nothing calls this directly

Calls 2

GetCurrentProcessFunction · 0.85
CreateSharedMemoryFunction · 0.50

Tested by

no test coverage detected