Kernel/Userspace: Replace my custom SHM system with SysV shm

This allows xbanan to use shm!
This commit is contained in:
2026-08-08 01:52:12 +03:00
parent 2c4fee4a82
commit fc40820150
23 changed files with 327 additions and 225 deletions
@@ -43,13 +43,6 @@ int poweroff(int command);
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);
// 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
#endif
+9 -7
View File
@@ -22,13 +22,15 @@ struct ipc_perm
mode_t mode; /* Read/write permission. */
};
#define IPC_CREAT 0x01
#define IPC_EXCL 0x02
#define IPC_NOWAIT 0x04
#define IPC_PRIVATE 0x08
#define IPC_RMID 0x10
#define IPC_SET 0x20
#define IPC_STAT 0x40
#define IPC_CREAT 01000
#define IPC_EXCL 02000
#define IPC_NOWAIT 04000
#define IPC_PRIVATE 0
#define IPC_RMID 1
#define IPC_SET 2
#define IPC_STAT 3
key_t ftok(const char* path, int id);
+3 -3
View File
@@ -12,14 +12,14 @@ __BEGIN_DECLS
#define __need_time_t
#include <sys/types.h>
#include <stdint.h>
#include <sys/ipc.h>
#include <unistd.h>
#define SHM_RDONLY 0x01
#define SHM_RND 0x02
#define SHMLBA (sysconf(_SC_PAGE_SIZE))
#define SHM_FAILED ((void*)(intptr_t)-1)
#define SHMLBA (getpagesize())
typedef unsigned int shmatt_t;
@@ -72,9 +72,10 @@ __BEGIN_DECLS
O(SYS_PSELECT, pselect) \
O(SYS_PPOLL, ppoll) \
O(SYS_FTRUNCATE, ftruncate) \
O(SYS_SMO_CREATE, smo_create) \
O(SYS_SMO_DELETE, smo_delete) \
O(SYS_SMO_MAP, smo_map) \
O(SYS_SHMAT, shmat) \
O(SYS_SHMDT, shmdt) \
O(SYS_SHMGET, shmget) \
O(SYS_SHMCTL, shmctl) \
O(SYS_GETSOCKNAME, getsockname) \
O(SYS_GETPEERNAME, getpeername) \
O(SYS_GETSOCKOPT, getsockopt) \