From e095d37b912eb8fc06b17fa478340df31b2dd373 Mon Sep 17 00:00:00 2001 From: mjacob Date: Wed, 25 Jul 2001 20:31:20 +0000 Subject: [PATCH] Fix 64 bit issues so that sockstat && fstat work correctly on alpha. PR: 29231 Submitted by: pherman@frenchfries.net MFC after: 2 weeks --- usr.bin/fstat/fstat.c | 17 ++++++++--------- usr.bin/sockstat/sockstat.pl | 2 +- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/usr.bin/fstat/fstat.c b/usr.bin/fstat/fstat.c index 1ba66227c29..96be7061ba0 100644 --- a/usr.bin/fstat/fstat.c +++ b/usr.bin/fstat/fstat.c @@ -665,7 +665,7 @@ pipetrans(pi, i, flag) goto bad; } - printf("* pipe %8x <-> %8x", (int)pi, (int)pip.pipe_peer); + printf("* pipe %8lx <-> %8lx", (u_long)pi, (u_long)pip.pipe_peer); printf(" %6d", (int)pip.pipe_buffer.cnt); rw[0] = '\0'; if (flag & FREAD) @@ -763,16 +763,16 @@ socktrans(sock, i) (void *)so.so_pcb); goto bad; } - printf(" %x", (int)inpcb.inp_ppcb); + printf(" %lx", (u_long)inpcb.inp_ppcb); } } else if (so.so_pcb) - printf(" %x", (int)so.so_pcb); + printf(" %lx", (u_long)so.so_pcb); break; case AF_UNIX: /* print address of pcb and connected pcb */ if (so.so_pcb) { - printf(" %x", (int)so.so_pcb); + printf(" %lx", (u_long)so.so_pcb); if (kvm_read(kd, (u_long)so.so_pcb, (char *)&unpcb, sizeof(struct unpcb)) != sizeof(struct unpcb)){ dprintf(stderr, "can't read unpcb at %p\n", @@ -789,14 +789,14 @@ socktrans(sock, i) if (!(so.so_state & SS_CANTSENDMORE)) *cp++ = '>'; *cp = '\0'; - printf(" %s %x", shoconn, - (int)unpcb.unp_conn); + printf(" %s %lx", shoconn, + (u_long)unpcb.unp_conn); } } break; default: /* print protocol number and socket address */ - printf(" %d %x", proto.pr_protocol, (int)sock); + printf(" %d %lx", proto.pr_protocol, (u_long)sock); } printf("\n"); return; @@ -818,8 +818,7 @@ dev2udev(dev) if (KVM_READ(dev, &si, sizeof si)) { return si.si_udev; } else { - dprintf(stderr, "can't convert dev_t %p to a udev_t\n", - (void *)dev); + dprintf(stderr, "can't convert dev_t %x to a udev_t\n", dev); return -1; } } diff --git a/usr.bin/sockstat/sockstat.pl b/usr.bin/sockstat/sockstat.pl index 0f871c55e30..df1c897996c 100644 --- a/usr.bin/sockstat/sockstat.pl +++ b/usr.bin/sockstat/sockstat.pl @@ -57,7 +57,7 @@ sub gather() { die("exec(netstat): $!\n"); } while ($line = ) { - next unless ($line =~ m/^[0-9a-f]{8} /); + next unless ($line =~ m/^[0-9a-f]{8} /) || ($line =~ m/^[0-9a-f]{16} /); chomp($line); @fields = split(' ', $line); $netstat{$fields[0]} = [ @fields ]; -- 2.45.0