Define LINUX_LINK_MAX and use it instead of LINK_MAX.
[glibc.git] / sysdeps / unix / sysv / linux / pathconf.c
blob98b69c0cd6e5972a10bfc69bb4b081763b962365
1 /* Linux specific extensions to pathconf.
2 Copyright (C) 1991, 95, 96, 98, 99, 2000 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"
27 /* The Linux kernel header mentioned this as a kind of generic value. */
28 #define LINUX_LINK_MAX 127
30 static long int posix_pathconf (const char *path, int name);
33 /* Get file-specific information about descriptor FD. */
34 long int
35 __pathconf (path, name)
36 const char *path;
37 int name;
39 if (name == _PC_LINK_MAX)
41 struct statfs fsbuf;
43 /* Determine the filesystem type. */
44 if (__statfs (path, &fsbuf) < 0)
45 /* not possible, return the default value. */
46 return LINK_MAX;
48 switch (fsbuf.f_type)
50 case EXT2_SUPER_MAGIC:
51 return EXT2_LINK_MAX;
53 case MINIX_SUPER_MAGIC:
54 case MINIX_SUPER_MAGIC2:
55 return MINIX_LINK_MAX;
57 case MINIX2_SUPER_MAGIC:
58 case MINIX2_SUPER_MAGIC2:
59 return MINIX2_LINK_MAX;
61 case XENIX_SUPER_MAGIC:
62 return XENIX_LINK_MAX;
64 case SYSV4_SUPER_MAGIC:
65 case SYSV2_SUPER_MAGIC:
66 return SYSV_LINK_MAX;
68 case COH_SUPER_MAGIC:
69 return COH_LINK_MAX;
71 case UFS_MAGIC:
72 case UFS_CIGAM:
73 return UFS_LINK_MAX;
75 case REISERFS_SUPER_MAGIC:
76 return REISERFS_LINK_MAX;
78 default:
79 return LINUX_LINK_MAX;
83 return posix_pathconf (path, name);
86 #define __pathconf static posix_pathconf
87 #include <sysdeps/posix/pathconf.c>