1 | /* |
---|
2 | * COPYRIGHT (c) 1989-2012. |
---|
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.org/license/LICENSE. |
---|
8 | */ |
---|
9 | |
---|
10 | #ifdef HAVE_CONFIG_H |
---|
11 | #include "config.h" |
---|
12 | #endif |
---|
13 | |
---|
14 | #include <tmacros.h> |
---|
15 | #include "test_support.h" |
---|
16 | #include <errno.h> |
---|
17 | |
---|
18 | /* forward declarations to avoid warnings */ |
---|
19 | rtems_task Init(rtems_task_argument argument); |
---|
20 | |
---|
21 | rtems_task Init( |
---|
22 | rtems_task_argument argument |
---|
23 | ) |
---|
24 | { |
---|
25 | FILE *fd; |
---|
26 | int sc; |
---|
27 | |
---|
28 | puts( "\n\n*** TEST FILE LOCK 01 ***" ); |
---|
29 | |
---|
30 | puts( "Open /testfile" ); |
---|
31 | fd = fopen( "/testfile", "w+" ); |
---|
32 | rtems_test_assert( fd ); |
---|
33 | |
---|
34 | puts( "flockfile /testfile" ); |
---|
35 | flockfile( fd ); |
---|
36 | |
---|
37 | puts( "ftrylockfile /testfile" ); |
---|
38 | sc = ftrylockfile( fd ); |
---|
39 | rtems_test_assert( sc == -1 ); |
---|
40 | rtems_test_assert( errno == ENOTSUP ); |
---|
41 | |
---|
42 | puts( "flockfile /testfile" ); |
---|
43 | flockfile( fd ); |
---|
44 | |
---|
45 | puts( "funlockfile /testfile" ); |
---|
46 | funlockfile( fd ); |
---|
47 | |
---|
48 | puts( "*** END OF TEST FILE LOCK 01 ***" ); |
---|
49 | |
---|
50 | rtems_test_exit(0); |
---|
51 | } |
---|
52 | |
---|
53 | /* configuration information */ |
---|
54 | |
---|
55 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
---|
56 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
---|
57 | |
---|
58 | #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 4 |
---|
59 | #define CONFIGURE_MAXIMUM_TASKS 1 |
---|
60 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
---|
61 | |
---|
62 | #define CONFIGURE_INIT |
---|
63 | |
---|
64 | #include <rtems/confdefs.h> |
---|
65 | /* end of file */ |
---|