Add POSIX test suite 1.5.2 (http://sourceforge.net/projects/posixtest/).
[dragonfly.git] / test / contrib / posixtestsuite-1.5.2 / conformance / interfaces / mq_open / speculative / 2-3.c
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  * Test that if there are two /s in a message queue name, the behavior
11  * is implementation defined.
12  */
13
14 #include <stdio.h>
15 #include <mqueue.h>
16 #include <fcntl.h>
17 #include <sys/stat.h>
18 #include <sys/types.h>
19 #include <unistd.h>
20 #include <string.h>
21 #include "posixtest.h"
22
23 #define NAMESIZE 50
24
25 int main()
26 {
27         char qname[NAMESIZE];
28         mqd_t queue;
29
30         sprintf(qname, "/tmp/msgqueue_%d", getpid());
31
32         queue = mq_open(qname, O_CREAT |O_RDWR, S_IRUSR | S_IWUSR, NULL);
33         if (queue == (mqd_t)-1) {
34                 printf("This implementation does not appear to support\n");
35                 printf("message queue names with two /s in them.\n");
36                 return PTS_PASS;
37         }
38
39         mq_close(queue);
40         mq_unlink(qname);
41
42         printf("This implementation may support message queue\n");
43         printf("names with two /s in them.\n");
44         printf("Test PASSED\n");
45         return PTS_PASS;
46 }