Release 20010510.
[wine/multimedia.git] / tools / ipcl
blob8cb6901902564dfc39bd61952605951099a5a011
1 #!/usr/bin/perl
4 # Copyright 1995. Michael Veksler.
7 $IPC_RMID=0;
8 $USER=$ENV{USER};
10 open(IPCS,"ipcs|");
13 # The following part is OS dependant, it works under linux only.
14 # To make it work under other OS
15 # You should fill in @shm, @sem, @msq lists, with the relevent IPC
16 # keys.
19 # This code was written to be as much as possible generic, but...
20 # It works for Linux and ALPHA. I had no BSD machine to test it.
21 # (As I remember, AIX will work also).
23 while(<IPCS>) {
24 split;
26 # try to find out the IPC-ID, assume it is the first number.
27 foreach (@_) {
28 $_ ne int($_) && next; # not a decimal number
29 $num=$_;
30 last;
32 if (/mem/i .. /^\s*$/ ) {
33 index($_,$USER)>=0 || next;
34 push(@shm,$num);
36 if (/sem/i .. /^\s*$/ ) {
37 index($_,$USER)>=0 || next;
38 push(@sem,$num);
40 if (/mes/i .. /^\s*$/ ) {
41 index($_,$USER)>=0 || next;
42 push(@msq,$num);
48 # This is the end of OS dependant code.
51 @shm && print "shmid ", join(":",@shm),"\n";
52 @sem && print "semid ", join(":",@sem),"\n";
53 @msq && print "msqid ", join(":",@msq),"\n";
54 foreach (@shm) {
55 shmctl($_, $IPC_RMID,0);
57 foreach (@sem) {
58 semctl($_, 0, $IPC_RMID,0);
60 foreach (@msq) {
61 msgctl($_, $IPC_RMID,0);