Operating System - HP-UX
1847334 Members
2375 Online
110264 Solutions
New Discussion

Re: Examining Shared Memory

 
SOLVED
Go to solution
OldSchool
Honored Contributor

Examining Shared Memory

Is there a way, short of writing my own program, to examine the "contents" of a shared memory segment.

I can see the segment with ipcs, but need to examine the data values

TIA

Scott
5 REPLIES 5
A. Clay Stephenson
Acclaimed Contributor

Re: Examining Shared Memory

Get a copy of this utility:

ftp://hprc.external.hp.com/sysadmin/programs/shminfo/
If it ain't broke, I can fix that.
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: Examining Shared Memory

This link will probably work better since it includes the 9unsupp8 password.


ftp://contrib:9unsupp8@hprc.external.hp.com/sysadmin/programs/shminfo/
If it ain't broke, I can fix that.
Bill Hassell
Honored Contributor

Re: Examining Shared Memory

shminfo will show you the addresses of all the shared memory segments, but to actually display the contents of a segment, you'll need a program. As you might expect, there are pieces of information needed (from the program creating the segment) to allow access and to prevent unauthorized access from casual users.


Bill Hassell, sysadmin
A. Clay Stephenson
Acclaimed Contributor

Re: Examining Shared Memory

Bear in mind that another approach to actually examining shmem is using Perl. The functions shmget, shmctl, shmread, and shmwrite are all available --- which is rather amazing for a scripting language. One of the obvious problems with a utility that reads shared memory is that the data really only has meaning for its intended application. The data generally are non-textual. One approach would be to use shmread to read the entire contents of a shared memory segment and write it to a file. You would then use a standard utility like od to examine the file.

The other obvious "gotcha" is that shared memory segments created with IPC_PRIVATE will not be accessible by unrelated processes.
If it ain't broke, I can fix that.
OldSchool
Honored Contributor

Re: Examining Shared Memory

Thanks for all of the quick responses. Looks like perl might be the way to go.

Scott