Index: head/devel/plan9port/Makefile =================================================================== --- head/devel/plan9port/Makefile (revision 369854) +++ head/devel/plan9port/Makefile (revision 369855) @@ -1,83 +1,83 @@ # Created by: Serge Gagnon # $FreeBSD$ PORTNAME= plan9port PORTVERSION= 20140306 -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= devel plan9 MASTER_SITES= http://swtch.com/${PORTNAME}/ MAINTAINER= ports@FreeBSD.org COMMENT= Port of many Plan 9 programs to Unix-like operating systems LICENSE= LUCENT LICENSE_NAME= Lucent Public License Version 1.02 LICENSE_FILE= ${WRKSRC}/LICENSE LICENSE_PERMS= dist-mirror dist-sell pkg-mirror pkg-sell auto-accept USES= perl5 tar:tgz USE_PERL5= build USE_XORG= x11 xt xi xaw WRKSRC= ${WRKDIR}/plan9 PLIST= ${WRKDIR}/.PLIST SUB_FILES= pkg-message REINPLACE_ARGS= -i "" # necessary since installs via recursive copy PLAN9= ${PREFIX}/plan9 EMPTY_DIRS= plan9/log \ plan9/bin/lpbin \ plan9/dist/troff \ plan9/mail/queue \ plan9/dist/debian \ plan9/dist/pkg post-patch: @${FIND} ${WRKSRC}/man -type f -regex ".*\.[0-9?]$\" \ | ${XARGS} ${REINPLACE_CMD} -e 's|\\\*9|${PLAN9}|' @${REINPLACE_CMD} -e 's|X11=/usr/X11R6|X11=${LOCALBASE}|' \ ${WRKSRC}/bin/9l ${WRKSRC}/src/cmd/devdraw/mkwsysrules.sh @${REINPLACE_CMD} -e 's|\[5-9\]\.||' ${WRKSRC}/bin/9l @${REINPLACE_CMD} -e 's|/lib/font/bit|${PLAN9}/font|' \ ${WRKSRC}/src/cmd/acme/acme.c @${SED} -e 's|util\.h|lib&|' ${WRKSRC}/src/cmd/9term/OpenBSD.c \ > ${WRKSRC}/src/cmd/9term/${OPSYS}.c @${REINPLACE_CMD} -e 's|, swizz(void)|&, swizz8(void)|' \ ${WRKSRC}/src/cmd/xd.c @${REINPLACE_CMD} -e '/^cd $$PLAN9/d' ${WRKSRC}/lib/moveplan9.sh do-build: cd ${WRKSRC} && CC9="${CC}" ./INSTALL # Dynamic PLIST sucks, but it's over 8K lines, which sucks even more :( post-build: ${RM} -rf `${FIND} ${WRKSRC}/dist -type f ! -regex ".*\.png"` ${RM} -rf `${FIND} ${WRKSRC} -name .hg -o -name .cvsignore` ( cd ${WRKDIR} ; \ ${FIND} plan9 -type f; for D in ${EMPTY_DIRS}; do \ ${ECHO_CMD} "@exec ${MKDIR} ${PREFIX}/$${D}"; \ done; \ ${FIND} plan9 -type d | ${SORT} -r | ${SED} -e 's|^|@dirrm |'; \ ) | ${PERL} -pe '$$_ =~ s,plan9/bin/auxstats,\@group kmem\n\@mode\ 2755\n$$&\n\@group\n\@mode,' > ${PLIST} do-install: ${CP} -a ${WRKSRC} ${STAGEDIR}${PREFIX} post-install: cd ${STAGEDIR}${PLAN9} && ${SETENV} PLAN9=${PLAN9} \ PATH=${PATH}:${STAGEDIR}${PLAN9}/bin \ ${SH} lib/moveplan9.sh ${WRKSRC} ${CHMOD} 01777 ${STAGEDIR}${PLAN9}/news install-user: @${MKDIR} ${HOME}/lib ${INSTALL_DATA} ${PLAN9}/plumb/initial.plumbing ${HOME}/lib/plumbing .include .if ${ARCH} == "ia64" || ${ARCH} == "sparc64" BROKEN= Does not install: cleanname not found .endif .include Index: head/devel/plan9port/files/patch-src-cmd-auxstats-FreeBSD.c =================================================================== --- head/devel/plan9port/files/patch-src-cmd-auxstats-FreeBSD.c (revision 369854) +++ head/devel/plan9port/files/patch-src-cmd-auxstats-FreeBSD.c (revision 369855) @@ -1,89 +1,91 @@ --- src/cmd/auxstats/FreeBSD.c.orig 2010-03-18 01:25:34.000000000 +0300 -+++ src/cmd/auxstats/FreeBSD.c 2014-10-02 22:55:32.000000000 +0400 ++++ src/cmd/auxstats/FreeBSD.c 2014-10-02 23:43:36.000000000 +0400 @@ -8,20 +8,15 @@ #include #include #include -#include #include #include -#if __FreeBSD_version < 600000 -#include -#endif #include #include #include #include +#include #include "dat.h" -/* XXX: #if __FreeBSD_version */ - void xapm(int); void xloadavg(int); void xcpu(int); @@ -45,7 +40,6 @@ static kvm_t *kvm; static struct nlist nl[] = { - { "_ifnet" }, { "_cp_time" }, { "" } }; -@@ -86,44 +80,26 @@ +@@ -86,45 +80,28 @@ void xnet(int first) { + struct ifaddrs *ifap, *ifa; ulong out, in, outb, inb, err; - static ulong ifnetaddr; - ulong addr; - struct ifnet ifnet; - struct ifnethead ifnethead; - char name[16]; if(first) return; - if(ifnetaddr == 0){ - ifnetaddr = nl[0].n_value; - if(ifnetaddr == 0) - return; - } - - if(kread(ifnetaddr, (char*)&ifnethead, sizeof ifnethead) < 0) + if (getifaddrs(&ifap) != 0) return; out = in = outb = inb = err = 0; - addr = (ulong)TAILQ_FIRST(&ifnethead); - while(addr){ -#if __FreeBSD_version < 500000 - if(kread(addr, (char*)&ifnet, sizeof ifnet) < 0 - || kread((ulong)ifnet.if_name, name, 16) < 0) - return; -#else - if(kread(addr, (char*)&ifnet, sizeof ifnet) < 0 - || kread((ulong)ifnet.if_dname, name, 16) < 0) - return; -#endif - name[15] = 0; - addr = (ulong)TAILQ_NEXT(&ifnet, if_link); - out += ifnet.if_opackets; - in += ifnet.if_ipackets; - outb += ifnet.if_obytes; - inb += ifnet.if_ibytes; - err += ifnet.if_oerrors+ifnet.if_ierrors; + +#define IFA_STAT(s) (((struct if_data *)ifa->ifa_data)->ifi_ ## s) + for (ifa = ifap; ifa; ifa = ifa->ifa_next) { + if (ifa->ifa_addr->sa_family != AF_LINK) + continue; + out += IFA_STAT(opackets); + in += IFA_STAT(ipackets); + outb += IFA_STAT(obytes); + inb += IFA_STAT(ibytes); + err += IFA_STAT(oerrors) + IFA_STAT(ierrors); } ++ freeifaddrs(ifap); Bprint(&bout, "etherin %lud 1000\n", in); Bprint(&bout, "etherout %lud 1000\n", out); + Bprint(&bout, "etherinb %lud 1000000\n", inb);