permissions of shared memory segments



Hello,

I'm currently using Redhat Enterprise Linux 3 (Kernel 2.4.21-27 smp).
I use a shared memory segment to communicate between three processes.


statusShmDes = shmget(1300, sizeof(struct _status), /* set read/write access to all */
IPC_CREAT | SHM_W | SHM_R | SHM_W>>3 | SHM_W>>6 | SHM_R>>3 | SHM_R>>6);
if (statusShmDes == -1)
{
perror("Can't get shared memory\n");
exit(1);
}
gDMAStatus = (struct _status *) shmat(statusShmDes, NULL, 0);


shmctl(statusShmDes,IPC_STAT,&shmidds);

fprintf(stderr,"shmidds.shm_perm.uid %i\n",shmidds.shm_perm.uid);
fprintf(stderr,"shmidds.shm_perm.gid %i\n",shmidds.shm_perm.gid);
fprintf(stderr,"shmidds.shm_perm.cuid %i\n",shmidds.shm_perm.cuid);
fprintf(stderr,"shmidds.shm_perm.cgid %i\n",shmidds.shm_perm.cgid);
fprintf(stderr,"shmidds.shm_perm.mode %i\n",shmidds.shm_perm.mode);


Most of the time the permission mode (shm_perm.mode) is 438 (110110110), which is what I expect.
But somethimes the permission mode is zero. As a result the shared memory is acessable, but not writeable.
* My processes run as root.
* I do not remove (shmctl(statusShmDes,IPC_RMID,NULL) ) the shared memory in any of my processes.

Any ideas why the permission mode is 0 ?


Thanks in advance,
Gerhard
.



Relevant Pages

  • permissions of shared memory segments
    ... I use a shared memory segment to communicate between three processes. ... But somethimes the permission mode is zero. ...
    (comp.unix.programmer)
  • Re: openMosix Question
    ... Openmosix even has no programming interface. ... Processes with single threads. ... Processes that work with shared memory or use multiple threads can't ... The processes would have to communicate over the network. ...
    (comp.os.linux.development.apps)
  • Re: Needing info on passing data between applications. Win[C#]
    ... its been a long time when i used shared memory. ... this is also a very fas way to communicate. ... I am not a friend ...
    (microsoft.public.dotnet.languages.csharp)
  • Approaches of interprocess communication
    ... communicate via TCP/IP if the processes run on the same machine. ... CORBA -- similar to webservices but more complicated to code. ... Supposing both processes are written in Python, ... shared memory sound the most suited approach. ...
    (comp.lang.python)
  • Re: Approaches of interprocess communication
    ... communicate via TCP/IP if the processes run on the same machine. ... sockets, as really bulky SOAP messages need to be passed around. ... CORBA -- similar to webservices but more complicated to code. ... shared memory sound the most suited approach. ...
    (comp.lang.python)