]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/unix/sysv/linux/pathconf.h
(allocate_stack): If MULTI_PAGE_ALIASING is defined and the size of the stack which...
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / pathconf.h
CommitLineData
0d83b42e
RM
1/* Common parts of Linux implementation of pathconf and fpathconf.
2 Copyright (C) 1991,95,96,98,99,2000,2001,2002 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
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.
9
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.
14
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
18 02111-1307 USA. */
19
20#include <unistd.h>
21#include <errno.h>
22#include <sys/statfs.h>
23#include "linux_fsinfo.h"
24
25/* Used like: return statfs_link_max (__statfs (name, &buf), &buf); */
26
69c708ed 27static inline long int
0d83b42e
RM
28statfs_link_max (int result, const struct statfs *fsbuf)
29{
30 if (result < 0)
31 {
32 if (errno == ENOSYS)
33 /* Not possible, return the default value. */
34 return LINUX_LINK_MAX;
35
36 /* Some error occured. */
37 return -1;
38 }
39
40 switch (fsbuf->f_type)
41 {
42 case EXT2_SUPER_MAGIC:
43 return EXT2_LINK_MAX;
44
45 case MINIX_SUPER_MAGIC:
46 case MINIX_SUPER_MAGIC2:
47 return MINIX_LINK_MAX;
48
49 case MINIX2_SUPER_MAGIC:
50 case MINIX2_SUPER_MAGIC2:
51 return MINIX2_LINK_MAX;
52
53 case XENIX_SUPER_MAGIC:
54 return XENIX_LINK_MAX;
55
56 case SYSV4_SUPER_MAGIC:
57 case SYSV2_SUPER_MAGIC:
58 return SYSV_LINK_MAX;
59
60 case COH_SUPER_MAGIC:
61 return COH_LINK_MAX;
62
63 case UFS_MAGIC:
64 case UFS_CIGAM:
65 return UFS_LINK_MAX;
66
67 case REISERFS_SUPER_MAGIC:
68 return REISERFS_LINK_MAX;
69
70 case XFS_SUPER_MAGIC:
71 return XFS_LINK_MAX;
72
73 default:
74 return LINUX_LINK_MAX;
75 }
76}
69c708ed
RM
77
78/* Used like: return statfs_filesize_max (__statfs (name, &buf), &buf); */
79
80static inline long int
81statfs_filesize_max (int result, const struct statfs *fsbuf)
82{
83 if (result < 0)
84 {
85 if (errno == ENOSYS)
86 /* Not possible, return the default value. */
87 return 32;
88
89 /* Some error occured. */
90 return -1;
91 }
92
93 switch (fsbuf->f_type)
94 {
95 case EXT2_SUPER_MAGIC:
96 case UFS_MAGIC:
97 case UFS_CIGAM:
98 case REISERFS_SUPER_MAGIC:
99 case XFS_SUPER_MAGIC:
100 case SMB_SUPER_MAGIC:
101 case NTFS_SUPER_MAGIC:
102 case UDF_SUPER_MAGIC:
103 case JFS_SUPER_MAGIC:
104 return 64;
105
106 case MSDOS_SUPER_MAGIC:
107 case JFFS_SUPER_MAGIC:
108 case JFFS2_SUPER_MAGIC:
109 case NCP_SUPER_MAGIC:
110 case ROMFS_SUPER_MAGIC:
111 return 32;
112
113 default:
114 return 32;
115 }
116}