minix/kernel/ipc.h
Jorrit Herder 8866b4d0ef Kernel changes:
- reinstalled priority changing, now in sched() and unready()
- reinstalled check on message buffer in sys_call()
- reinstalled check in send masks in sys_call()
- changed do_fork() to get new privilege structure for SYS_PROCs
- removed some processes from boot image---will be dynamically started later
2005-07-26 12:48:34 +00:00

61 lines
2.6 KiB
C

#ifndef IPC_H
#define IPC_H
#include <minix/com.h>
/* Masks and flags for system calls. */
#define SYSCALL_FUNC 0x0F /* mask for system call function */
#define SYSCALL_FLAGS 0xF0 /* mask for system call flags */
#define NON_BLOCKING 0x10 /* prevent blocking, return error */
#define FRESH_ANSWER 0x20 /* ignore pending notifications as answer */
/* (default behaviour for SENDREC calls) */
/* System call numbers that are passed when trapping to the kernel. The
* numbers are carefully defined so that it can easily be seen (based on
* the bits that are on) which checks should be done in sys_call().
*/
#define ECHO 0 /* 0 0 0 0 1 (01) : echo a message */
#define SEND 1 /* 0 0 0 1 1 (03) : blocking send */
#define RECEIVE 2 /* 0 0 1 0 1 (05) : blocking receive */
#define SENDREC 3 /* 0 0 1 1 1 (07) : SEND + RECEIVE */
#define NOTIFY 4 /* temp */
#define ALERT 5 /* 0 1 0 1 0 (10) : nonblocking notify */
/* The following definitions determine whether a calls message buffer and/
* or destination processes should be validated.
*/
#define CHECK_PTR 0x01 /* 0 0 0 0 1 : validate message buffer */
#define CHECK_DST 0x02 /* 0 0 0 1 0 : validate message destination */
#define CHECK_SRC 0x04 /* 0 0 1 0 0 : validate message source */
/* Call masks indicating which system calls (traps) a process can make.
* The values here are used for the processes in the boot image.
*/
#define EMPTY_MASK (0)
#define FILLED_MASK (~0)
#define USER_CALL_MASK (1 << SENDREC)
/* Send masks determine to whom processes can send messages or notifications.
* The values here are used for the processes in the boot image. We rely on
* the initialization code in main() to match the s_nr_to_id() mapping for the
* processes in the boot image, so that the send mask that is defined here
* can be directly copied onto map[0] of the actual send mask. Privilege
* structure 0 is shared by user processes.
*
* Note that process numbers in the boot image should not be higher than
* "BITCHUNK_BITS - NR_TASKS", because a bitchunk_t field is used to store
* the send masks in the table that describes that processes in the image.
*/
#define s_nr_to_id(n) (NR_TASKS + (n) + 1)
#define s(n) (1 << s_nr_to_id(n))
#define USER_SEND_MASK (s(PM_PROC_NR) | s(FS_PROC_NR))
#define DRIVER_SEND_MASK (s(PM_PROC_NR) | s(FS_PROC_NR) | s(SYSTEM) | \
s(CLOCK) | s(PRINTF_PROC) | s(TTY))
#define SERVER_SEND_MASK (~0)
#define SYSTEM_SEND_MASK (~1)
/* Sanity check to make sure the send masks can be set. */
extern int dummy[(BITCHUNK_BITS-NR_TASKS > INIT_PROC_NR) ? 1 : -1];
#endif /* IPC_H */