File: ipcreset

package info (click to toggle)
ga 5.9.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 18,472 kB
  • sloc: ansic: 192,963; fortran: 53,761; f90: 11,218; cpp: 5,784; makefile: 2,248; sh: 1,945; python: 1,734; perl: 534; csh: 134; asm: 106
file content (17 lines) | stat: -rw-r--r-- 548 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/csh
# clean System V IPC resources (semaphores and shared memory) owned by the user
#
if( `uname` == "Linux") then
# Linux has non-standard interface to ipcrm
# we use int() to filter out text decorations
  foreach s ( `ipcs -s | awk '{ if( int($2) != "0") { print $2 } }'` )
    ipcrm sem $s >/dev/null
  end 
  foreach m ( `ipcs -m | awk '{ if( int($2) != "0") { print $2 } }'` )
    ipcrm shm $m >/dev/null
  end 
else
  ipcrm `ipcs | awk '{if (($1 == "m") || ($1 == "s")) print sprintf("-%s %s",$1,$2) }'`
endif
# show what is left
ipcs