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
26 #include <sys/statfs.h>
27 #include <sys/statvfs.h>
30 /* Get file-specific information about PATH. */
32 __pathconf (const char *path
, int name
)
71 int save_errno
= errno
;
73 if (__statfs (path
, &buf
) < 0)
84 #ifdef _STATFS_F_NAMELEN
87 # ifdef _STATFS_F_NAME_MAX
88 return buf
.f_name_max
;
113 case _PC_CHOWN_RESTRICTED
:
114 #ifdef _POSIX_CHOWN_RESTRICTED
115 return _POSIX_CHOWN_RESTRICTED
;
121 #ifdef _POSIX_NO_TRUNC
122 return _POSIX_NO_TRUNC
;
128 #ifdef _POSIX_VDISABLE
129 return _POSIX_VDISABLE
;
135 #ifdef _POSIX_SYNC_IO
136 return _POSIX_SYNC_IO
;
142 #ifdef _POSIX_ASYNC_IO
144 /* AIO is only allowed on regular files and block devices. */
147 if (__xstat64 (_STAT_VER
, path
, &st
) < 0
148 || (! S_ISREG (st
.st_mode
) && ! S_ISBLK (st
.st_mode
)))
158 #ifdef _POSIX_PRIO_IO
159 return _POSIX_PRIO_IO
;
164 case _PC_SOCK_MAXBUF
:
171 case _PC_FILESIZEBITS
:
175 /* We let platforms with larger file sizes overwrite this value. */
179 case _PC_REC_INCR_XFER_SIZE
:
180 /* XXX It is not entirely clear what the limit is supposed to do.
181 What is incremented? */
184 case _PC_REC_MAX_XFER_SIZE
:
185 /* XXX It is not entirely clear what the limit is supposed to do.
186 In general there is no top limit of the number of bytes which
187 case be transported at once. */
190 case _PC_REC_MIN_XFER_SIZE
:
192 /* XXX It is not entirely clear what the limit is supposed to do.
193 I assume this is the block size of the filesystem. */
196 if (__statvfs64 (path
, &sv
) < 0)
201 case _PC_REC_XFER_ALIGN
:
203 /* XXX It is not entirely clear what the limit is supposed to do.
204 I assume that the number should reflect the minimal block
208 if (__statvfs64 (path
, &sv
) < 0)
213 case _PC_ALLOC_SIZE_MIN
:
215 /* XXX It is not entirely clear what the limit is supposed to do.
216 I assume that the number should reflect the minimal block
220 if (__statvfs64 (path
, &sv
) < 0)
225 case _PC_SYMLINK_MAX
:
226 /* In general there are no limits. If a system has one it should
227 overwrite this case. */
231 /* Unix systems generally have symlinks. */
237 weak_alias (__pathconf
, pathconf
)