source: rtems/testsuites/psxtests/psxpipe01/init.c @ 9b4422a2

4.115
Last change on this file since 9b4422a2 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 2.8 KB
Line 
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
10#ifdef HAVE_CONFIG_H
11#include "config.h"
12#endif
13
14#include <bsp.h>
15#include <pmacros.h>
16#include <sys/types.h>
17#include <sys/stat.h>
18#include <fcntl.h>
19#include <unistd.h>
20#include <errno.h>
21#include <rtems/libcsupport.h>
22
23rtems_task Init(
24  rtems_task_argument not_used
25)
26{
27  int fd[2] = {0,0};
28  int dummy_fd[2] = {0,0};
29  int status = 0;
30  void *alloc_ptr = (void *)0;
31
32  puts( "*** TEST POSIX PIPE CREATION - 01 ***" );
33
34  puts( "Init - attempt to create pipe -- expect EFAULT" );
35  status = pipe( NULL );
36  rtems_test_assert( status == -1 );
37  rtems_test_assert( errno == EFAULT );
38
39  puts( "Init - create pipe -- OK" );
40  status = pipe( fd );
41  rtems_test_assert( status == 0 );
42
43  status = close( fd[0] );
44  status |= close( fd[1] );
45  rtems_test_assert( status == 0 );
46
47  puts( "Init - create pipe -- OK" );
48  status = pipe( fd );
49  rtems_test_assert( status == 0 );
50
51  status = close( fd[0] );
52  status |= close( fd[1] );
53  rtems_test_assert( status == 0 );
54
55  alloc_ptr = malloc( malloc_free_space() - 4 );
56
57  /* case where mkfifo fails */
58  puts( "Init - attempt to create pipe -- expect ENOMEM" );
59  status = pipe( fd );
60  rtems_test_assert( status == -1 );
61  rtems_test_assert( errno == ENOMEM );
62
63  free( alloc_ptr );
64 
65  dummy_fd[0] = open( "/file01", O_RDONLY | O_CREAT, S_IRWXU );
66  rtems_test_assert( dummy_fd[0] != -1 );
67  dummy_fd[1] = open( "/file02", O_RDONLY | O_CREAT, S_IRWXU );
68  rtems_test_assert( dummy_fd[1] != -1 );
69
70  /* case where fifo_open for read => open fails */
71  puts( "Init - create pipe -- expect ENFILE" );
72  status = pipe( fd );
73  rtems_test_assert( status == -1 );
74  rtems_test_assert( errno == ENFILE );
75
76  status = close( dummy_fd[1] );
77  status |= unlink( "/file02" );
78  rtems_test_assert( status == 0 );
79
80  /* case where fifo_open for write => open fails */
81  puts( "Init - create pipe -- expect ENFILE" );
82  status = pipe( fd );
83  rtems_test_assert( status == -1 );
84  rtems_test_assert( errno == ENFILE );
85
86  status = close( dummy_fd[0] );
87  status |= unlink( "/file01" );
88  rtems_test_assert( status == 0 );
89
90  puts( "*** END OF TEST POSIX PIPE CREATION - 01 ***" );
91  rtems_test_exit( 0 );
92}
93
94/* configuration information */
95
96#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
97#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
98
99#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
100#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 5
101
102#define CONFIGURE_MAXIMUM_TASKS 1
103#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
104
105#define CONFIGURE_PIPES_ENABLED
106#define CONFIGURE_MAXIMUM_PIPES 2
107
108#define CONFIGURE_INIT
109#include <rtems/confdefs.h>
110/* end of file */
Note: See TracBrowser for help on using the repository browser.