From 07a3253de2c3f9bc2d96a351680ec72548dadd2d Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 23 Nov 1998 19:07:58 +0000 Subject: Added base version of file system infrastructure. This includes a major overhaul of the RTEMS system call interface. This base file system is the "In-Memory File System" aka IMFS. The design and implementation was done by the following people: + Joel Sherrill (joel@OARcorp.com) + Jennifer Averett (jennifer@OARcorp.com) + Steve "Mr Mount" Salitasc (salitasc@OARcorp.com) + Kerwin Wade (wade@OARcorp.com) PROBLEMS ======== + It is VERY likely that merging this will break the UNIX port. This can/will be fixed. + There is likely some reentrancy/mutual exclusion needed. + Eventually, there should be a "mini-IMFS" description table to eliminate links, symlinks, etc to save memory. All you need to have "classic RTEMS" functionality is technically directories and device IO. All the rest could be left out to save memory. --- c/src/lib/libc/fpathconf.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 c/src/lib/libc/fpathconf.c (limited to 'c/src/lib/libc/fpathconf.c') diff --git a/c/src/lib/libc/fpathconf.c b/c/src/lib/libc/fpathconf.c new file mode 100644 index 0000000000..ea2377e15b --- /dev/null +++ b/c/src/lib/libc/fpathconf.c @@ -0,0 +1,91 @@ +/* + * fpathconf() - POSIX 1003.1b - 5.7.1 - Configurable Pathname Varables + * + * COPYRIGHT (c) 1989-1998. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include "libio_.h" + +#include +#include + +long fpathconf( + int fd, + int name +) +{ + long return_value; + rtems_libio_t *iop; + rtems_filesystem_limits_and_options_t *the_limits; + + /* + * If this file descriptor is mapped to an external set of handlers, + * then it is an error since fpathconf() is not included in the + * set. + */ + + if ( rtems_file_descriptor_type( fd ) ) + set_errno_and_return_minus_one( EBADF ); + + /* + * Now process the information request. + */ + + iop = rtems_libio_iop(fd); + rtems_libio_check_fd(fd); + rtems_libio_check_permissions(iop, LIBIO_FLAGS_READ); + + the_limits = &iop->pathinfo.mt_entry->pathconf_limits_and_options; + + switch ( name ) { + case _PC_LINK_MAX: + return_value = the_limits->link_max; + break; + case _PC_MAX_CANON: + return_value = the_limits->max_canon; + break; + case _PC_MAX_INPUT: + return_value = the_limits->max_input; + break; + case _PC_NAME_MAX: + return_value = the_limits->name_max; + break; + case _PC_PATH_MAX: + return_value = the_limits->path_max; + break; + case _PC_PIPE_BUF: + return_value = the_limits->pipe_buf; + break; + case _PC_CHOWN_RESTRICTED: + return_value = the_limits->posix_chown_restrictions; + break; + case _PC_NO_TRUNC: + return_value = the_limits->posix_no_trunc; + break; + case _PC_VDISABLE: + return_value = the_limits->posix_vdisable; + break; + case _PC_ASYNC_IO: + return_value = the_limits->posix_async_io; + break; + case _PC_PRIO_IO: + return_value = the_limits->posix_prio_io; + break; + case _PC_SYNC_IO: + return_value = the_limits->posix_sync_io; + break; + default: + set_errno_and_return_minus_one( EINVAL ); + break; + } + + return return_value; +} -- cgit v1.2.3