4 # Copyright 1995. Michael Veksler.
10 do open_pipe(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
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).
26 # try to find out the IPC-ID, assume it is the first number.
28 $_ ne int($_) && next; # not a decimal number
32 if (/mem/i .. /^\s*$/ ) {
33 index($_,$USER)>=0 || next;
36 if (/sem/i .. /^\s*$/ ) {
37 index($_,$USER)>=0 || next;
40 if (/mes/i .. /^\s*$/ ) {
41 index($_,$USER)>=0 || next;
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";
55 shmctl($_, $IPC_RMID,0);
58 semctl($_, 0, $IPC_RMID,0);
61 msgctl($_, $IPC_RMID,0);
72 local($handle,@params)=@_;
73 pipe($handle,WRITE) || die "can't pipe";
77 die "can't fork" if ($pid<0);
79 # whe are in the parent
81 waitpid($pid,0) || print "$params[0] exits status=$? ",$? >> 8, "\n";
84 open(STDOUT,">&WRITE");
85 open(STDERR, ">&WRITE");