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> 12*53458494SDavid van Moolenbroek #include <minix/rmib.h> 13433d6423SLionel Sambuc 14433d6423SLionel Sambuc #include <sys/types.h> 150baafa0eSDavid van Moolenbroek #include <sys/param.h> 16433d6423SLionel Sambuc #include <sys/ipc.h> 17433d6423SLionel Sambuc #include <sys/shm.h> 18433d6423SLionel Sambuc #include <sys/sem.h> 194d272e5aSDavid van Moolenbroek #include <sys/stat.h> 2056dc79ceSDavid van Moolenbroek #include <sys/queue.h> 21433d6423SLionel Sambuc #include <sys/mman.h> 22433d6423SLionel Sambuc #include <machine/param.h> 23433d6423SLionel Sambuc #include <machine/vm.h> 24433d6423SLionel Sambuc #include <machine/vmparam.h> 25433d6423SLionel Sambuc 26433d6423SLionel Sambuc #include <lib.h> 27433d6423SLionel Sambuc #include <time.h> 28433d6423SLionel Sambuc #include <stdio.h> 29433d6423SLionel Sambuc #include <string.h> 30433d6423SLionel Sambuc #include <stdlib.h> 31433d6423SLionel Sambuc #include <unistd.h> 32433d6423SLionel Sambuc #include <errno.h> 33433d6423SLionel Sambuc #include <signal.h> 344d272e5aSDavid van Moolenbroek #include <assert.h> 354d272e5aSDavid van Moolenbroek 364d272e5aSDavid van Moolenbroek /* 374d272e5aSDavid van Moolenbroek * On NetBSD, these macros are only defined when _KERNEL is set. However, 384d272e5aSDavid van Moolenbroek * since ipcs(1) uses IXSEQ_TO_IPCID, NetBSD cannot change these macros without 394d272e5aSDavid van Moolenbroek * breaking the userland API. Thus, having a copy of them here is not risky. 404d272e5aSDavid van Moolenbroek */ 414d272e5aSDavid van Moolenbroek #define IPCID_TO_IX(id) ((id) & 0xffff) 424d272e5aSDavid van Moolenbroek #define IPCID_TO_SEQ(id) (((id) >> 16) & 0xffff) 43433d6423SLionel Sambuc 445b1db956SDavid van Moolenbroek /* main.c */ 455b1db956SDavid van Moolenbroek void update_sem_sub(int); 465b1db956SDavid van Moolenbroek 470baafa0eSDavid van Moolenbroek /* shm.c */ 48433d6423SLionel Sambuc int do_shmget(message *); 49433d6423SLionel Sambuc int do_shmat(message *); 50433d6423SLionel Sambuc int do_shmdt(message *); 51433d6423SLionel Sambuc int do_shmctl(message *); 52*53458494SDavid van Moolenbroek int get_shm_mib_info(struct rmib_oldp *); 530baafa0eSDavid van Moolenbroek int is_shm_nil(void); 54433d6423SLionel Sambuc void update_refcount_and_destroy(void); 550baafa0eSDavid van Moolenbroek 560baafa0eSDavid van Moolenbroek /* sem.c */ 57433d6423SLionel Sambuc int do_semget(message *); 58433d6423SLionel Sambuc int do_semctl(message *); 59433d6423SLionel Sambuc int do_semop(message *); 60*53458494SDavid van Moolenbroek int get_sem_mib_info(struct rmib_oldp *); 61433d6423SLionel Sambuc int is_sem_nil(void); 62910831cbSDavid van Moolenbroek void sem_process_event(endpoint_t, int); 63433d6423SLionel Sambuc 640baafa0eSDavid van Moolenbroek /* utility.c */ 650baafa0eSDavid van Moolenbroek int check_perm(struct ipc_perm *, endpoint_t, int); 66*53458494SDavid van Moolenbroek void prepare_mib_perm(struct ipc_perm_sysctl *, const struct ipc_perm *); 67