1 | /* |
---|
2 | * fpathconf() - POSIX 1003.1b - 5.7.1 - Configurable Pathname Varables |
---|
3 | * |
---|
4 | * COPYRIGHT (c) 1989-1999. |
---|
5 | * On-Line Applications Research Corporation (OAR). |
---|
6 | * |
---|
7 | * The license and distribution terms for this file may be |
---|
8 | * found in the file LICENSE in this distribution or at |
---|
9 | * http://www.OARcorp.com/rtems/license.html. |
---|
10 | * |
---|
11 | * $Id$ |
---|
12 | */ |
---|
13 | |
---|
14 | #include "libio_.h" |
---|
15 | |
---|
16 | #include <unistd.h> |
---|
17 | #include <errno.h> |
---|
18 | |
---|
19 | long fpathconf( |
---|
20 | int fd, |
---|
21 | int name |
---|
22 | ) |
---|
23 | { |
---|
24 | long return_value; |
---|
25 | rtems_libio_t *iop; |
---|
26 | rtems_filesystem_limits_and_options_t *the_limits; |
---|
27 | |
---|
28 | rtems_libio_check_fd(fd); |
---|
29 | iop = rtems_libio_iop(fd); |
---|
30 | rtems_libio_check_is_open(iop); |
---|
31 | rtems_libio_check_permissions(iop, LIBIO_FLAGS_READ); |
---|
32 | |
---|
33 | /* |
---|
34 | * Now process the information request. |
---|
35 | */ |
---|
36 | |
---|
37 | the_limits = &iop->pathinfo.mt_entry->pathconf_limits_and_options; |
---|
38 | |
---|
39 | switch ( name ) { |
---|
40 | case _PC_LINK_MAX: |
---|
41 | return_value = the_limits->link_max; |
---|
42 | break; |
---|
43 | case _PC_MAX_CANON: |
---|
44 | return_value = the_limits->max_canon; |
---|
45 | break; |
---|
46 | case _PC_MAX_INPUT: |
---|
47 | return_value = the_limits->max_input; |
---|
48 | break; |
---|
49 | case _PC_NAME_MAX: |
---|
50 | return_value = the_limits->name_max; |
---|
51 | break; |
---|
52 | case _PC_PATH_MAX: |
---|
53 | return_value = the_limits->path_max; |
---|
54 | break; |
---|
55 | case _PC_PIPE_BUF: |
---|
56 | return_value = the_limits->pipe_buf; |
---|
57 | break; |
---|
58 | case _PC_CHOWN_RESTRICTED: |
---|
59 | return_value = the_limits->posix_chown_restrictions; |
---|
60 | break; |
---|
61 | case _PC_NO_TRUNC: |
---|
62 | return_value = the_limits->posix_no_trunc; |
---|
63 | break; |
---|
64 | case _PC_VDISABLE: |
---|
65 | return_value = the_limits->posix_vdisable; |
---|
66 | break; |
---|
67 | case _PC_ASYNC_IO: |
---|
68 | return_value = the_limits->posix_async_io; |
---|
69 | break; |
---|
70 | case _PC_PRIO_IO: |
---|
71 | return_value = the_limits->posix_prio_io; |
---|
72 | break; |
---|
73 | case _PC_SYNC_IO: |
---|
74 | return_value = the_limits->posix_sync_io; |
---|
75 | break; |
---|
76 | default: |
---|
77 | set_errno_and_return_minus_one( EINVAL ); |
---|
78 | break; |
---|
79 | } |
---|
80 | |
---|
81 | return return_value; |
---|
82 | } |
---|