Comments (7)
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.
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.
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.
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.
Mark.
from plan9port.
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.
Builds on FreeBSD are working, and with clang. Closing.
from plan9port.
Related Issues (20)
- more threadmaybackground needed
- ACME: per-window environment variables HOT 2
- Unable to install on debian HOT 6
- devdraw: Cursor reverts to macOS default on MacBook with notch
- Cant use 9l -- ld cannot find -l9 HOT 4
- libbio brdline error handling
- sam: regexp match issue
- acme -a, on MacOS, is unresponsive after changing window size
- can't pass both -b/-c and -r to INSTALL
- can not build under gcc-less linux HOT 4
- 9pfuse not working on Mac OS Sonoma
- Belorussian link does not work HOT 2
- No pointer warping in acme in virtual Fedora 39
- Issue triage
- 9pserve: msize not optimal
- Build fails with LTO HOT 3
- kcmp in cmd/sort.c conflicts with FreeBSD system header file HOT 1
- Acme cannot navigate directories or open files within itself. HOT 1
- idea: port pool(2) HOT 2
- RFC Update 9fans.github.io to Use Git Submodules
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from plan9port.