/* * Copyright (c) 2002, Intel Corporation. All rights reserved. * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com * This file is licensed under the GPL license. For the full content * of this license, see the COPYING file at the top level of this * source tree. */ /* * Test that if O_NONBLOCK is set and the message queue is full, mq_send() * will set errno == EAGAIN (subset of 7-1.c). */ #include #include #include #include #include #include #include #include #include #include "posixtest.h" #define NAMESIZE 50 #define MESSAGESIZE 50 #define BUFFER 40 #define MAXMSG 10 int main() { char qname[NAMESIZE]; char msgptr[MESSAGESIZE]; mqd_t queue; struct mq_attr attr; int unresolved=0, failure=0, i, maxreached=0; sprintf(qname, "/mq_send_10-1_%d", getpid()); attr.mq_maxmsg = MAXMSG; attr.mq_msgsize = BUFFER; queue = mq_open(qname, O_CREAT | O_RDWR | O_NONBLOCK, S_IRUSR | S_IWUSR, &attr); if (queue == (mqd_t)-1) { perror("mq_open() did not return success"); return PTS_UNRESOLVED; } for (i=0; i