1 #define _SYSTEM 1 /* get OK and negative error codes */ 2 3 #include <minix/callnr.h> 4 #include <minix/com.h> 5 #include <minix/config.h> 6 #include <minix/ipc.h> 7 #include <minix/endpoint.h> 8 #include <minix/sysutil.h> 9 #include <minix/const.h> 10 #include <minix/type.h> 11 #include <minix/syslib.h> 12 #include <minix/rmib.h> 13 14 #include <sys/types.h> 15 #include <sys/param.h> 16 #include <sys/ipc.h> 17 #include <sys/shm.h> 18 #include <sys/sem.h> 19 #include <sys/stat.h> 20 #include <sys/queue.h> 21 #include <sys/mman.h> 22 #include <machine/param.h> 23 #include <machine/vm.h> 24 #include <machine/vmparam.h> 25 26 #include <lib.h> 27 #include <time.h> 28 #include <stdio.h> 29 #include <string.h> 30 #include <stdlib.h> 31 #include <unistd.h> 32 #include <errno.h> 33 #include <signal.h> 34 #include <assert.h> 35 36 /* 37 * On NetBSD, these macros are only defined when _KERNEL is set. However, 38 * since ipcs(1) uses IXSEQ_TO_IPCID, NetBSD cannot change these macros without 39 * breaking the userland API. Thus, having a copy of them here is not risky. 40 */ 41 #define IPCID_TO_IX(id) ((id) & 0xffff) 42 #define IPCID_TO_SEQ(id) (((id) >> 16) & 0xffff) 43 44 /* main.c */ 45 void update_sem_sub(int); 46 47 /* shm.c */ 48 int do_shmget(message *); 49 int do_shmat(message *); 50 int do_shmdt(message *); 51 int do_shmctl(message *); 52 int get_shm_mib_info(struct rmib_oldp *); 53 int is_shm_nil(void); 54 void update_refcount_and_destroy(void); 55 56 /* sem.c */ 57 int do_semget(message *); 58 int do_semctl(message *); 59 int do_semop(message *); 60 int get_sem_mib_info(struct rmib_oldp *); 61 int is_sem_nil(void); 62 void sem_process_event(endpoint_t, int); 63 64 /* utility.c */ 65 int check_perm(struct ipc_perm *, endpoint_t, int); 66 void prepare_mib_perm(struct ipc_perm_sysctl *, const struct ipc_perm *); 67