1 /* Copyright (C) 1991-2023 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, see
16 <https://www.gnu.org/licenses/>. */
24 #include <sys/statfs.h>
25 #include <sys/statvfs.h>
28 /* Get file-specific information about PATH. */
30 __pathconf (const char *path
, int name
)
69 int save_errno
= errno
;
71 if (__statvfs64 (path
, &sv
) < 0)
103 case _PC_CHOWN_RESTRICTED
:
104 #if _POSIX_CHOWN_RESTRICTED == -1
105 # error "Invalid value for _POSIX_CHOWN_RESTRICTED"
107 return _POSIX_CHOWN_RESTRICTED
;
110 #if _POSIX_NO_TRUNC == -1
111 # error "Invalid value for _POSIX_NO_TRUNC"
113 return _POSIX_NO_TRUNC
;
116 #if _POSIX_VDISABLE == -1
117 # error "Invalid value for _POSIX_VDISABLE"
119 return _POSIX_VDISABLE
;
122 #ifdef _POSIX_SYNC_IO
123 return _POSIX_SYNC_IO
;
129 #ifdef _POSIX_ASYNC_IO
131 /* AIO is only allowed on regular files and block devices. */
132 struct __stat64_t64 st
;
134 if (__stat64_time64 (path
, &st
) < 0
135 || (! S_ISREG (st
.st_mode
) && ! S_ISBLK (st
.st_mode
)))
145 #ifdef _POSIX_PRIO_IO
146 return _POSIX_PRIO_IO
;
151 case _PC_SOCK_MAXBUF
:
158 case _PC_FILESIZEBITS
:
162 /* We let platforms with larger file sizes overwrite this value. */
166 case _PC_REC_INCR_XFER_SIZE
:
167 /* XXX It is not entirely clear what the limit is supposed to do.
168 What is incremented? */
171 case _PC_REC_MAX_XFER_SIZE
:
172 /* XXX It is not entirely clear what the limit is supposed to do.
173 In general there is no top limit of the number of bytes which
174 case be transported at once. */
177 case _PC_REC_MIN_XFER_SIZE
:
179 /* XXX It is not entirely clear what the limit is supposed to do.
180 I assume this is the block size of the filesystem. */
183 if (__statvfs64 (path
, &sv
) < 0)
188 case _PC_REC_XFER_ALIGN
:
190 /* XXX It is not entirely clear what the limit is supposed to do.
191 I assume that the number should reflect the minimal block
195 if (__statvfs64 (path
, &sv
) < 0)
200 case _PC_ALLOC_SIZE_MIN
:
202 /* XXX It is not entirely clear what the limit is supposed to do.
203 I assume that the number should reflect the minimal block
207 if (__statvfs64 (path
, &sv
) < 0)
212 case _PC_SYMLINK_MAX
:
213 /* In general there are no limits. If a system has one it should
214 overwrite this case. */
218 /* Unix systems generally have symlinks. */
224 weak_alias (__pathconf
, pathconf
)