Bug 118292 - [sysvipc] [patch] Add support to remove all msg/shm/sem ids with ipcrm
Summary: [sysvipc] [patch] Add support to remove all msg/shm/sem ids with ipcrm
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 6.2-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-28 00:30 UTC by Callum Gibson
Modified: 2015-07-30 19:45 UTC (History)
0 users

See Also:


Attachments
file.diff (13.86 KB, patch)
2007-11-28 00:30 UTC, Callum Gibson
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Callum Gibson 2007-11-28 00:30:01 UTC
I've observed that linux apps running under the linuxulator have a
habit of leaving behind shared memory segments which are unused, but
which eventually cause the system to run out of free segments and
these apps will stop working. ipcrm(1) currently only allows removal
of unused message queues, shared memory segments and semaphores on an
individual basis, or those having a matching (non-zero) key. However
it would often be convenient to just do a complete cleanup of
everything, usually as root.

The attached patch allows removal of all message queues, shared memory
segments or semaphores by specifying an id of -1 (ala kill(2)). The
code to lookup ids was taken from ipcs.

Fix: See attached patch.

Patch attached with submission follows:
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2007-11-28 00:46:40 UTC
Responsible Changed
From-To: freebsd-bugs->edwin

Handle with submitter/mentor/-hackers
Comment 2 dfilter service freebsd_committer freebsd_triage 2007-12-25 00:52:30 UTC
edwin       2007-12-25 00:52:25 UTC

  FreeBSD src repository

  Modified files:
    usr.bin/ipcs         Makefile ipcs.c 
    usr.bin/ipcrm        Makefile ipcrm.1 ipcrm.c 
  Added files:
    usr.bin/ipcs         ipc.c ipc.h 
  Log:
  Add the ability to clean up all shared memory segments which are
  unused in one go.
  
  From the original PR:
  
          I've observed that linux apps running under the linuxulator
          have a habit of leaving behind shared memory segments which
          are unused, but which eventually cause the system to run
          out of free segments and these apps will stop working.
          ipcrm(1) currently only allows removal of unused message
          queues, shared memory segments and semaphores on an individual
          basis, or those having a matching (non-zero) key. However
          it would often be convenient to just do a complete cleanup
          of everything, usually as root.
  
  PR:             bin/118292
  Submitted by:   Callum Gibson <callumgibson@optusnet.com.au>
  Not reviewed by:        grog@
  Approved by:    grog@
  
  Revision  Changes    Path
  1.7       +5 -0      src/usr.bin/ipcrm/Makefile
  1.15      +36 -1     src/usr.bin/ipcrm/ipcrm.1
  1.13      +133 -18   src/usr.bin/ipcrm/ipcrm.c
  1.8       +1 -0      src/usr.bin/ipcs/Makefile
  1.1       +207 -0    src/usr.bin/ipcs/ipc.c (new)
  1.1       +71 -0     src/usr.bin/ipcs/ipc.h (new)
  1.31      +17 -197   src/usr.bin/ipcs/ipcs.c
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 3 Edwin Groothuis freebsd_committer freebsd_triage 2007-12-25 00:52:38 UTC
State Changed
From-To: open->patched

Commited to HEAD
Comment 4 Edwin Groothuis freebsd_committer freebsd_triage 2008-02-14 10:34:20 UTC
Responsible Changed
From-To: edwin->freebsd-bugs


Give back into the pool until later.
Comment 5 dfilter service freebsd_committer freebsd_triage 2008-07-12 07:19:54 UTC
edwin       2008-07-12 06:19:25 UTC

  FreeBSD src repository

  Modified files:        (Branch: RELENG_7)
    usr.bin/ipcrm        Makefile ipcrm.1 ipcrm.c 
    usr.bin/ipcs         Makefile ipcs.c 
  Added files:           (Branch: RELENG_7)
    usr.bin/ipcs         ipc.c ipc.h 
  Log:
  SVN rev 180459 on 2008-07-12 06:19:25Z by edwin
  
  MFC of svn revision 174891 and 174750
  
  Add the ability to clean up all shared memory segments which are
  unused in one go.
  
  PR:             bin/118292
  Submitted by:   Callum Gibson <callumgibson@optusnet.com.au>
  
  Revision   Changes    Path
  1.6.24.1   +5 -0      src/usr.bin/ipcrm/Makefile
  1.14.2.1   +36 -1     src/usr.bin/ipcrm/ipcrm.1
  1.11.24.1  +258 -126  src/usr.bin/ipcrm/ipcrm.c
  1.7.18.1   +1 -0      src/usr.bin/ipcs/Makefile
  1.1.2.1    +207 -0    src/usr.bin/ipcs/ipc.c (new)
  1.1.2.1    +71 -0     src/usr.bin/ipcs/ipc.h (new)
  1.29.2.1   +319 -430  src/usr.bin/ipcs/ipcs.c
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 6 Edwin Groothuis freebsd_committer freebsd_triage 2008-07-12 07:49:07 UTC
State Changed
From-To: patched->closed

Committed, thanks!
Comment 7 dfilter service freebsd_committer freebsd_triage 2008-07-12 07:49:36 UTC
edwin       2008-07-12 06:48:59 UTC

  FreeBSD src repository

  Modified files:        (Branch: RELENG_6)
    usr.bin/ipcrm        Makefile ipcrm.1 ipcrm.c 
    usr.bin/ipcs         Makefile ipcs.c 
  Added files:           (Branch: RELENG_6)
    usr.bin/ipcs         ipc.c ipc.h 
  Log:
  SVN rev 180462 on 2008-07-12 06:48:59Z by edwin
  
  MFC of svn revision 174891 and 174750
  
  Add the ability to clean up all shared memory segments which are
  unused in one go.
  
  PR:             bin/118292
  Submitted by:   Callum Gibson <callumgibson@optusnet.com.au>
  
  Revision   Changes    Path
  1.6.14.1   +5 -0      src/usr.bin/ipcrm/Makefile
  1.13.8.1   +36 -1     src/usr.bin/ipcrm/ipcrm.1
  1.11.14.1  +258 -126  src/usr.bin/ipcrm/ipcrm.c
  1.7.8.1    +1 -0      src/usr.bin/ipcs/Makefile
  1.1.4.1    +207 -0    src/usr.bin/ipcs/ipc.c (new)
  1.1.4.1    +71 -0     src/usr.bin/ipcs/ipc.h (new)
  1.27.2.2   +319 -430  src/usr.bin/ipcs/ipcs.c
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 8 commit-hook freebsd_committer freebsd_triage 2015-07-30 19:45:25 UTC
A commit references this bug:

Author: rodrigc
Date: Thu Jul 30 19:44:47 UTC 2015
New revision: 286093
URL: https://svnweb.freebsd.org/changeset/base/286093

Log:
  Use correct number of arguments to semctl() for IPC_RMID.

  PR:			118292
  Submitted by:		araujo
  Differential Revision:	D2669

Changes:
  head/usr.bin/ipcrm/ipcrm.c