root/include/linux/msg.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 #ifndef _LINUX_MSG_H
   2 #define _LINUX_MSG_H
   3 #include <linux/ipc.h>
   4 
   5 /* msgrcv options */
   6 #define MSG_NOERROR     010000  /* no error if message is too big */
   7 #define MSG_EXCEPT      020000  /* recv any msg except of specified type.*/
   8 
   9 /* one msqid structure for each queue on the system */
  10 struct msqid_ds {
  11     struct ipc_perm msg_perm;
  12     struct msg *msg_first;  /* first message on queue */
  13     struct msg *msg_last;   /* last message in queue */
  14     time_t msg_stime;       /* last msgsnd time */
  15     time_t msg_rtime;       /* last msgrcv time */
  16     time_t msg_ctime;       /* last change time */
  17     struct wait_queue *wwait;
  18     struct wait_queue *rwait;
  19     ushort msg_cbytes;      /* current number of bytes on queue */
  20     ushort msg_qnum;        /* number of messages in queue */
  21     ushort msg_qbytes;      /* max number of bytes on queue */
  22     ushort msg_lspid;       /* pid of last msgsnd */
  23     ushort msg_lrpid;       /* last receive pid */
  24 };
  25 
  26 /* message buffer for msgsnd and msgrcv calls */
  27 struct msgbuf {
  28     long mtype;         /* type of message */
  29     char mtext[1];      /* message text */
  30 };
  31 
  32 /* buffer for msgctl calls IPC_INFO, MSG_INFO */
  33 struct msginfo {
  34     int msgpool;
  35     int msgmap; 
  36     int msgmax; 
  37     int msgmnb; 
  38     int msgmni; 
  39     int msgssz; 
  40     int msgtql; 
  41     ushort  msgseg; 
  42 };
  43 
  44 #define MSGMNI   128   /* <= 1K */     /* max # of msg queue identifiers */
  45 #define MSGMAX  4056   /* <= 4056 */   /* max size of message (bytes) */
  46 #define MSGMNB 16384   /* ? */        /* default max size of a message queue */
  47 
  48 /* unused */
  49 #define MSGPOOL (MSGMNI*MSGMNB/1024)  /* size in kilobytes of message pool */
  50 #define MSGTQL  MSGMNB            /* number of system message headers */
  51 #define MSGMAP  MSGMNB            /* number of entries in message map */
  52 #define MSGSSZ  16                /* message segment size */
  53 #define __MSGSEG ((MSGPOOL*1024)/ MSGSSZ) /* max no. of segments */
  54 #define MSGSEG (__MSGSEG <= 0xffff ? __MSGSEG : 0xffff)
  55 
  56 #ifdef __KERNEL__
  57 
  58 /* one msg structure for each message */
  59 struct msg {
  60     struct msg *msg_next;   /* next message on queue */
  61     long  msg_type;          
  62     char *msg_spot;         /* message text address */
  63     short msg_ts;           /* message text size */
  64 };
  65 
  66 /* ipcs ctl commands */
  67 #define MSG_STAT 11
  68 #define MSG_INFO 12
  69 
  70 asmlinkage int sys_msgget (key_t key, int msgflg);
  71 asmlinkage int sys_msgsnd (int msqid, struct msgbuf *msgp, size_t msgsz, int msgflg);
  72 asmlinkage int sys_msgrcv (int msqid, struct msgbuf *msgp, size_t msgsz, long msgtyp,
  73                        int msgflg);
  74 asmlinkage int sys_msgctl (int msqid, int cmd, struct msqid_ds *buf);
  75 
  76 #endif /* __KERNEL__ */
  77 
  78 #endif /* _LINUX_MSG_H */

/* [previous][next][first][last][top][bottom][index][help] */