comparison lib/fsusage.c @ 1876:663e86d5d38c

(get_fs_usage) [STATFS_TRUNCATES_BLOCK_COUNTS]: Work around SunOS botch also when block size is different from 1k.
author Jim Meyering <jim@meyering.net>
date Thu, 15 Jul 1999 07:50:06 +0000
parents 38fd8f5d359d
children 5994c6f939c5
comparison
equal deleted inserted replaced
1875:21700f6d6722 1876:663e86d5d38c
1 /* fsusage.c -- return space usage of mounted filesystems 1 /* fsusage.c -- return space usage of mounted filesystems
2 Copyright (C) 1991, 1992, 1996, 1998 Free Software Foundation, Inc. 2 Copyright (C) 1991, 1992, 1996, 1998, 1999 Free Software Foundation, Inc.
3 3
4 This program is free software; you can redistribute it and/or modify 4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option) 6 the Free Software Foundation; either version 2, or (at your option)
7 any later version. 7 any later version.
182 /* In SunOS 4.1.2, 4.1.3, and 4.1.3_U1, the block counts in the 182 /* In SunOS 4.1.2, 4.1.3, and 4.1.3_U1, the block counts in the
183 struct statfs are truncated to 2GB. These conditions detect that 183 struct statfs are truncated to 2GB. These conditions detect that
184 truncation, presumably without botching the 4.1.1 case, in which 184 truncation, presumably without botching the 4.1.1 case, in which
185 the values are not truncated. The correct counts are stored in 185 the values are not truncated. The correct counts are stored in
186 undocumented spare fields. */ 186 undocumented spare fields. */
187 if (fsd.f_blocks == 0x1fffff && fsd.f_spare[0] > 0) 187 if (fsd.f_blocks == 0x7fffffff / fsd.f_bsize && fsd.f_spare[0] > 0)
188 { 188 {
189 fsd.f_blocks = fsd.f_spare[0]; 189 fsd.f_blocks = fsd.f_spare[0];
190 fsd.f_bfree = fsd.f_spare[1]; 190 fsd.f_bfree = fsd.f_spare[1];
191 fsd.f_bavail = fsd.f_spare[2]; 191 fsd.f_bavail = fsd.f_spare[2];
192 } 192 }