source: rtems/c/src/lib/libc/fpathconf.c @ 0162910

4.104.114.84.95
Last change on this file since 0162910 was cca4400, checked in by Joel Sherrill <joel.sherrill@…>, on 12/10/98 at 23:31:54

Merged Eric Norum's select patch that was based on 4.0 and resolved
all conflicts.

  • Property mode set to 100644
File size: 2.2 KB
Line 
1/*
2 *  fpathconf() - POSIX 1003.1b - 5.7.1 - Configurable Pathname Varables
3 *
4 *  COPYRIGHT (c) 1989-1998.
5 *  On-Line Applications Research Corporation (OAR).
6 *  Copyright assigned to U.S. Government, 1994.
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.OARcorp.com/rtems/license.html.
11 *
12 *  $Id$
13 */
14
15#include "libio_.h"
16
17#include <unistd.h>
18#include <errno.h>
19
20long fpathconf(
21  int   fd,
22  int   name
23)
24{
25  long                                    return_value;
26  rtems_libio_t                          *iop;
27  rtems_filesystem_limits_and_options_t  *the_limits;
28
29  rtems_libio_check_fd(fd);
30  iop = rtems_libio_iop(fd);
31  rtems_libio_check_permissions(iop, LIBIO_FLAGS_READ);
32
33  /*
34   *  If this file descriptor is mapped to an external set of handlers,
35   *  then it is an error since fpathconf() is not included in the
36   *  set.
37   */
38
39  if ( iop->flags & LIBIO_FLAGS_HANDLER_MASK )
40    set_errno_and_return_minus_one( EBADF );
41
42  /*
43   *  Now process the information request.
44   */
45
46  the_limits = &iop->pathinfo.mt_entry->pathconf_limits_and_options;
47
48  switch ( name ) {
49    case _PC_LINK_MAX:
50      return_value = the_limits->link_max;
51      break;
52    case _PC_MAX_CANON:
53      return_value = the_limits->max_canon;
54      break;
55    case _PC_MAX_INPUT:
56      return_value = the_limits->max_input;
57      break;
58    case _PC_NAME_MAX:
59      return_value = the_limits->name_max;
60      break;
61    case _PC_PATH_MAX:
62      return_value = the_limits->path_max;
63      break;
64    case _PC_PIPE_BUF:
65      return_value = the_limits->pipe_buf;
66      break;
67    case _PC_CHOWN_RESTRICTED:
68      return_value = the_limits->posix_chown_restrictions;
69      break;
70    case _PC_NO_TRUNC:
71      return_value = the_limits->posix_no_trunc;
72      break;
73    case _PC_VDISABLE:
74      return_value = the_limits->posix_vdisable;
75      break;
76    case _PC_ASYNC_IO:
77      return_value = the_limits->posix_async_io;
78      break;
79    case _PC_PRIO_IO:
80      return_value = the_limits->posix_prio_io;
81      break;
82    case _PC_SYNC_IO:
83      return_value = the_limits->posix_sync_io;
84      break;
85    default:
86      set_errno_and_return_minus_one( EINVAL );
87      break;
88  }
89
90  return return_value;
91}
Note: See TracBrowser for help on using the repository browser.