
- switch to the NetBSD identifier system; it is not only better, but also required for porting NetBSD ipcs(1) and ipcrm(1); however, it requires that slots not be moved, and that results in some changes; - synchronize some other things with NetBSD: where keys are kept, as well as various non-permission mode flags; - fix semctl(2) vararg retrieval and message field type; - use SUSPEND instead of weird reply exceptions in the call table; - fix several memory leaks and at least one missing permission check; - improve the atomicity of semop(2) by a small amount, even though its atomicity is still broken at a fundamental level; - use the new cheaper way to retrieve the current time; - resolve all level-5 LLVM warnings. Change-Id: I0c47aacde478b23bb77d628384aeab855a22fdbf
55 lines
1.3 KiB
C
55 lines
1.3 KiB
C
#define _SYSTEM 1 /* get OK and negative error codes */
|
|
|
|
#include <minix/callnr.h>
|
|
#include <minix/com.h>
|
|
#include <minix/config.h>
|
|
#include <minix/ipc.h>
|
|
#include <minix/endpoint.h>
|
|
#include <minix/sysutil.h>
|
|
#include <minix/const.h>
|
|
#include <minix/type.h>
|
|
#include <minix/syslib.h>
|
|
|
|
#include <sys/types.h>
|
|
#include <sys/ipc.h>
|
|
#include <sys/shm.h>
|
|
#include <sys/sem.h>
|
|
#include <sys/stat.h>
|
|
#include <sys/mman.h>
|
|
#include <machine/param.h>
|
|
#include <machine/vm.h>
|
|
#include <machine/vmparam.h>
|
|
|
|
#include <lib.h>
|
|
#include <time.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
#include <errno.h>
|
|
#include <signal.h>
|
|
#include <assert.h>
|
|
|
|
/*
|
|
* On NetBSD, these macros are only defined when _KERNEL is set. However,
|
|
* since ipcs(1) uses IXSEQ_TO_IPCID, NetBSD cannot change these macros without
|
|
* breaking the userland API. Thus, having a copy of them here is not risky.
|
|
*/
|
|
#define IPCID_TO_IX(id) ((id) & 0xffff)
|
|
#define IPCID_TO_SEQ(id) (((id) >> 16) & 0xffff)
|
|
|
|
int do_shmget(message *);
|
|
int do_shmat(message *);
|
|
int do_shmdt(message *);
|
|
int do_shmctl(message *);
|
|
int check_perm(struct ipc_perm *, endpoint_t, int);
|
|
void update_refcount_and_destroy(void);
|
|
int do_semget(message *);
|
|
int do_semctl(message *);
|
|
int do_semop(message *);
|
|
int is_sem_nil(void);
|
|
int is_shm_nil(void);
|
|
void sem_process_vm_notify(void);
|
|
|
|
EXTERN endpoint_t who_e;
|