public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Shared Memory Access Problem
@ 2012-09-07 23:03 Bob Furber
  2012-09-07 23:09 ` Jonathan Wakely
  0 siblings, 1 reply; 7+ messages in thread
From: Bob Furber @ 2012-09-07 23:03 UTC (permalink / raw)
  To: gcc-help

I have 2 programs that communicate through shared memory that work fine 
when I have root privileges, but fail when I sign on as a user. The 
server program that creates the shared memory set read an write 
permissions to allow everyone to access this memory (rw-rw-rw-).

    ShmID = shmget(ShmKEY, sizeof(struct Memory), IPC_CREAT | 0666);


Likewise, the client program, which is started after the server, creates 
the shared memory with rw-rw-rw- permissions.

    ShmID = shmget(ShmKEY, sizeof(struct Memory), 0666);

But, when I run the client program without root privileges,shmget() 
returns -1 and errno = 2 which supposedly means "File/Directory not found".

Why is the client capable of accessing shared memory when executed by 
root and not able to, when executed by a user?

I should mention that both the server and client executables have been 
chmoded to 777.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-09-16 13:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-07 23:03 Shared Memory Access Problem Bob Furber
2012-09-07 23:09 ` Jonathan Wakely
2012-09-11 16:24   ` Bob Furber
2012-09-11 17:13     ` Jonathan Wakely
2012-09-12  3:45       ` Bob Furber
2012-09-16 13:10         ` Ángel González
2012-09-11 21:59     ` Ángel González

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).