Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Fix up sign-compare issue checking for free space. ...
details: https://anonhg.NetBSD.org/src/rev/5a8b436f4fc4
branches: trunk
changeset: 763583:5a8b436f4fc4
user: dholland <dholland%NetBSD.org@localhost>
date: Sat Mar 26 21:31:23 2011 +0000
description:
Fix up sign-compare issue checking for free space. Should fix PR 43413
where accounting doesn't suspend properly.
diffstat:
sys/kern/kern_acct.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diffs (40 lines):
diff -r 94f8d96f42ce -r 5a8b436f4fc4 sys/kern/kern_acct.c
--- a/sys/kern/kern_acct.c Sat Mar 26 19:52:20 2011 +0000
+++ b/sys/kern/kern_acct.c Sat Mar 26 21:31:23 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_acct.c,v 1.90 2010/11/19 06:44:42 dholland Exp $ */
+/* $NetBSD: kern_acct.c,v 1.91 2011/03/26 21:31:23 dholland Exp $ */
/*-
* Copyright (c) 1982, 1986, 1989, 1993
@@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_acct.c,v 1.90 2010/11/19 06:44:42 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_acct.c,v 1.91 2011/03/26 21:31:23 dholland Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -174,7 +174,7 @@
{
int error;
struct statvfs *sb;
- int64_t bavail;
+ fsblkcnt_t bavail;
sb = kmem_alloc(sizeof(*sb), KM_SLEEP);
if (sb == NULL)
@@ -185,7 +185,11 @@
return (error);
}
- bavail = sb->f_bfree - sb->f_bresvd;
+ if (sb->f_bfree < sb->f_bresvd) {
+ bavail = 0;
+ } else {
+ bavail = sb->f_bfree - sb->f_bresvd;
+ }
switch (acct_state) {
case ACCT_SUSPENDED:
Home |
Main Index |
Thread Index |
Old Index