Module Name: src Committed By: lukem Date: Sun Apr 12 06:36:12 UTC 2009
Modified Files: src/usr.bin/fstat: fstat.c fstat.h isofs.c misc.c ntfs.c ptyfs.c tmpfs.c Log Message: Fix sign-compare issues. To generate a diff of this commit: cvs rdiff -u -r1.87 -r1.88 src/usr.bin/fstat/fstat.c cvs rdiff -u -r1.8 -r1.9 src/usr.bin/fstat/fstat.h cvs rdiff -u -r1.6 -r1.7 src/usr.bin/fstat/isofs.c cvs rdiff -u -r1.3 -r1.4 src/usr.bin/fstat/misc.c cvs rdiff -u -r1.11 -r1.12 src/usr.bin/fstat/ntfs.c cvs rdiff -u -r1.5 -r1.6 src/usr.bin/fstat/ptyfs.c cvs rdiff -u -r1.7 -r1.8 src/usr.bin/fstat/tmpfs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/fstat/fstat.c diff -u src/usr.bin/fstat/fstat.c:1.87 src/usr.bin/fstat/fstat.c:1.88 --- src/usr.bin/fstat/fstat.c:1.87 Mon Dec 29 00:59:08 2008 +++ src/usr.bin/fstat/fstat.c Sun Apr 12 06:36:12 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: fstat.c,v 1.87 2008/12/29 00:59:08 christos Exp $ */ +/* $NetBSD: fstat.c,v 1.88 2009/04/12 06:36:12 lukem Exp $ */ /*- * Copyright (c) 1988, 1993 @@ -39,7 +39,7 @@ #if 0 static char sccsid[] = "@(#)fstat.c 8.3 (Berkeley) 5/2/95"; #else -__RCSID("$NetBSD: fstat.c,v 1.87 2008/12/29 00:59:08 christos Exp $"); +__RCSID("$NetBSD: fstat.c,v 1.88 2009/04/12 06:36:12 lukem Exp $"); #endif #endif /* not lint */ @@ -519,7 +519,7 @@ (void)snprintf(mode, sizeof mode, "%o", fst.mode); else strmode(fst.mode, mode); - (void)printf(" %7lu %*s", (unsigned long)fst.fileid, nflg ? 5 : 10, mode); + (void)printf(" %7"PRIu64" %*s", fst.fileid, nflg ? 5 : 10, mode); switch (vn.v_type) { case VBLK: case VCHR: { @@ -580,7 +580,7 @@ } fsp->fsid = inode.i_dev & 0xffff; - fsp->fileid = (long)inode.i_number; + fsp->fileid = inode.i_number; fsp->mode = (mode_t)inode.i_mode; fsp->size = inode.i_size; @@ -599,7 +599,7 @@ return 0; } fsp->fsid = inode.i_dev & 0xffff; - fsp->fileid = (long)inode.i_number; + fsp->fileid = inode.i_number; if (!KVM_READ(&inode.i_e2fs_mode, &mode, sizeof mode)) { dprintf("can't read inode %p's mode at %p for pid %d", VTOI(vp), Index: src/usr.bin/fstat/fstat.h diff -u src/usr.bin/fstat/fstat.h:1.8 src/usr.bin/fstat/fstat.h:1.9 --- src/usr.bin/fstat/fstat.h:1.8 Tue Jul 22 22:58:04 2008 +++ src/usr.bin/fstat/fstat.h Sun Apr 12 06:36:12 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: fstat.h,v 1.8 2008/07/22 22:58:04 christos Exp $ */ +/* $NetBSD: fstat.h,v 1.9 2009/04/12 06:36:12 lukem Exp $ */ /*- * Copyright (c) 1988, 1993 * The Regents of the University of California. All rights reserved. @@ -30,7 +30,7 @@ struct filestat { long fsid; - long fileid; + ino_t fileid; mode_t mode; off_t size; dev_t rdev; @@ -40,7 +40,8 @@ * a kvm_read that returns true if everything is read */ #define KVM_READ(kaddr, paddr, len) \ - (kvm_read(kd, (u_long)(kaddr), (void *)(paddr), (len)) == (len)) + ((size_t)kvm_read(kd, (u_long)(kaddr), (void *)(paddr), (len)) \ + == (size_t)(len)) #define KVM_NLIST(nl) \ kvm_nlist(kd, (nl)) #define KVM_GETERR() \ Index: src/usr.bin/fstat/isofs.c diff -u src/usr.bin/fstat/isofs.c:1.6 src/usr.bin/fstat/isofs.c:1.7 --- src/usr.bin/fstat/isofs.c:1.6 Thu May 11 11:56:38 2006 +++ src/usr.bin/fstat/isofs.c Sun Apr 12 06:36:12 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: isofs.c,v 1.6 2006/05/11 11:56:38 yamt Exp $ */ +/* $NetBSD: isofs.c,v 1.7 2009/04/12 06:36:12 lukem Exp $ */ /*- * Copyright (c) 1988, 1993 * The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: isofs.c,v 1.6 2006/05/11 11:56:38 yamt Exp $"); +__RCSID("$NetBSD: isofs.c,v 1.7 2009/04/12 06:36:12 lukem Exp $"); #include <sys/param.h> #include <sys/time.h> @@ -54,7 +54,7 @@ return 0; } fsp->fsid = inode.i_dev & 0xffff; - fsp->fileid = (long)inode.i_number; + fsp->fileid = inode.i_number; fsp->mode = inode.inode.iso_mode; fsp->size = inode.i_size; fsp->rdev = inode.i_dev; Index: src/usr.bin/fstat/misc.c diff -u src/usr.bin/fstat/misc.c:1.3 src/usr.bin/fstat/misc.c:1.4 --- src/usr.bin/fstat/misc.c:1.3 Thu Feb 26 17:30:51 2009 +++ src/usr.bin/fstat/misc.c Sun Apr 12 06:36:12 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: misc.c,v 1.3 2009/02/26 17:30:51 christos Exp $ */ +/* $NetBSD: misc.c,v 1.4 2009/04/12 06:36:12 lukem Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: misc.c,v 1.3 2009/02/26 17:30:51 christos Exp $"); +__RCSID("$NetBSD: misc.c,v 1.4 2009/04/12 06:36:12 lukem Exp $"); #include <stdbool.h> #include <sys/param.h> @@ -149,7 +149,7 @@ warnx("Could not find %d symbols", n); } for (i = 0; i < NL_MAX; i++) - if ((intptr_t)f->f_ops == nl[i].n_value) + if ((uintptr_t)f->f_ops == nl[i].n_value) break; switch (i) { case NL_BPF: Index: src/usr.bin/fstat/ntfs.c diff -u src/usr.bin/fstat/ntfs.c:1.11 src/usr.bin/fstat/ntfs.c:1.12 --- src/usr.bin/fstat/ntfs.c:1.11 Mon Apr 28 20:24:12 2008 +++ src/usr.bin/fstat/ntfs.c Sun Apr 12 06:36:12 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: ntfs.c,v 1.11 2008/04/28 20:24:12 martin Exp $ */ +/* $NetBSD: ntfs.c,v 1.12 2009/04/12 06:36:12 lukem Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: ntfs.c,v 1.11 2008/04/28 20:24:12 martin Exp $"); +__RCSID("$NetBSD: ntfs.c,v 1.12 2009/04/12 06:36:12 lukem Exp $"); #include <sys/param.h> #include <sys/time.h> @@ -72,7 +72,7 @@ } fsp->fsid = ntnode.i_dev & 0xffff; - fsp->fileid = (long)ntnode.i_number; + fsp->fileid = ntnode.i_number; fsp->mode = (mode_t)ntm.ntm_mode | getftype(vp->v_type); fsp->size = fn.f_size; fsp->rdev = 0; /* XXX */ Index: src/usr.bin/fstat/ptyfs.c diff -u src/usr.bin/fstat/ptyfs.c:1.5 src/usr.bin/fstat/ptyfs.c:1.6 --- src/usr.bin/fstat/ptyfs.c:1.5 Mon Apr 28 20:24:12 2008 +++ src/usr.bin/fstat/ptyfs.c Sun Apr 12 06:36:12 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: ptyfs.c,v 1.5 2008/04/28 20:24:12 martin Exp $ */ +/* $NetBSD: ptyfs.c,v 1.6 2009/04/12 06:36:12 lukem Exp $ */ /*- * Copyright (c) 2004 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: ptyfs.c,v 1.5 2008/04/28 20:24:12 martin Exp $"); +__RCSID("$NetBSD: ptyfs.c,v 1.6 2009/04/12 06:36:12 lukem Exp $"); #include <sys/param.h> #include <sys/types.h> @@ -71,7 +71,7 @@ return 0; } fsp->fsid = mt.mnt_stat.f_fsidx.__fsid_val[0]; - fsp->fileid = (long)pn.ptyfs_fileno; + fsp->fileid = pn.ptyfs_fileno; fsp->mode = pn.ptyfs_mode; fsp->size = 0; switch (pn.ptyfs_type) { Index: src/usr.bin/fstat/tmpfs.c diff -u src/usr.bin/fstat/tmpfs.c:1.7 src/usr.bin/fstat/tmpfs.c:1.8 --- src/usr.bin/fstat/tmpfs.c:1.7 Tue Jul 29 09:10:09 2008 +++ src/usr.bin/fstat/tmpfs.c Sun Apr 12 06:36:12 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: tmpfs.c,v 1.7 2008/07/29 09:10:09 pooka Exp $ */ +/* $NetBSD: tmpfs.c,v 1.8 2009/04/12 06:36:12 lukem Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: tmpfs.c,v 1.7 2008/07/29 09:10:09 pooka Exp $"); +__RCSID("$NetBSD: tmpfs.c,v 1.8 2009/04/12 06:36:12 lukem Exp $"); #include <sys/types.h> #include <sys/param.h> @@ -61,7 +61,7 @@ } fsp->fsid = mt.mnt_stat.f_fsidx.__fsid_val[0]; - fsp->fileid = (long)tn.tn_id; + fsp->fileid = tn.tn_id; fsp->mode = tn.tn_mode | getftype(vp->v_type); fsp->size = tn.tn_size; switch (tn.tn_type) {