include/linux/msg.h
15849 #ifndef _LINUX_MSG_H
15850 #define _LINUX_MSG_H
15851
15852 #include <linux/ipc.h>
15853
15854 /* ipcs ctl commands */
15855 #define MSG_STAT 11
15856 #define MSG_INFO 12
15857
15858 /* msgrcv options */
15859 /* no error if message is too big */
15860 #define MSG_NOERROR 010000
15861 /* recv any msg except of specified type.*/
15862 #define MSG_EXCEPT 020000
15863
15864 /* one msqid structure for each queue on the system */
15865 struct msqid_ds {
15866 struct ipc_perm msg_perm;
15867 struct msg *msg_first; /* first msg on queue */
15868 struct msg *msg_last; /* last msg in queue */
15869 __kernel_time_t msg_stime; /* last msgsnd time */
15870 __kernel_time_t msg_rtime; /* last msgrcv time */
15871 __kernel_time_t msg_ctime; /* last change time */
15872 struct wait_queue *wwait;
15873 struct wait_queue *rwait;
15874 unsigned short msg_cbytes; /* current # bytes on q*/
15875 unsigned short msg_qnum; /* # of msgs in queue */
15876 unsigned short msg_qbytes; /* max # of bytes on q */
15877 __kernel_ipc_pid_t msg_lspid; /* pid of last msgsnd */
15878 __kernel_ipc_pid_t msg_lrpid; /* last receive pid */
15879 };
15880
15881 /* message buffer for msgsnd and msgrcv calls */
15882 struct msgbuf {
15883 long mtype; /* type of message */
15884 char mtext[1]; /* message text */
15885 };
15886
15887 /* buffer for msgctl calls IPC_INFO, MSG_INFO */
15888 struct msginfo {
15889 int msgpool;
15890 int msgmap;
15891 int msgmax;
15892 int msgmnb;
15893 int msgmni;
15894 int msgssz;
15895 int msgtql;
15896 unsigned short msgseg;
15897 };
15898
15899 /* max # of msg queue identifiers */
15900 #define MSGMNI 128 /* <= 1K */
15901 /* max size of message (bytes) */
15902 #define MSGMAX 4056 /* <= 4056 */
15903 /* default max size of a message queue */
15904 #define MSGMNB 16384 /* ? */
15905
15906 /* unused */
15907 /* size in kilobytes of message pool */
15908 #define MSGPOOL (MSGMNI*MSGMNB/1024)
15909 #define MSGTQL MSGMNB /* number of system msg headers */
15910 #define MSGMAP MSGMNB /* number of entries in msg map */
15911 #define MSGSSZ 16 /* message segment size */
15912 /* max no. of segments */
15913 #define __MSGSEG ((MSGPOOL*1024)/ MSGSSZ)
15914 #define MSGSEG (__MSGSEG <= 0xffff ? __MSGSEG : 0xffff)
15915
15916 #ifdef __KERNEL__
15917
15918 /* one msg structure for each message */
15919 struct msg {
15920 struct msg *msg_next; /* next message on queue */
15921 long msg_type;
15922 char *msg_spot; /* message text address */
15923 time_t msg_stime; /* msgsnd time */
15924 short msg_ts; /* message text size */
15925 };
15926
15927 asmlinkage int sys_msgget(key_t key, int msgflg);
15928 asmlinkage int sys_msgsnd(int msqid, struct msgbuf *msgp,
15929 size_t msgsz, int msgflg);
15930 asmlinkage int sys_msgrcv(int msqid, struct msgbuf *msgp,
15931 size_t msgsz, long msgtyp,
15932 int msgflg);
15933 asmlinkage int sys_msgctl(int msqid, int cmd,
15934 struct msqid_ds *buf);
15935
15936 #endif /* __KERNEL__ */
15937
15938 #endif /* _LINUX_MSG_H */
Сайт управляется системой
uCoz