Hi,
I would like to look at the contents of a message queue without
removing the message from the queue. This would seem to rule out the
use of msgrcv() out as far as I can tell. So, I tried to read the
contents of a test queue I created via the msqid_ds and msg structures
defined (on my system) in <sys.msg.h> . However this failed with a
segmentation error when I tried to access the message type of the first
message on the queue. Using a debug utility I tried to dump the contents
of core at the message type location but this produceced no output at
all.
This sounds like I have corrupted memory myself or that I am not
allowed to read that part of memory - unless the process is owned by
root perhaps (??) I guess this could be an OS-specific issue but there
is no group dedicated to the system on which I develop (SVR4 Dynix/ptx)
so I apologise.
Can anyone confirm that the areas of memory reserved for these
kernel-maintianed structures are generally unreadable by non-root owned
processes ? Or (even better !) can anyone suggest a technique for
'peeking' rather than 'reading/removing' a message on a message queue ?
Thanks,
Kev.