1 /* Copyright (C) 1991,1995,1996,1998,2000,2001 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
24 #include <sys/statfs.h>
25 #include <sys/statvfs.h>
28 /* Get file-specific information about descriptor FD. */
30 __fpathconf (fd
, name
)
71 int save_errno
= errno
;
73 if (__fstatfs (fd
, &buf
) < 0)
77 __set_errno (save_errno
);
80 else if (errno
== ENODEV
)
87 #ifdef _STATFS_F_NAMELEN
90 # ifdef _STATFS_F_NAME_MAX
91 return buf
.f_name_max
;
116 case _PC_CHOWN_RESTRICTED
:
117 #ifdef _POSIX_CHOWN_RESTRICTED
118 return _POSIX_CHOWN_RESTRICTED
;
124 #ifdef _POSIX_NO_TRUNC
125 return _POSIX_NO_TRUNC
;
131 #ifdef _POSIX_VDISABLE
132 return _POSIX_VDISABLE
;
138 #ifdef _POSIX_SYNC_IO
139 return _POSIX_SYNC_IO
;
145 #ifdef _POSIX_ASYNC_IO
147 /* AIO is only allowed on regular files and block devices. */
150 if (__fxstat64 (_STAT_VER
, fd
, &st
) < 0
151 || (! S_ISREG (st
.st_mode
) && ! S_ISBLK (st
.st_mode
)))
161 #ifdef _POSIX_PRIO_IO
162 return _POSIX_PRIO_IO
;
167 case _PC_SOCK_MAXBUF
:
174 case _PC_FILESIZEBITS
:
178 /* We let platforms with larger file sizes overwrite this value. */
182 case _PC_REC_INCR_XFER_SIZE
:
183 /* XXX It is not entirely clear what the limit is supposed to do.
184 What is incremented? */
187 case _PC_REC_MAX_XFER_SIZE
:
188 /* XXX It is not entirely clear what the limit is supposed to do.
189 In general there is no top limit of the number of bytes which
190 case be transported at once. */
193 case _PC_REC_MIN_XFER_SIZE
:
195 /* XXX It is not entirely clear what the limit is supposed to do.
196 I assume this is the block size of the filesystem. */
199 if (__fstatvfs64 (fd
, &sv
) < 0)
204 case _PC_REC_XFER_ALIGN
:
206 /* XXX It is not entirely clear what the limit is supposed to do.
207 I assume that the number should reflect the minimal block
211 if (__fstatvfs64 (fd
, &sv
) < 0)
216 case _PC_ALLOC_SIZE_MIN
:
218 /* XXX It is not entirely clear what the limit is supposed to do.
219 I assume that the number should reflect the minimal block
223 if (__fstatvfs64 (fd
, &sv
) < 0)
228 case _PC_SYMLINK_MAX
:
229 /* In general there are no limits. If a system has one it should
230 overwrite this case. */
236 weak_alias (__fpathconf
, fpathconf
)