shmget errors

Peter Jeremy PeterJeremy at
Thu Dec 15 09:44:13 PST 2005

On Thu, 2005-Dec-15 15:22:04 +0100, Oliver Fromme wrote:
>Also, the following shell snippet might be helpful:
>ipcs | awk '($1=="m"){print $2}' | xargs -n 1 -t ipcrm -m

ipca -ma | awk '$9 == "0"{print $2}' | xargs -n 1 -t ipcrm -m

has the advantage of only removing segments with no processes attached.

>It removes _all_ shared memory segments.  Be careful:
>Don't do that while any programs are still running which
>use SysV shared memory.

As with deleting open files, the segment doesn't disappear immediately
but only after the last process detaches (see IPC_RMID in shmctm(2)).

>  You can check that by looking at
>the output of ``ipcs -p'':  If the process IDs listed under
>the CPID and LPID columns don't exist, chances are that the
>memory segment isn't in use anymore.

Looking at NATTACH in "ipcs -a" is a better approach.

Peter Jeremy

More information about the freebsd-stable mailing list