Update.
[glibc.git] / sysdeps / unix / sysv / linux / pathconf.c
blobdcf87d5284983bbd007aa781978787923fee09ca
1 /* Linux specific extensions to pathconf.
2 Copyright (C) 1991, 1995, 1996, 1998 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 Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 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 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If not,
17 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
20 #include <unistd.h>
21 #include <limits.h>
22 #include <sys/statfs.h>
24 #include "linux_fsinfo.h"
26 static long int posix_pathconf (const char *path, int name);
29 /* Get file-specific information about descriptor FD. */
30 long int
31 __pathconf (path, name)
32 const char *path;
33 int name;
35 if (name == _PC_LINK_MAX)
37 struct statfs fsbuf;
39 /* Determine the filesystem type. */
40 if (__statfs (path, &fsbuf) < 0)
41 /* not possible, return the default value. */
42 return LINK_MAX;
44 switch (fsbuf.f_type)
46 case EXT2_SUPER_MAGIC:
47 return EXT2_LINK_MAX;
49 case MINIX_SUPER_MAGIC:
50 case MINIX_SUPER_MAGIC2:
51 return MINIX_LINK_MAX;
53 case MINIX2_SUPER_MAGIC:
54 case MINIX2_SUPER_MAGIC2:
55 return MINIX2_LINK_MAX;
57 case XENIX_SUPER_MAGIC:
58 return XENIX_LINK_MAX;
60 case SYSV4_SUPER_MAGIC:
61 case SYSV2_SUPER_MAGIC:
62 return SYSV_LINK_MAX;
64 case COH_SUPER_MAGIC:
65 return COH_LINK_MAX;
67 case UFS_MAGIC:
68 case UFS_CIGAM:
69 return UFS_LINK_MAX;
71 default:
72 return LINK_MAX;
76 return posix_pathconf (path, name);
79 #define __pathconf static posix_pathconf
80 #include <sysdeps/posix/pathconf.c>