1 | /* |
---|
2 | * COPYRIGHT (c) 1989-2010. |
---|
3 | * On-Line Applications Research Corporation (OAR). |
---|
4 | * |
---|
5 | * The license and distribution terms for this file may be |
---|
6 | * found in the file LICENSE in this distribution or at |
---|
7 | * http://www.rtems.com/license/LICENSE. |
---|
8 | * |
---|
9 | * $Id$ |
---|
10 | */ |
---|
11 | |
---|
12 | /* Includes */ |
---|
13 | #include <bsp.h> |
---|
14 | #include <tmacros.h> |
---|
15 | #include <stdio.h> |
---|
16 | #include <sys/types.h> |
---|
17 | #include <sys/stat.h> |
---|
18 | #include <fcntl.h> |
---|
19 | #include <unistd.h> |
---|
20 | #include <errno.h> |
---|
21 | |
---|
22 | #include <rtems.h> |
---|
23 | #include <rtems/libio.h> |
---|
24 | |
---|
25 | |
---|
26 | void test_main(void) |
---|
27 | { |
---|
28 | |
---|
29 | int status = -1; |
---|
30 | int fd = 0; |
---|
31 | |
---|
32 | puts("\n\n*** FIFO / PIPE OPEN TEST - 3 ***"); |
---|
33 | puts( |
---|
34 | "\n\nConfiguration: Pipes configured, \ |
---|
35 | but number of barriers configured = 1\n\ |
---|
36 | Required number of barriers = 2" |
---|
37 | ); |
---|
38 | |
---|
39 | puts("\n\nCreating directory /tmp"); |
---|
40 | status = mkdir("/tmp", 0777); |
---|
41 | rtems_test_assert(status == 0); |
---|
42 | |
---|
43 | puts("\n\nCreating fifo /tmp/fifo"); |
---|
44 | status = mkfifo("/tmp/fifo01", 0777); |
---|
45 | rtems_test_assert(status == 0); |
---|
46 | |
---|
47 | puts("\n\nAttempt to open the fifo file\n"); |
---|
48 | puts( |
---|
49 | "Must result in failure since \n\ |
---|
50 | number of barriers = 1 => not all resources\n\ |
---|
51 | were acquired" |
---|
52 | ); |
---|
53 | |
---|
54 | fd = open("/tmp/fifo01", O_RDONLY); |
---|
55 | rtems_test_assert(fd == -1); |
---|
56 | rtems_test_assert(errno == EINTR); // Should this |
---|
57 | // be ENOMEM? |
---|
58 | puts("\n\nRemove the entry /tmp/fifo01"); |
---|
59 | status = unlink("/tmp/fifo01"); |
---|
60 | rtems_test_assert(status == 0); |
---|
61 | |
---|
62 | puts("\n\nRemove directory /tmp"); |
---|
63 | status = rmdir("/tmp"); |
---|
64 | rtems_test_assert(status == 0); |
---|
65 | |
---|
66 | puts("\n\n*** END OF FIFO / PIPE OPEN TEST - 3 ***"); |
---|
67 | } |
---|
68 | |
---|
69 | rtems_task Init( |
---|
70 | rtems_task_argument not_used |
---|
71 | ) |
---|
72 | { |
---|
73 | test_main(); |
---|
74 | rtems_test_exit(0); |
---|
75 | } |
---|
76 | |
---|
77 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
---|
78 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
---|
79 | |
---|
80 | #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM |
---|
81 | #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 6 |
---|
82 | |
---|
83 | #define CONFIGURE_MAXIMUM_TASKS 1 |
---|
84 | |
---|
85 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
---|
86 | #define CONFIGURE_PIPES_ENABLED |
---|
87 | #define CONFIGURE_INIT |
---|
88 | #define CONFIGURE_MAXIMUM_BARRIERS 1 |
---|
89 | |
---|
90 | #include <rtems/confdefs.h> |
---|
91 | |
---|
92 | /* end of file */ |
---|