13 #define MSGSIZEMAX 1024
15 int main(int argc
, char **argv
)
20 char buffer
[MSGSIZEMAX
];
21 unsigned int priority
;
24 mqa
.mq_maxmsg
= MSGMAX
;
25 mqa
.mq_msgsize
= MSGSIZEMAX
;
27 if ((mqdw
= mq_open("/valgrind-mqueue", O_CREAT
|O_EXCL
|O_WRONLY
, 0600, &mqa
)) < 0)
35 if ((mqdr
= mq_open("/valgrind-mqueue", O_RDONLY
)) < 0)
38 mq_unlink("/valgrind-mqueue");
43 if (mq_unlink("/valgrind-mqueue") < 0)
51 if (mq_send(mqdw
, "PING", 4, 0) < 0)
59 if ((len
= mq_receive(mqdr
, buffer
, sizeof(buffer
), &priority
)) < 0)
67 #if !defined(VGO_solaris)
68 /* On Solaris, there is no existing notification registration. */
69 if (mq_notify(mqdr
, NULL
) < 0)
76 #endif /* !VGO_solaris */
78 if (len
!= 4 || memcmp(buffer
, "PING", 4) != 0)
80 fprintf(stderr
, "Message corrupt!");
83 if (mq_getattr(mqdr
, &mqa
) < 0)
91 if (mq_setattr(mqdw
, &mqa
, &mqa
) < 0)
99 if (mq_close(mqdr
) < 0)
106 if (mq_close(mqdw
) < 0)
117 int main(int argc
, char **argv
)