Kernel: Implement deletion of SMO objects

This commit is contained in:
2024-05-31 12:27:56 +03:00
parent 0501f3bd99
commit 8bfacb0091
7 changed files with 38 additions and 1 deletions

View File

@@ -38,7 +38,9 @@ int load_keymap(const char* path);
// Create shared memory object and return its key or -1 on error
long smo_create(size_t size, int prot);
// Map shared memory object defined by its key and return address or null on error
// Delete shared memory object such that it will be no longer accessible with smo_map(). Existing mappings are still valid
int smo_delete(long key);
// Map shared memory object defined by its key and return address or null on error. Mappings can be unmapped using munmap()
void* smo_map(long key);
__END_DECLS

View File

@@ -75,6 +75,7 @@ __BEGIN_DECLS
O(SYS_PSELECT, pselect) \
O(SYS_TRUNCATE, truncate) \
O(SYS_SMO_CREATE, smo_create) \
O(SYS_SMO_DELETE, smo_delete) \
O(SYS_SMO_MAP, smo_map) \
enum Syscall

View File

@@ -22,6 +22,11 @@ long smo_create(size_t size, int prot)
return syscall(SYS_SMO_CREATE, size, prot);
}
int smo_delete(long key)
{
return syscall(SYS_SMO_DELETE, key);
}
void* smo_map(long key)
{
long ret = syscall(SYS_SMO_MAP, key);