HP3000-L Archives

March 1998, Week 1

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Raymond Roesch <[log in to unmask]>
Reply To:
Raymond Roesch <[log in to unmask]>
Date:
Fri, 6 Mar 1998 17:11:33 +0100
Content-Type:
text/plain
Parts/Attachments:
text/plain (63 lines)
Dear list participant

What can I do when this script reports the following error.

shell/iX>/PERL/PUB/src/perl5.004_04-mpe/eg/sysvipc/ipcsem s
Can't get semaphore: No such file or directory
shell/iX>
shell/iX> cat /PERL/PUB/src/perl5.004_04-mpe/eg/sysvipc/ipcsem
#!/usr/bin/perl
eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
        if $running_under_some_shell;

require 'sys/ipc.ph';
require 'sys/msg.ph';
require 'sys/sem.ph';

$| = 1;

$mode = shift;
die "usage: ipcmsg {r|s}\n" unless $mode =~ /^[rs]$/;
$signal = ($mode eq "s");

$id = semget(0x1234, 1, ($signal ? 0 : &IPC_CREAT) | 0644);
die "Can't get semaphore: $!\n" unless defined($id);
print "semaphore id: $id\n";

if ($signal) {
        while (<STDIN>) {
                print "Signalling\n";
                unless (semop($id, pack("sss", 0, 1, 0))) {
                        die "Can't signal semaphore: $!\n";
                }
        }
}
else {
        $SIG{'INT'} = $SIG{'QUIT'} = "leave";
        for (;;) {
                unless (semop($id, pack("sss", 0, -1, 0))) {
                        die "Can't wait for semaphore: $!\n";
                }
                print "Unblocked\n";
        }
}

&leave;

sub leave {
        if (!$signal) {
                $x = semctl($id, 0, &IPC_RMID, 0);
                if (!defined($x) || $x < 0) {
                        die "Can't remove semaphore: $!\n";
                }
        }
        exit;
}

Any help will be appreciated.

Thanks

Raymond Roesch
mailto:[log in to unmask]

ATOM RSS1 RSS2