source: rtems/c/src/lib/libc/fpathconf.c @ 9c0bd65

4.104.114.84.95
Last change on this file since 9c0bd65 was 9c49db4, checked in by Joel Sherrill <joel.sherrill@…>, on 01/08/01 at 18:26:44

2001-01-08 Ralf Corsepius <corsepiu@…>

  • configure.in: Add libc/config.h
  • libc/Makefile.am: Add INCLUDES += -I. to pickup config.h
  • libc/.cvsignore: Add config.h and stamp-h
  • libc/*.c: Add config.h support.
  • Property mode set to 100644
File size: 2.0 KB
Line 
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#if HAVE_CONFIG_H
15#include "config.h"
16#endif
17
18#include <rtems/libio_.h>
19
20#include <unistd.h>
21#include <errno.h>
22
23long fpathconf(
24  int   fd,
25  int   name
26)
27{
28  long                                    return_value;
29  rtems_libio_t                          *iop;
30  rtems_filesystem_limits_and_options_t  *the_limits;
31
32  rtems_libio_check_fd(fd);
33  iop = rtems_libio_iop(fd);
34  rtems_libio_check_is_open(iop);
35  rtems_libio_check_permissions(iop, LIBIO_FLAGS_READ);
36
37  /*
38   *  Now process the information request.
39   */
40
41  the_limits = &iop->pathinfo.mt_entry->pathconf_limits_and_options;
42
43  switch ( name ) {
44    case _PC_LINK_MAX:
45      return_value = the_limits->link_max;
46      break;
47    case _PC_MAX_CANON:
48      return_value = the_limits->max_canon;
49      break;
50    case _PC_MAX_INPUT:
51      return_value = the_limits->max_input;
52      break;
53    case _PC_NAME_MAX:
54      return_value = the_limits->name_max;
55      break;
56    case _PC_PATH_MAX:
57      return_value = the_limits->path_max;
58      break;
59    case _PC_PIPE_BUF:
60      return_value = the_limits->pipe_buf;
61      break;
62    case _PC_CHOWN_RESTRICTED:
63      return_value = the_limits->posix_chown_restrictions;
64      break;
65    case _PC_NO_TRUNC:
66      return_value = the_limits->posix_no_trunc;
67      break;
68    case _PC_VDISABLE:
69      return_value = the_limits->posix_vdisable;
70      break;
71    case _PC_ASYNC_IO:
72      return_value = the_limits->posix_async_io;
73      break;
74    case _PC_PRIO_IO:
75      return_value = the_limits->posix_prio_io;
76      break;
77    case _PC_SYNC_IO:
78      return_value = the_limits->posix_sync_io;
79      break;
80    default:
81      set_errno_and_return_minus_one( EINVAL );
82      break;
83  }
84
85  return return_value;
86}
Note: See TracBrowser for help on using the repository browser.