1433d6423SLionel Sambuc #define _SYSTEM 1 /* get OK and negative error codes */ 2433d6423SLionel Sambuc 3433d6423SLionel Sambuc #include <minix/callnr.h> 4433d6423SLionel Sambuc #include <minix/com.h> 5433d6423SLionel Sambuc #include <minix/config.h> 6433d6423SLionel Sambuc #include <minix/ipc.h> 7433d6423SLionel Sambuc #include <minix/endpoint.h> 8433d6423SLionel Sambuc #include <minix/sysutil.h> 9433d6423SLionel Sambuc #include <minix/const.h> 10433d6423SLionel Sambuc #include <minix/type.h> 11433d6423SLionel Sambuc #include <minix/syslib.h> 12433d6423SLionel Sambuc 13433d6423SLionel Sambuc #include <sys/types.h> 140baafa0eSDavid van Moolenbroek #include <sys/param.h> 15433d6423SLionel Sambuc #include <sys/ipc.h> 16433d6423SLionel Sambuc #include <sys/shm.h> 17433d6423SLionel Sambuc #include <sys/sem.h> 184d272e5aSDavid van Moolenbroek #include <sys/stat.h> 19*56dc79ceSDavid van Moolenbroek #include <sys/queue.h> 20433d6423SLionel Sambuc #include <sys/mman.h> 21433d6423SLionel Sambuc #include <machine/param.h> 22433d6423SLionel Sambuc #include <machine/vm.h> 23433d6423SLionel Sambuc #include <machine/vmparam.h> 24433d6423SLionel Sambuc 25433d6423SLionel Sambuc #include <lib.h> 26433d6423SLionel Sambuc #include <time.h> 27433d6423SLionel Sambuc #include <stdio.h> 28433d6423SLionel Sambuc #include <string.h> 29433d6423SLionel Sambuc #include <stdlib.h> 30433d6423SLionel Sambuc #include <unistd.h> 31433d6423SLionel Sambuc #include <errno.h> 32433d6423SLionel Sambuc #include <signal.h> 334d272e5aSDavid van Moolenbroek #include <assert.h> 344d272e5aSDavid van Moolenbroek 354d272e5aSDavid van Moolenbroek /* 364d272e5aSDavid van Moolenbroek * On NetBSD, these macros are only defined when _KERNEL is set. However, 374d272e5aSDavid van Moolenbroek * since ipcs(1) uses IXSEQ_TO_IPCID, NetBSD cannot change these macros without 384d272e5aSDavid van Moolenbroek * breaking the userland API. Thus, having a copy of them here is not risky. 394d272e5aSDavid van Moolenbroek */ 404d272e5aSDavid van Moolenbroek #define IPCID_TO_IX(id) ((id) & 0xffff) 414d272e5aSDavid van Moolenbroek #define IPCID_TO_SEQ(id) (((id) >> 16) & 0xffff) 42433d6423SLionel Sambuc 430baafa0eSDavid van Moolenbroek /* shm.c */ 44433d6423SLionel Sambuc int do_shmget(message *); 45433d6423SLionel Sambuc int do_shmat(message *); 46433d6423SLionel Sambuc int do_shmdt(message *); 47433d6423SLionel Sambuc int do_shmctl(message *); 480baafa0eSDavid van Moolenbroek int is_shm_nil(void); 49433d6423SLionel Sambuc void update_refcount_and_destroy(void); 500baafa0eSDavid van Moolenbroek 510baafa0eSDavid van Moolenbroek /* sem.c */ 52433d6423SLionel Sambuc int do_semget(message *); 53433d6423SLionel Sambuc int do_semctl(message *); 54433d6423SLionel Sambuc int do_semop(message *); 55433d6423SLionel Sambuc int is_sem_nil(void); 56910831cbSDavid van Moolenbroek void sem_process_event(endpoint_t, int); 57433d6423SLionel Sambuc 580baafa0eSDavid van Moolenbroek /* utility.c */ 590baafa0eSDavid van Moolenbroek int check_perm(struct ipc_perm *, endpoint_t, int); 60