s/YYLEX_PARAM/YYLEXPARAM/
[p5sagit/p5-mst-13.2.git] / ext / IPC / SysV / t / msg.t
CommitLineData
0ade1984 1use IPC::SysV qw(IPC_PRIVATE IPC_RMID IPC_NOWAIT IPC_STAT S_IRWXU S_IRWXG S_IRWXO);
2
3use IPC::Msg;
4#Creating a message queue
5
6print "1..9\n";
7
8$msq = new IPC::Msg(IPC_PRIVATE, S_IRWXU | S_IRWXG | S_IRWXO)
9 || die "msgget: ",$!+0," $!\n";
10
11print "ok 1\n";
12
13#Putting a message on the queue
14$msgtype = 1;
15$msg = "hello";
16$msq->snd($msgtype,$msg,0) || print "not ";
17print "ok 2\n";
18
19#Check if there are messages on the queue
20$ds = $msq->stat() or print "not ";
21print "ok 3\n";
22
23print "not " unless $ds && $ds->qnum() == 1;
24print "ok 4\n";
25
26#Retreiving a message from the queue
27$rmsgtype = 0; # Give me any type
28$rmsgtype = $msq->rcv($rmsg,256,$rmsgtype,IPC_NOWAIT) || print "not ";
29print "ok 5\n";
30
31print "not " unless $rmsgtype == $msgtype && $rmsg eq $msg;
32print "ok 6\n";
33
34$ds = $msq->stat() or print "not ";
35print "ok 7\n";
36
37print "not " unless $ds && $ds->qnum() == 0;
38print "ok 8\n";
39
40$msq->remove || print "not ";
41print "ok 9\n";