]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/posix/fpathconf.c
Tue Apr 30 17:30:46 1996 Miles Bader <miles@gnu.ai.mit.edu>
[thirdparty/glibc.git] / sysdeps / posix / fpathconf.c
CommitLineData
28f540f4
RM
1/* Copyright (C) 1991, 1995 Free Software Foundation, Inc.
2This file is part of the GNU C Library.
3
4The GNU C Library is free software; you can redistribute it and/or
5modify it under the terms of the GNU Library General Public License as
6published by the Free Software Foundation; either version 2 of the
7License, or (at your option) any later version.
8
9The GNU C Library is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12Library General Public License for more details.
13
14You should have received a copy of the GNU Library General Public
15License along with the GNU C Library; see the file COPYING.LIB. If
16not, write to the Free Software Foundation, Inc., 675 Mass Ave,
17Cambridge, MA 02139, USA. */
18
19#include <ansidecl.h>
20#include <errno.h>
21#include <stddef.h>
22#include <unistd.h>
23#include <limits.h>
24
25
26/* Get file-specific information about descriptor FD. */
27long int
28DEFUN(__fpathconf, (fd, name), int fd AND int name)
29{
30 if (fd < 0)
31 {
32 errno = EBADF;
33 return -1;
34 }
35
36 switch (name)
37 {
38 default:
39 errno = EINVAL;
40 return -1;
41
42 case _PC_LINK_MAX:
43#ifdef LINK_MAX
44 return LINK_MAX;
45#else
46 errno = ENOSYS;
47 return -1;
48#endif
49
50 case _PC_MAX_CANON:
51#ifdef MAX_CANON
52 return MAX_CANON;
53#else
54 errno = ENOSYS;
55 return -1;
56#endif
57
58 case _PC_MAX_INPUT:
59#ifdef MAX_INPUT
60 return MAX_INPUT;
61#else
62 errno = ENOSYS;
63 return -1;
64#endif
65
66 case _PC_NAME_MAX:
67#ifdef NAME_MAX
68 return NAME_MAX;
69#else
70 errno = ENOSYS;
71 return -1;
72#endif
73
74 case _PC_PATH_MAX:
75#ifdef PATH_MAX
76 return PATH_MAX;
77#else
78 errno = ENOSYS;
79 return -1;
80#endif
81
82 case _PC_PIPE_BUF:
83#ifdef PIPE_BUF
84 return PIPE_BUF;
85#else
86 errno = ENOSYS;
87 return -1;
88#endif
89
90 case _PC_CHOWN_RESTRICTED:
91#ifdef _POSIX_CHOWN_RESTRICTED
92 return _POSIX_CHOWN_RESTRICTED;
93#else
94 return -1;
95#endif
96
97 case _PC_NO_TRUNC:
98#ifdef _POSIX_NO_TRUNC
99 return _POSIX_NO_TRUNC;
100#else
101 return -1;
102#endif
103
104 case _PC_VDISABLE:
105#ifdef _POSIX_VDISABLE
106 return _POSIX_VDISABLE;
107#else
108 return -1;
109#endif
110 }
111
112 errno = ENOSYS;
113 return -1;
114}
115
116weak_alias (__fpathconf, fpathconf)