Re: Information on use of Netsys.shm_open

Hugo Ferreira <[email protected]> Wed, 24 Mar 2010 08:13:13 +0000
Newsgroups gmane.comp.lang.ocaml.lib.net.devel
Message-ID <[email protected]>
Johan Mazel wrote:
> 
> 
> 2010/3/23 Gerd Stolpmann <[email protected] 
> <mailto:[email protected]>>
> 
>     On Di, 2010-03-23 at 19:15 +0100, Johan Mazel wrote:
>      > Hi
>      > I'm trying this little piece of code to open a shared memory and
>      > modify it.
>      > The code looks like this :
snip....
> Which function does unlink call ? Because there is no unlink function in 
> the posix C shared memory API.
>  

Posix function:
	int shm_unlink(const char *name)

For a good reference see [1] (chapter 13.2):

UNIX Network Programming, Volume 2, Second Edition: Interprocess
Communications, Prentice Hall, 1999, ISBN 0-13-081081-9

> 
>     Your guess is right, the error in your code is the bad permissions
>     bitfield. 0o666 instead of 1 should be just ok to give everybody
>     read/write access. The bitfield is interpreted as for any other file.
> 

These are the standard (L)unix file permissions. As per the reference
above you find these mode constants in <sys/stat.h>. In my Ubuntu box
the path is /usr/include/sys/stat.h.

To know more about this just google:
   Linux umask

HTHs,
Hugo F.

[1] http://www.kohala.com/start/unpv22e/unpv22e.html


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev