1 /* Copyright (C) 1991,1995,1996,1998,2000,2001,2003
2 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
25 #include <sys/statfs.h>
26 #include <sys/statvfs.h>
29 /* Get file-specific information about descriptor FD. */
31 __fpathconf (fd
, name
)
72 int save_errno
= errno
;
74 if (__fstatfs (fd
, &buf
) < 0)
78 __set_errno (save_errno
);
81 else if (errno
== ENODEV
)
88 #ifdef _STATFS_F_NAMELEN
91 # ifdef _STATFS_F_NAME_MAX
92 return buf
.f_name_max
;
117 case _PC_CHOWN_RESTRICTED
:
118 #ifdef _POSIX_CHOWN_RESTRICTED
119 return _POSIX_CHOWN_RESTRICTED
;
125 #ifdef _POSIX_NO_TRUNC
126 return _POSIX_NO_TRUNC
;
132 #ifdef _POSIX_VDISABLE
133 return _POSIX_VDISABLE
;
139 #ifdef _POSIX_SYNC_IO
140 return _POSIX_SYNC_IO
;
146 #ifdef _POSIX_ASYNC_IO
148 /* AIO is only allowed on regular files and block devices. */
151 if (__fxstat64 (_STAT_VER
, fd
, &st
) < 0
152 || (! S_ISREG (st
.st_mode
) && ! S_ISBLK (st
.st_mode
)))
162 #ifdef _POSIX_PRIO_IO
163 return _POSIX_PRIO_IO
;
168 case _PC_SOCK_MAXBUF
:
175 case _PC_FILESIZEBITS
:
179 /* We let platforms with larger file sizes overwrite this value. */
183 case _PC_REC_INCR_XFER_SIZE
:
184 /* XXX It is not entirely clear what the limit is supposed to do.
185 What is incremented? */
188 case _PC_REC_MAX_XFER_SIZE
:
189 /* XXX It is not entirely clear what the limit is supposed to do.
190 In general there is no top limit of the number of bytes which
191 case be transported at once. */
194 case _PC_REC_MIN_XFER_SIZE
:
196 /* XXX It is not entirely clear what the limit is supposed to do.
197 I assume this is the block size of the filesystem. */
200 if (__fstatvfs64 (fd
, &sv
) < 0)
205 case _PC_REC_XFER_ALIGN
:
207 /* XXX It is not entirely clear what the limit is supposed to do.
208 I assume that the number should reflect the minimal block
212 if (__fstatvfs64 (fd
, &sv
) < 0)
217 case _PC_ALLOC_SIZE_MIN
:
219 /* XXX It is not entirely clear what the limit is supposed to do.
220 I assume that the number should reflect the minimal block
224 if (__fstatvfs64 (fd
, &sv
) < 0)
229 case _PC_SYMLINK_MAX
:
230 /* In general there are no limits. If a system has one it should
231 overwrite this case. */
235 /* Unix systems generally have symlinks. */
241 weak_alias (__fpathconf
, fpathconf
)