[Gllug] Possible to read shared memory from bash?

Julian Somers lists at bigpip.com
Fri Oct 6 12:30:05 UTC 2006


On 14:51 Thu 05 Oct     , - Tethys wrote:
> On 10/5/06, Julian Somers <lists at bigpip.com> wrote:
> 
> >Bash can see my shared memory block with `ipcs`, and delete it with
> >`ipcrm -M $shmkey`. Is there a way to read its contents?
> 
> Not off the top of my head, no. But it should be trivial to knock up a
> wrapper around shmat(3) that will give you access to shared memory
> segments from a shell.

Since my C doesn't even stretch to knocking up a trivial wrapper, I have
made a php script that fetches the stuff out of shared memory for the
shell scripts. Probably more of a pass-the-parcel than a wrapper, but it
works.

My understanding of shared memory is that I need to avoid simultaneous
writes, but don't need to worry about simultaneous reads. Is this the
case? And do I need to block anything from reading the memory while
I'm writing to it?

Thanks,

Julian

> 
> Tet
> -- 
> Gllug mailing list  -  Gllug at gllug.org.uk
> http://lists.gllug.org.uk/mailman/listinfo/gllug
> 

-- 

Julian Somers
+44 208 265 5407
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list