- /*
- include/ipc.h
- IPC有关的东东
- */
- /*
- forward include:none
- */
- #ifndef _IPC_H_
- #define _IPC_H_
- /* 收发消息功能号 */
- #define SEND 1 /* 发消息 */
- #define RECEIVE 2 /* 收消息 */
- #define BOTH 3 /* 先发后收 */
- /* 用于PCB的send_to和receive_from字段 */
- #define NO_PROC -1 /* 无效的进程号 */
- #define ANY -2 /* 可接受任何进程 */
- /* 用于PCB的ipc_status字段 */
- #define NO_BLOCK 0x1 /* PCB中ipc_status中的0位有效,表示是否被阻塞 */
- #define SENDING 0x2 /* PCB中ipc_status中的1位有效,表示是否在发送消息 */
- #define RECEIVING 0x4 /* PCB中ipc_status中的2位有效,表示是否在接收消息 */
- typedef struct s_message
- {
- int msg_type; /* 消息类型,表明要请求的服务 */
- int src_proc_pid; /* 表明发收消息的源进程的pid */
- /* Message携带的信息 */
- int i1;
- int i2;
- int i3;
- int i4;
- void *p1;
- void *p2;
- void *p3;
- void *p4;
- int r1;
- int r2;
- int r3;
- int r4;
- }Message;
- #endif