Recurse Center lab notes 2015-06-16
Today I continued working on my lsaddr
utility for listing IP addresses.
Here’s a quick update:
- there is now a repository on GitHub
-
I have a man page that I’m mostly pleased with; here’s the synopsis:
lsaddr [ -46 ] [--include-loopback] [--include-ipv6-link-local] [ interface ... ]
- I am checking that the supplied interfaces exist and reporting errors with
error
, which I discovered was the done thing by usingltrace
onls does-not-exist
:-) - I tried to use
lfind
to determine if interfaces were listed as arguments, but wow what a mess that was1; I scrapped that to come back to it another day
In other news, I read this exciting post by Brendan Gregg on eBPF and tracing in the kernel. Apparently it will soon be possible to gather latency data from inside the kernel. I haven’t figured out if this could be interesting for IPC benchmarks.
-
the closest C comes to having generics / parametric polymorphism is
void *
. With things likemalloc
, this is mostly fine. With algorithms likelfind
and friends… well you’re going to have a bad time. Just look a this signature:void *lfind(const void *key, const void *base, size_t *nmemb, size_t size, int(*compar)(const void *, const void *))
I find
std::find
unfriendly, but this is a whole other level. ↩