update plan9/plan9port to current upstream version
(GH_COMMIT 009b0cb5eb340b8bc3268bfaeb86abfeffdc1b1c). auxstats(getifaddrs(3)) patches have already been accepted and committed upstream
This commit is contained in:
parent
d6bbdb0616
commit
7978216b37
@ -1,16 +1,15 @@
|
||||
# $OpenBSD: Makefile,v 1.11 2015/12/08 13:05:29 gsoares Exp $
|
||||
# $OpenBSD: Makefile,v 1.12 2015/12/08 22:14:32 gsoares Exp $
|
||||
|
||||
ONLY_FOR_ARCHS = amd64 i386 powerpc
|
||||
BROKEN-powerpc = threading issues
|
||||
|
||||
COMMENT = Plan 9 from user space
|
||||
|
||||
DISTNAME = plan9port-20151111
|
||||
REVISION = 1
|
||||
DISTNAME = plan9port-20151208
|
||||
|
||||
GH_ACCOUNT = 9fans
|
||||
GH_PROJECT = plan9port
|
||||
GH_COMMIT = 6a93bd5c92bd2954314f492f10bbcac2c3416da0
|
||||
GH_COMMIT = 009b0cb5eb340b8bc3268bfaeb86abfeffdc1b1c
|
||||
|
||||
CATEGORIES = plan9
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
SHA256 (plan9port/6a93bd5c92bd2954314f492f10bbcac2c3416da0.tar.gz) = O5FlvPIqAXSRjpxwHB+oI/Syfe2p3Su76GFrMfOV8AM=
|
||||
SHA256 (plan9port/009b0cb5eb340b8bc3268bfaeb86abfeffdc1b1c.tar.gz) = IwzGVZO0JGlSczho89DCH8ci3Bh4eEVkEITI7bJFMxg=
|
||||
SHA256 (plan9port/pgw.tar.bz2) = WMdWEelUjG7muSL6OsgnCmPsJMn88b1OPtEYQn8TVtw=
|
||||
SHA256 (plan9port/roget.tar.bz2) = sk8FE1Tavljx2CXinbOGCRyErsmBJdvkma3spRoyqDY=
|
||||
SHA256 (plan9port/scat.tgz) = qZX1JUSnEvK9uH9TFjjUyEYiT6khLQNOO9joCcuZvh4=
|
||||
SIZE (plan9port/6a93bd5c92bd2954314f492f10bbcac2c3416da0.tar.gz) = 23458495
|
||||
SIZE (plan9port/009b0cb5eb340b8bc3268bfaeb86abfeffdc1b1c.tar.gz) = 23459471
|
||||
SIZE (plan9port/pgw.tar.bz2) = 9404968
|
||||
SIZE (plan9port/roget.tar.bz2) = 482956
|
||||
SIZE (plan9port/scat.tgz) = 5145346
|
||||
|
@ -1,160 +0,0 @@
|
||||
$OpenBSD: patch-src_cmd_auxstats_OpenBSD_c,v 1.5 2015/12/08 13:41:01 gsoares Exp $
|
||||
|
||||
replace kvm(3) with getifaddrs(3)
|
||||
|
||||
patch already sent upstream
|
||||
https://plan9port-review.googlesource.com/1410
|
||||
|
||||
--- src/cmd/auxstats/OpenBSD.c.orig Wed Nov 11 12:09:34 2015
|
||||
+++ src/cmd/auxstats/OpenBSD.c Mon Dec 7 02:20:58 2015
|
||||
@@ -1,14 +1,12 @@
|
||||
#include <u.h>
|
||||
-#include <kvm.h>
|
||||
-#include <nlist.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/sched.h>
|
||||
#include <sys/socket.h>
|
||||
+#include <ifaddrs.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/time.h>
|
||||
#include <net/if.h>
|
||||
-#include <net/if_var.h>
|
||||
#include <machine/apmvar.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <uvm/uvm_param.h>
|
||||
@@ -24,11 +22,9 @@ void xcpu(int);
|
||||
void xswap(int);
|
||||
void xsysctl(int);
|
||||
void xnet(int);
|
||||
-void xkvm(int);
|
||||
|
||||
void (*statfn[])(int) =
|
||||
{
|
||||
- xkvm,
|
||||
xapm,
|
||||
xloadavg,
|
||||
xcpu,
|
||||
@@ -37,14 +33,6 @@ void (*statfn[])(int) =
|
||||
0
|
||||
};
|
||||
|
||||
-static kvm_t *kvm;
|
||||
-
|
||||
-static struct nlist nl[] = {
|
||||
- { "_ifnet" },
|
||||
- { "_cp_time" },
|
||||
- { "" }
|
||||
-};
|
||||
-
|
||||
void
|
||||
xloadavg(int first)
|
||||
{
|
||||
@@ -76,78 +64,37 @@ xapm(int first)
|
||||
Bprint(&bout, "battery =%d 100\n", ai.battery_life);
|
||||
}
|
||||
|
||||
-
|
||||
void
|
||||
-kvminit(void)
|
||||
-{
|
||||
- char buf[_POSIX2_LINE_MAX];
|
||||
-
|
||||
- if(kvm)
|
||||
- return;
|
||||
- kvm = kvm_openfiles(nil, nil, nil, O_RDONLY, buf);
|
||||
- if(kvm == nil) {
|
||||
- fprint(2, "kvm open error\n%s", buf);
|
||||
- return;
|
||||
- }
|
||||
- if(kvm_nlist(kvm, nl) < 0 || nl[0].n_type == 0){
|
||||
- kvm = nil;
|
||||
- return;
|
||||
- }
|
||||
-}
|
||||
-
|
||||
-void
|
||||
-xkvm(int first)
|
||||
-{
|
||||
- if(first)
|
||||
- kvminit();
|
||||
-}
|
||||
-
|
||||
-int
|
||||
-kread(ulong addr, char *buf, int size)
|
||||
-{
|
||||
- if(kvm_read(kvm, addr, buf, size) != size){
|
||||
- memset(buf, 0, size);
|
||||
- return -1;
|
||||
- }
|
||||
- return size;
|
||||
-}
|
||||
-
|
||||
-void
|
||||
xnet(int first)
|
||||
{
|
||||
ulong out, in, outb, inb, err;
|
||||
- static ulong ifnetaddr;
|
||||
- ulong addr;
|
||||
- struct ifnet ifnet;
|
||||
- struct ifnet_head ifnethead;
|
||||
- char name[16];
|
||||
+ struct ifaddrs *ifa, *ifap;
|
||||
+ struct if_data *ifd = NULL;
|
||||
|
||||
- if(first)
|
||||
+ if (first)
|
||||
return;
|
||||
|
||||
- if(ifnetaddr == 0){
|
||||
- ifnetaddr = nl[0].n_value;
|
||||
- if(ifnetaddr == 0)
|
||||
- return;
|
||||
- }
|
||||
+ out = in = outb = inb = err = 0;
|
||||
|
||||
- if(kread(ifnetaddr, (char*)&ifnethead, sizeof ifnethead) < 0)
|
||||
+ if (getifaddrs(&ifap) == -1)
|
||||
return;
|
||||
|
||||
- out = in = outb = inb = err = 0;
|
||||
- addr = (ulong)TAILQ_FIRST(&ifnethead);
|
||||
- while(addr){
|
||||
- if(kread(addr, (char*)&ifnet, sizeof ifnet) < 0
|
||||
- || kread((ulong)ifnet.if_xname, name, 16) < 0)
|
||||
- return;
|
||||
- name[15] = 0;
|
||||
- addr = (ulong)TAILQ_NEXT(&ifnet, if_list);
|
||||
- out += ifnet.if_opackets;
|
||||
- in += ifnet.if_ipackets;
|
||||
- outb += ifnet.if_obytes;
|
||||
- inb += ifnet.if_ibytes;
|
||||
- err += ifnet.if_oerrors+ifnet.if_ierrors;
|
||||
+ for (ifa = ifap; ifa != NULL; ifa = ifa->ifa_next) {
|
||||
+ if (ifa->ifa_addr == NULL ||
|
||||
+ ifa->ifa_addr->sa_family != AF_LINK)
|
||||
+ continue;
|
||||
+
|
||||
+ ifd = ifa->ifa_data;
|
||||
+
|
||||
+ if (ifd != NULL) {
|
||||
+ out += ifd->ifi_opackets;
|
||||
+ in += ifd->ifi_ipackets;
|
||||
+ outb += ifd->ifi_obytes;
|
||||
+ inb += ifd->ifi_ibytes;
|
||||
+ err += ifd->ifi_ierrors;
|
||||
+ }
|
||||
}
|
||||
+
|
||||
Bprint(&bout, "etherin %lud 1000\n", in);
|
||||
Bprint(&bout, "etherout %lud 1000\n", out);
|
||||
Bprint(&bout, "etherinb %lud 1000000\n", inb);
|
||||
@@ -155,6 +102,8 @@ xnet(int first)
|
||||
Bprint(&bout, "ethererr %lud 1000\n", err);
|
||||
Bprint(&bout, "ether %lud 1000\n", in+out);
|
||||
Bprint(&bout, "etherb %lud 1000000\n", inb+outb);
|
||||
+
|
||||
+ freeifaddrs(ifap);
|
||||
}
|
||||
|
||||
void
|
@ -1,17 +0,0 @@
|
||||
$OpenBSD: patch-src_cmd_auxstats_mkfile,v 1.2 2015/12/08 13:41:01 gsoares Exp $
|
||||
|
||||
stop linking with kvm(3). OpenBSD's p9p/auxstats no longer uses libkvm.
|
||||
|
||||
patch already sent upstream
|
||||
https://plan9port-review.googlesource.com/1410
|
||||
|
||||
--- src/cmd/auxstats/mkfile.orig Mon Dec 7 07:50:40 2015
|
||||
+++ src/cmd/auxstats/mkfile Mon Dec 7 07:50:58 2015
|
||||
@@ -12,6 +12,6 @@ HFILES=\
|
||||
|
||||
<$PLAN9/src/mkone
|
||||
|
||||
-KVM=`{if uname |egrep 'BSD' >/dev/null; then echo -lkvm; fi}
|
||||
+KVM=`{if uname |egrep 'BSD' | egrep -v 'OpenBSD' >/dev/null; then echo -lkvm; fi}
|
||||
LDFLAGS=$LDFLAGS $KVM
|
||||
|
Loading…
Reference in New Issue
Block a user