Home / 2009 / January

gethostbyname_r()

Okay, so I can’t really go into too much of the big picture since this is from the day job, but I can certainly tear into gethostbyname_r() a bit.

For part of what we’re doing, we’re sending a RADIUS message using the freeradius project’s radius client library. So, nice and simple (after you’ve done some setup):
[cc escaped=”true” lang=”c”]result = rc_acct(rh, 0, send);[/cc]
Easy enough, right? So it fails. Specifically, it segfaults and since it’s in a multithreaded server, it’s a pain to track down. And I mean a pain. Hours of fun with DDD, gdb, nana and finally printf() lead to here:
[cc escaped=”true” lang=”c”]res = gethostbyname_r(hostname, &hostbuf, tmphostbuf, hostbuflen, &hp, &herr)[/cc]
Ah. gethostbyname_r(), the glibc2-reentrant thread-safe version of gethostbyname(). Except that it’s deprecated, and has the unique property of working differently on just about every machine out there.… Read the rest

Read More

Nokia E71

At the moment, I use a Sony Ericcson k750i as my phone. It’s solid, has good reception and audio and battery life. It has an easy-to-use camera with a flash which is important for me because that’s how I record and store whiteboard sessions. It has bluetooth for file transfer (of the whiteboard photos) and hands-free headsets (it’s illegal in Ireland to drive while using a mobile phone, so the headset – and the voice recognition dialing – are quite useful). It has an FM radio and an MP3 player for when I’m on the train. I’ve got Opera Mini installed on it so I can even check my email and websites, though writing anything with T9 is something a sane person only takes on in extremis. It’s even red 😀 It’s been a very good phone for me and I have almost no complaints about it.… Read the rest

Read More