include/ipc.h

来源:互联网 发布:魅蓝手机怎么设置网络 编辑:程序博客网 时间:2024/06/15 08:00
Code:
  1. /*  
  2.     include/ipc.h  
  3.     IPC有关的东东  
  4. */  
  5.   
  6. /*  
  7.     forward include:none  
  8. */  
  9.   
  10. #ifndef _IPC_H_   
  11. #define _IPC_H_   
  12.        
  13.     /* 收发消息功能号 */  
  14.     #define SEND            1       /* 发消息 */   
  15.     #define RECEIVE         2       /* 收消息 */   
  16.     #define BOTH            3       /* 先发后收 */   
  17.   
  18.     /* 用于PCB的send_to和receive_from字段 */  
  19.     #define NO_PROC         -1      /* 无效的进程号 */   
  20.     #define ANY             -2      /* 可接受任何进程 */   
  21.        
  22.     /* 用于PCB的ipc_status字段 */  
  23.     #define NO_BLOCK        0x1     /* PCB中ipc_status中的0位有效,表示是否被阻塞 */   
  24.     #define SENDING         0x2     /* PCB中ipc_status中的1位有效,表示是否在发送消息 */   
  25.     #define RECEIVING       0x4     /* PCB中ipc_status中的2位有效,表示是否在接收消息 */   
  26.   
  27.     typedef struct s_message   
  28.     {   
  29.         int msg_type;               /* 消息类型,表明要请求的服务 */  
  30.         int src_proc_pid;           /* 表明发收消息的源进程的pid */  
  31.            
  32.         /* Message携带的信息 */  
  33.         int i1;   
  34.         int i2;   
  35.         int i3;   
  36.         int i4;   
  37.         void *p1;   
  38.         void *p2;   
  39.         void *p3;   
  40.         void *p4;   
  41.         int r1;   
  42.         int r2;   
  43.         int r3;   
  44.         int r4;   
  45.     }Message;   
  46.   
  47. #endif   

 

原创粉丝点击