Home | History | Annotate | Download | only in speculative
      1 /*
      2  * Copyright (c) 2003, Intel Corporation. All rights reserved.
      3  * Created by:  julie.n.fleischer REMOVE-THIS AT intel DOT com
      4  * This file is licensed under the GPL license.  For the full content
      5  * of this license, see the COPYING file at the top level of this
      6  * source tree.
      7  */
      8 
      9 /*
     10  * Brief test that oflag is a bitwise-inclusive OR of only one of
     11  * O_RDONLY, O_WRONLY, O_RDWR.  Other aspects of assertion 6 are tested
     12  * in subsequent assertions (7-9).
     13  *
     14  * Moved to speculative/ as behavior for invalid flags isn't really
     15  * defined by POSIX.
     16  */
     17 
     18 #include <stdio.h>
     19 #include <mqueue.h>
     20 #include <fcntl.h>
     21 #include <sys/stat.h>
     22 #include <sys/types.h>
     23 #include <unistd.h>
     24 #include <string.h>
     25 #include "posixtest.h"
     26 
     27 #define NAMESIZE 50
     28 
     29 int main(void)
     30 {
     31 	char qname[NAMESIZE];
     32 	mqd_t queue;
     33 
     34 	sprintf(qname, "/msgqueue_%d", getpid());
     35 
     36 	queue = mq_open(qname, O_CREAT | O_RDWR | O_WRONLY,
     37 			S_IRUSR | S_IWUSR, NULL);
     38 	if (queue != (mqd_t) - 1) {
     39 		printf("In this implementation, mq_open() does not fail\n");
     40 		printf("on invalid flags\n");
     41 		mq_close(queue);
     42 		mq_unlink(qname);
     43 		return PTS_PASS;
     44 	}
     45 
     46 	printf("In this implementation, mq_open() fails on invalid flags\n");
     47 	return PTS_PASS;
     48 }
     49