Warning: main() [function.main]: open_basedir restriction in effect. File(/var/data/www/ods/ods.com.ua/htdocs/htdig/header.php) is not within the allowed path(s): (/home/ods/:/tmp:/usr/local/lib/php/) in /home/ods/domains/ods.com.ua/public_html/win/eng/unix/lpg/node30.html on line 4
Warning: main(/var/data/www/ods/ods.com.ua/htdocs/htdig/header.php) [function.main]: failed to open stream: Operation not permitted in /home/ods/domains/ods.com.ua/public_html/win/eng/unix/lpg/node30.html on line 4
Warning: main() [function.include]: Failed opening '/var/data/www/ods/ods.com.ua/htdocs/htdig/header.php' for inclusion (include_path='.:/usr/local/lib/php/') in /home/ods/domains/ods.com.ua/public_html/win/eng/unix/lpg/node30.html on line 4
next up previous contents
Next: Kernel msg structure
Up: Internal and User Data
Previous: Internal and User Data
The first structure we'll visit is the msgbuf structure. This particular
data structure can be thought of as a template for message data. While
it is up to the programmer to define structures of this type, it is imperative
that you understand that there is actually a structure of type msgbuf. It is declared in linux/msg.h as follows:
/* message buffer for msgsnd and msgrcv calls */
struct msgbuf {
long mtype; /* type of message */
char mtext[1]; /* message text */
};
There are two members in the msgbuf structure:
- mtype
-
The message type, represented in a positive number. This must
be a positive number!
- mtext
-
The message data itself.
The ability to assign a given message a type, essentially gives you the capability to
multiplex messages on a single queue. For instance, client processes could be
assigned a magic number, which could be used as the message type for messages sent from a server
process. The server itself could use some other number, which clients could use to send
messages to it. In another scenario, an application could mark error messages as having a message
type of 1, request messages could be type 2, etc. The possibilities are endless.
On another note, do not be misled by the almost too-descriptive name assigned to the message
data element (mtext). This field is not restricted to holding only arrays of characters,
but any data, in any form. The field itself is actually completely arbitrary, since this structure
gets redefined by the application programmer. Consider this redefinition:
struct my_msgbuf {
long mtype; /* Message type */
long request_id; /* Request identifier */
struct client info; /* Client information structure */
};
Here we see the message type, as before, but the remainder of the structure has been replaced
by two other elements, one of which is another structure! This is the beauty of message queues.
The kernel makes no translations of data whatsoever. Any information can be sent.
There does exist an internal limit, however, of the maximum size of a given message. In Linux,
this is defined in linux/msg.h as follows:
#define MSGMAX 4056
/* <= 4056 */
/* max size of message (bytes) */
Messages can be no larger than 4,056 bytes in total size, including the mtype member,
which is 4 bytes in length (long).
next up previous contents
Next: Kernel msg structure
Up: Internal and User Data
Previous: Internal and User Data
Converted on:
Fri Mar 29 14:43:04 EST 1996
Warning: main() [function.main]: open_basedir restriction in effect. File(/var/data/www/ods/ods.com.ua/htdocs/include/footer.php) is not within the allowed path(s): (/home/ods/:/tmp:/usr/local/lib/php/) in /home/ods/domains/ods.com.ua/public_html/win/eng/unix/lpg/node30.html on line 82
Warning: main(/var/data/www/ods/ods.com.ua/htdocs/include/footer.php) [function.main]: failed to open stream: Operation not permitted in /home/ods/domains/ods.com.ua/public_html/win/eng/unix/lpg/node30.html on line 82
Warning: main() [function.include]: Failed opening '/var/data/www/ods/ods.com.ua/htdocs/include/footer.php' for inclusion (include_path='.:/usr/local/lib/php/') in /home/ods/domains/ods.com.ua/public_html/win/eng/unix/lpg/node30.html on line 82