/* * Copyright (c) 2003, 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 mq_timedsend() will return EINVAL if the message queue is * full and abs_timeout has a tv_nsec < 0 or >= 1000 million. * * Fill message queue until full and then call mq_timedsend with invalid * abs_timeout values. */ #include #include #include #include #include #include #include #include #include #include #include "posixtest.h" #define NAMESIZE 50 #define MSGSTR "0123456789" #define NUMTESTS 5 #define BUFFER 40 #define MAXMSG 5 int invalid_tests[NUMTESTS] = {-1, INT32_MIN, 1000000000, 1000000001 , INT32_MAX }; int main() { char qname[NAMESIZE]; char *msgptr=MSGSTR; struct timespec ts; mqd_t queue; struct mq_attr attr; int failure=0, i, maxreached=0; sprintf(qname, "/mq_timedsend_19-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"); printf("Test UNRESOLVED\n"); return PTS_UNRESOLVED; } ts.tv_sec=time(NULL); ts.tv_nsec=0; for (i=0; i