msg.h (55205) | msg.h (59839) |
---|---|
1/* $FreeBSD: head/sys/sys/msg.h 55205 1999-12-29 04:46:21Z peter $ */ | 1/* $FreeBSD: head/sys/sys/msg.h 59839 2000-05-01 13:33:56Z peter $ */ |
2/* $NetBSD: msg.h,v 1.4 1994/06/29 06:44:43 cgd Exp $ */ 3 4/* 5 * SVID compatible msg.h file 6 * 7 * Author: Daniel Boulet 8 * 9 * Copyright 1993 Daniel Boulet and RTMX Inc. --- 17 unchanged lines hidden (view full) --- 27 28/* 29 * The MSG_NOERROR identifier value, the msqid_ds struct and the msg struct 30 * are as defined by the SV API Intel 386 Processor Supplement. 31 */ 32 33#define MSG_NOERROR 010000 /* don't complain about too long msgs */ 34 | 2/* $NetBSD: msg.h,v 1.4 1994/06/29 06:44:43 cgd Exp $ */ 3 4/* 5 * SVID compatible msg.h file 6 * 7 * Author: Daniel Boulet 8 * 9 * Copyright 1993 Daniel Boulet and RTMX Inc. --- 17 unchanged lines hidden (view full) --- 27 28/* 29 * The MSG_NOERROR identifier value, the msqid_ds struct and the msg struct 30 * are as defined by the SV API Intel 386 Processor Supplement. 31 */ 32 33#define MSG_NOERROR 010000 /* don't complain about too long msgs */ 34 |
35struct msg; 36 |
|
35struct msqid_ds { 36 struct ipc_perm msg_perm; /* msg queue permission bits */ 37 struct msg *msg_first; /* first message in the queue */ 38 struct msg *msg_last; /* last message in the queue */ 39 u_long msg_cbytes; /* number of bytes in use on the queue */ 40 u_long msg_qnum; /* number of msgs in the queue */ 41 u_long msg_qbytes; /* max # of bytes on the queue */ 42 pid_t msg_lspid; /* pid of last msgsnd() */ 43 pid_t msg_lrpid; /* pid of last msgrcv() */ 44 time_t msg_stime; /* time of last msgsnd() */ 45 long msg_pad1; 46 time_t msg_rtime; /* time of last msgrcv() */ 47 long msg_pad2; 48 time_t msg_ctime; /* time of last msgctl() */ 49 long msg_pad3; 50 long msg_pad4[4]; 51}; 52 | 37struct msqid_ds { 38 struct ipc_perm msg_perm; /* msg queue permission bits */ 39 struct msg *msg_first; /* first message in the queue */ 40 struct msg *msg_last; /* last message in the queue */ 41 u_long msg_cbytes; /* number of bytes in use on the queue */ 42 u_long msg_qnum; /* number of msgs in the queue */ 43 u_long msg_qbytes; /* max # of bytes on the queue */ 44 pid_t msg_lspid; /* pid of last msgsnd() */ 45 pid_t msg_lrpid; /* pid of last msgrcv() */ 46 time_t msg_stime; /* time of last msgsnd() */ 47 long msg_pad1; 48 time_t msg_rtime; /* time of last msgrcv() */ 49 long msg_pad2; 50 time_t msg_ctime; /* time of last msgctl() */ 51 long msg_pad3; 52 long msg_pad4[4]; 53}; 54 |
53struct msg { 54 struct msg *msg_next; /* next msg in the chain */ 55 long msg_type; /* type of this message */ 56 /* >0 -> type of this message */ 57 /* 0 -> free header */ 58 u_short msg_ts; /* size of this message */ 59 short msg_spot; /* location of start of msg in buffer */ 60}; 61 | |
62/* 63 * Structure describing a message. The SVID doesn't suggest any 64 * particular name for this structure. There is a reference in the 65 * msgop man page that reads "The structure mymsg is an example of what 66 * this user defined buffer might look like, and includes the following 67 * members:". This sentence is followed by two lines equivalent 68 * to the mtype and mtext field declarations below. It isn't clear 69 * if "mymsg" refers to the naem of the structure type or the name of an 70 * instance of the structure... 71 */ 72struct mymsg { 73 long mtype; /* message type (+ve integer) */ 74 char mtext[1]; /* message body */ 75}; 76 | 55/* 56 * Structure describing a message. The SVID doesn't suggest any 57 * particular name for this structure. There is a reference in the 58 * msgop man page that reads "The structure mymsg is an example of what 59 * this user defined buffer might look like, and includes the following 60 * members:". This sentence is followed by two lines equivalent 61 * to the mtype and mtext field declarations below. It isn't clear 62 * if "mymsg" refers to the naem of the structure type or the name of an 63 * instance of the structure... 64 */ 65struct mymsg { 66 long mtype; /* message type (+ve integer) */ 67 char mtext[1]; /* message body */ 68}; 69 |
70#ifdef _KERNEL 71 |
|
77/* 78 * Based on the configuration parameters described in an SVR2 (yes, two) 79 * config(1m) man page. 80 * 81 * Each message is broken up and stored in segments that are msgssz bytes 82 * long. For efficiency reasons, this should be a power of two. Also, 83 * it doesn't make sense if it is less than 8 or greater than about 256. 84 * Consequently, msginit in kern/sysv_msg.c checks that msgssz is a power of 85 * two between 8 and 1024 inclusive (and panic's if it isn't). 86 */ 87struct msginfo { 88 int msgmax, /* max chars in a message */ 89 msgmni, /* max message queue identifiers */ 90 msgmnb, /* max chars in a queue */ 91 msgtql, /* max messages in system */ 92 msgssz, /* size of a message segment (see notes above) */ 93 msgseg; /* number of message segments */ 94}; | 72/* 73 * Based on the configuration parameters described in an SVR2 (yes, two) 74 * config(1m) man page. 75 * 76 * Each message is broken up and stored in segments that are msgssz bytes 77 * long. For efficiency reasons, this should be a power of two. Also, 78 * it doesn't make sense if it is less than 8 or greater than about 256. 79 * Consequently, msginit in kern/sysv_msg.c checks that msgssz is a power of 80 * two between 8 and 1024 inclusive (and panic's if it isn't). 81 */ 82struct msginfo { 83 int msgmax, /* max chars in a message */ 84 msgmni, /* max message queue identifiers */ 85 msgmnb, /* max chars in a queue */ 86 msgtql, /* max messages in system */ 87 msgssz, /* size of a message segment (see notes above) */ 88 msgseg; /* number of message segments */ 89}; |
95#ifdef _KERNEL | |
96extern struct msginfo msginfo; | 90extern struct msginfo msginfo; |
97 98#ifndef MSGSSZ 99#define MSGSSZ 8 /* Each segment must be 2^N long */ | |
100#endif | 91#endif |
101#ifndef MSGSEG 102#define MSGSEG 2048 /* must be less than 32767 */ 103#endif 104#define MSGMAX (MSGSSZ*MSGSEG) 105#ifndef MSGMNB 106#define MSGMNB 2048 /* max # of bytes in a queue */ 107#endif 108#ifndef MSGMNI 109#define MSGMNI 40 110#endif 111#ifndef MSGTQL 112#define MSGTQL 40 113#endif | |
114 | 92 |
115/* 116 * macros to convert between msqid_ds's and msqid's. 117 * (specific to this implementation) 118 */ 119#define MSQID(ix,ds) ((ix) & 0xffff | (((ds).msg_perm.seq << 16) & 0xffff0000)) 120#define MSQID_IX(id) ((id) & 0xffff) 121#define MSQID_SEQ(id) (((id) >> 16) & 0xffff) 122 123/* 124 * The rest of this file is specific to this particular implementation. 125 */ 126 127 128/* 129 * Stuff allocated in machdep.h 130 */ 131struct msgmap { 132 short next; /* next segment in buffer */ 133 /* -1 -> available */ 134 /* 0..(MSGSEG-1) -> index of next segment */ 135}; 136 137extern char *msgpool; /* MSGMAX byte long msg buffer pool */ 138extern struct msgmap *msgmaps; /* MSGSEG msgmap structures */ 139extern struct msg *msghdrs; /* MSGTQL msg headers */ 140extern struct msqid_ds *msqids; /* MSGMNI msqid_ds struct's */ 141 142#define MSG_LOCKED 01000 /* Is this msqid_ds locked? */ 143 144#endif /* _KERNEL */ 145 | |
146#ifndef _KERNEL | 93#ifndef _KERNEL |
94 |
|
147#include <sys/cdefs.h> 148 149__BEGIN_DECLS 150int msgsys __P((int, ...)); 151int msgctl __P((int, int, struct msqid_ds *)); 152int msgget __P((key_t, int)); 153int msgsnd __P((int, void *, size_t, int)); 154int msgrcv __P((int, void*, size_t, long, int)); 155__END_DECLS 156#endif 157 158#endif /* !_SYS_MSG_H_ */ | 95#include <sys/cdefs.h> 96 97__BEGIN_DECLS 98int msgsys __P((int, ...)); 99int msgctl __P((int, int, struct msqid_ds *)); 100int msgget __P((key_t, int)); 101int msgsnd __P((int, void *, size_t, int)); 102int msgrcv __P((int, void*, size_t, long, int)); 103__END_DECLS 104#endif 105 106#endif /* !_SYS_MSG_H_ */ |