]> Projects (at) Tadryanom (dot) Me - AdrOS.git/commit
shm: implement SHM_RDONLY flag for read-only attach
authorTulio A M Mendes <[email protected]>
Thu, 11 Jun 2026 02:11:18 +0000 (23:11 -0300)
committerTulio A M Mendes <[email protected]>
Thu, 11 Jun 2026 02:11:18 +0000 (23:11 -0300)
commit50f38c3ecf964223aaa901499e97e5f0a347c932
treebe803a44380176e809aad9f5b33ba3621e2e36a5
parent182f9849cb897838cd184a32405acd9df2258ede
shm: implement SHM_RDONLY flag for read-only attach

Implement H3: SHM permissions complete with SHM_RDONLY attach.

Added SHM_RDONLY flag (0x1000) to shm.h for shmat syscall.
Modified shm_at() to accept shmflg parameter and:
- Check write permission only if SHM_RDONLY is not set
- Map pages without VMM_FLAG_RW when SHM_RDONLY is set
- This allows read-only shared memory segments for POSIX compliance

Updated syscall handler to pass shmflg from sc_arg2 to shm_at().

Test: make test-battery PASS (157/157), make analyzer PASS
include/shm.h
src/kernel/shm.c
src/kernel/syscall.c