Tag Archives: C

An ugly diff

Recently, I came across a breakage in editors/emacs-devel port (FreeBSD, ofcourse) on SPARC64 architecture caused by having a struct frame defined in both FreeBSD header machine/frame.h (on Sparc) and Emacs header src/frame.h. To fix it, I renamed frame before it gets defined by FreeBSD header files:

++#ifdef __sparc__ 
++#define frame freebsd_sparc_frame
++#endif
 +#include <sys/user.h>
-+#include <sys/resource.h>
++#ifdef __sparc__ 
++#undef frame
++#endif

So ugly, wish we had namespaces in C 🙁

P.S. Thanks to tabthorpe (mentor) for his Sparc64 tinderbox 🙂

Writing Portable Network Code

Originally, this was intended to be a two part series about get(addr|name)info() functions which I learnt thanks to GĂŠ Weijers‘ review of my patches to bring IPv6 support to Fossil I submitted months ago. After spending sometime on draft of this post, I decided two part series is way too much for this, and it could just be fit in a single article. And now today, I decided I could just mention the name of functions getaddrinfo(), getnameinfo(), and a link to the thread, and let curious reader figure out what this is about. 🙁