Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

ipcs command results always empty

System V IPC seems to work, but the ipcs command seems broken:

if ( ( i = shmget(k, 0x100000, IPC_CREAT | IPC_EXCL | 0660) ) < 0 ) {
fprintf( stderr, "%s: shmget() error, errno=%d (%s)\n",
argv[0], errno, strerror(errno) );
return(3);
}

$ ./sg a # creates shared memory segment using above code
$ ./sg a # run again, get expected error
./sg: shmget() error, errno=17 (File exists)
$ ipcs
Message Queues:
T ID KEY MODE OWNER GROUP

Shared Memory:
T ID KEY MODE OWNER GROUP

Semaphores:
T ID KEY MODE OWNER GROUP

$

Eventually, I run out of space for shared memory
and have no way to use ipcrm to get rid of these
"test" shared memory regions becasue I cannot
determine the shmid or shmkey because the ipcs
command doesn't provide me with this info.

Suggestions?

-Kurt Lloyd

PowerBook 12" Mac OS X (10.4.4)

Posted on Feb 13, 2006 8:17 AM

Reply
5 replies

Feb 13, 2006 3:45 PM in response to Kurt Lloyd

You may want to try ipcs -a and see if that gives you the expected results. Apple's shared memory settings are very low. I changed them on my server, some to 512 times the default because of shared memory errors. If you change tune the kernel with /etc/sysctl.conf, check /etc/rc for Apple overriding shm* in /etc/sysctl.conf.

Roger

Feb 13, 2006 6:18 PM in response to Community User

The only extra thing adding the -a option to the ipcs command does
is add more column headings to an empty dump.
Also, there is no /etc/sysctl.conf file on my system.
And the /etc/rc file contents indicate to me that shared memory is configured:

sysctl -w kern.sysv.shmmax=4194304 kern.sysv.shmmin=1 kern.sysv.shmmni=32 kern.sysv.shmseg=8 kern.sysv.shmall=1024

So I'm still 100% confused.

Feb 13, 2006 6:54 PM in response to Nils C. Anderson

Bingo! Thank you Andy!!

$ ipcs
Message Queues:
T ID KEY MODE OWNER GROUP

Shared Memory:
T ID KEY MODE OWNER GROUP

Semaphores:
T ID KEY MODE OWNER GROUP

$ sudo ipcs
Message Queues:
T ID KEY MODE OWNER GROUP

Shared Memory:
T ID KEY MODE OWNER GROUP
m 131071 1095910432 --rw-rw-rw- root kpl
m 131071 1627522010 --rw-rw---- kpl kpl
m 131071 1644299226 --rw-rw---- kpl kpl
m 262143 1661076442 --rw-rw---- kpl kpl

Semaphores:
T ID KEY MODE OWNER GROUP

$

Feb 14, 2006 3:55 PM in response to Kurt Lloyd

That was the line in /etc/rc. If you notice, it's right after the rc script goes through /etc/sysctl.conf and appends each line to a sysctl -w command. /etc/sysctl.conf doesn't exist by default, you just have to create it, like /etc/issue.

Roger

ipcs command results always empty

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.