9 #if defined(HAVE_MQUEUE_H)
14 #define MSGSIZEMAX 1024
16 int main(int argc
, char **argv
)
18 struct mq_attr mqa
, mqa2
;
21 char buffer
[MSGSIZEMAX
];
22 unsigned int priority
;
25 mqa
.mq_maxmsg
= MSGMAX
;
26 mqa
.mq_msgsize
= MSGSIZEMAX
;
28 if ((mqdw
= mq_open("/valgrind-mqueue", O_CREAT
|O_EXCL
|O_WRONLY
, 0600, &mqa
)) < 0)
36 if ((mqdr
= mq_open("/valgrind-mqueue", O_RDONLY
)) < 0)
39 mq_unlink("/valgrind-mqueue");
44 if (mq_unlink("/valgrind-mqueue") < 0)
52 if (mq_send(mqdw
, "PING", 4, 0) < 0)
60 if ((len
= mq_receive(mqdr
, buffer
, sizeof(buffer
), &priority
)) < 0)
68 #if !defined(VGO_solaris)
69 /* On Solaris, there is no existing notification registration. */
70 if (mq_notify(mqdr
, NULL
) < 0)
77 #endif /* !VGO_solaris */
79 if (len
!= 4 || memcmp(buffer
, "PING", 4) != 0)
81 fprintf(stderr
, "Message corrupt!");
84 if (mq_getattr(mqdr
, &mqa
) < 0)
93 if (mq_setattr(mqdw
, &mqa
, &mqa2
) < 0)
101 if (mq_close(mqdr
) < 0)
108 if (mq_close(mqdw
) < 0)
119 int main(int argc
, char **argv
)