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
20 /* pathconf -- adjusted for busybox */
22 /* It would be great it this could be implemented using fpathconf,
23 * but that doesn't work out very well (think FIFOs and sockets) */
31 #include <sys/statfs.h>
32 //#include <sys/statvfs.h>
34 extern __typeof(statfs) __libc_statfs;
35 /* libc_hidden_proto(stat) */
38 /* The Linux kernel headers mention this as a kind of generic value. */
43 /* Get file-specific information about PATH. */
45 pathconf (const char *path, int name)
84 int save_errno = errno;
86 if (__libc_statfs (path, &buf) < 0)
97 #ifdef _STATFS_F_NAMELEN
100 # ifdef _STATFS_F_NAME_MAX
101 return buf.f_name_max;
126 case _PC_CHOWN_RESTRICTED:
127 #ifdef _POSIX_CHOWN_RESTRICTED
128 return _POSIX_CHOWN_RESTRICTED;
134 #ifdef _POSIX_NO_TRUNC
135 return _POSIX_NO_TRUNC;
141 #ifdef _POSIX_VDISABLE
142 return _POSIX_VDISABLE;
148 #ifdef _POSIX_SYNC_IO
149 return _POSIX_SYNC_IO;
155 #if defined _POSIX_ASYNC_IO && defined __UCLIBC_HAS_LFS__
157 /* AIO is only allowed on regular files and block devices. */
160 if (stat (path, &st) < 0
161 || (! S_ISREG (st.st_mode) && ! S_ISBLK (st.st_mode)))
171 #ifdef _POSIX_PRIO_IO
172 return _POSIX_PRIO_IO;
177 case _PC_SOCK_MAXBUF:
184 case _PC_FILESIZEBITS:
188 /* We let platforms with larger file sizes overwrite this value. */
192 /* Be lazy -- skip these */
193 case _PC_REC_INCR_XFER_SIZE:
194 case _PC_REC_MAX_XFER_SIZE:
195 case _PC_REC_MIN_XFER_SIZE:
196 case _PC_REC_XFER_ALIGN:
197 case _PC_ALLOC_SIZE_MIN:
198 case _PC_SYMLINK_MAX: