Giter Site home page Giter Site logo

Comments (7)

jxy avatar jxy commented on July 22, 2024 1

Tried to compile plan9port on FreeBSD 11.0-BETA2. Changing to clang is trivial (with multiple warnings…), and modifying the 9c script takes care of the -pthread. The difficulty comes with the counters in ifnet.

FreeBSD.c:122:16: error: no member named 'if_opackets' in 'struct ifnet'
FreeBSD.c:123:15: error: no member named 'if_ipackets' in 'struct ifnet'
FreeBSD.c:124:17: error: no member named 'if_obytes' in 'struct ifnet'
FreeBSD.c:125:16: error: no member named 'if_ibytes' in 'struct ifnet'
FreeBSD.c:126:16: error: no member named 'if_oerrors' in 'struct ifnet'
FreeBSD.c:126:33: error: no member named 'if_ierrors' in 'struct ifnet'

Consulting the manuals, I came to the following fix that made it compile.

diff --git a/src/cmd/auxstats/FreeBSD.c b/src/cmd/auxstats/FreeBSD.c
index a6b7a8d..7cceee3 100644
--- a/src/cmd/auxstats/FreeBSD.c
+++ b/src/cmd/auxstats/FreeBSD.c
@@ -119,11 +119,12 @@ xnet(int first)
 #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;
+               out += *(ifnet.if_counters[IFCOUNTER_OPACKETS]);
+               in += *(ifnet.if_counters[IFCOUNTER_IPACKETS]);
+               outb += *(ifnet.if_counters[IFCOUNTER_OBYTES]);
+               inb += *(ifnet.if_counters[IFCOUNTER_IBYTES]);
+               err += *(ifnet.if_counters[IFCOUNTER_OERRORS]) +
+                       *(ifnet.if_counters[IFCOUNTER_IERRORS]);
        }
        Bprint(&bout, "etherin %lud 1000\n", in);
        Bprint(&bout, "etherout %lud 1000\n", out);
@@ -202,7 +203,7 @@ rsys(char *name, char *buf, int len)
 vlong
 isys(char *name)
 {
-       ulong u;
+       uint32_t u;
        size_t l;

        l = sizeof u;

However the manual suggests to use counter_u64_fetch(9), but I'm not sure how to make this kernel function to work for us, as I've never touched section 9 before. I'd love some pointers here.

By the way, the change in rsys correct the size of the sysctlbyname(3) call.

from plan9port.

paulzhol avatar paulzhol commented on July 22, 2024

if you replace gcc with $CC9 in https://github.com/9fans/plan9port/blob/master/INSTALL#L131,
and run CC9=cc ./INSTALL it should work.

from plan9port.

0intro avatar 0intro commented on July 22, 2024

Is GCC the requirement? I will investigate more, but didn't know if
anyone was aware if clang didn't support the GCC features plan9port
requires (if any)

Plan9port supports clang as well.

David du Colombier

from plan9port.

anths avatar anths commented on July 22, 2024

I built on FreeBSD 10 a few weeks ago. The changes were small, but I was in a hurry and did a bad job of keeping notes. In addition to convincing it to use clang, I believe I had to make this change in INSTALL:

  •   echo "LDFLAGS='-L/usr/local/lib'" >> $PLAN9/config
    
  •   echo "LDFLAGS='-L/usr/local/lib -pthread'" >> $PLAN9/config
    

This is my first FreeBSD in a few years, so I haven’t had a chance to figure out what the right way to do that in a backwards-compatible fashion is yet.

from plan9port.

markvanatten avatar markvanatten commented on July 22, 2024

https://groups.google.com/forum/#!searchin/plan9port-dev/freebsd/plan9port-dev/bjd3SFMuT9U/X4PWu42UUWIJ

Mark.

from plan9port.

francisconti avatar francisconti commented on July 22, 2024

There is a separate bug (#83) for the auxstats issue (which has since been fixed). I have just submitted a pull request to address the INSTALL issue.

from plan9port.

dancrossnyc avatar dancrossnyc commented on July 22, 2024

Builds on FreeBSD are working, and with clang. Closing.

from plan9port.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.