blog.tjd.phlegethon.org
SETJMP: C is not your friend: pthread timeouts
http://blog.tjd.phlegethon.org/post/80695261542/c-is-not-your-friend-pthread-timeouts
Systems programming in C, kernel and *NIX. C is not your friend: pthread timeouts. So you have a multithreaded program, and you need to wait for something to happen: a server to respond, a resource to become available, that sort of thing. But you don’t want to wait forever – if the server hasn’t responded in a few seconds we’d like to try another one, or report an error. The POSIX threads API for this is. The third argument to. Timeout, with no option for a relative timeout (cf. Which reports the amount ...
blog.tjd.phlegethon.org
SETJMP: FreeBSD on the LinkStation Live, part 2:...
http://blog.tjd.phlegethon.org/post/63744933843/freebsd-on-the-linkstation-live-part-2
Systems programming in C, kernel and *NIX. FreeBSD on the LinkStation Live, part 2: installing FreeBSD. I got as far as a U-Boot prompt on the LinkStation Live, ready to TFTP-boot FreeBSD. Cross-building FreeBSD is absolutely delightful, if you’re used to Linux:. Export MAKEOBJDIRPREFIX="${HOME}/FreeBSD/obj" export DESTDIR="${HOME}/FreeBSD/dest" export TARGET=arm export KERNCONF=HS-DHGL make -j4 buildworld buildkernel (as root) make installworld distrib-dirs distribution. Now it boots nicely over NFS:.
blog.tjd.phlegethon.org
SETJMP
http://blog.tjd.phlegethon.org/tagged/glibc
Systems programming in C, kernel and *NIX. C is not your friend: mixed optimization levels. Today, a cautionary tale about clever compiler tricks. I was debugging a tricky test case and wanted to be sure the compiler wouldn’t optimize away any of the important state, so I disabled optimizations in the part of the code I was interested in. Simplified, it looked like this:. That worked fine, until I moved the code over to a bigger machine for more serious testing. There, the compile failed with. And uses t...
blog.tjd.phlegethon.org
SETJMP: FreeBSD on the LinkStation Live, part 1: the...
http://blog.tjd.phlegethon.org/post/62915685295/freebsd-on-the-linkstation-live-part-1-the
Systems programming in C, kernel and *NIX. FreeBSD on the LinkStation Live, part 1: the hardware. I need a small server to hold backups and do one or two other odd jobs on my home network, so I bought a cheap (£40) NAS box from ebay, to see if I could get FreeBSD running on it. I chose a Buffalo LinkStation Pro, which uses the Marvell 88F5182 “Orion” SoC (based on ARM’s ARM926EJ-S. Core, and pretty widely supported), with U-Boot-based firmware. And soldered a cheapo Nokia data cable on to the board as a ...
blog.tjd.phlegethon.org
SETJMP
http://blog.tjd.phlegethon.org/tagged/LinkStation
Systems programming in C, kernel and *NIX. FreeBSD on the LinkStation Live, part 2: installing FreeBSD. I got as far as a U-Boot prompt on the LinkStation Live, ready to TFTP-boot FreeBSD. Cross-building FreeBSD is absolutely delightful, if you’re used to Linux:. Export MAKEOBJDIRPREFIX="${HOME}/FreeBSD/obj" export DESTDIR="${HOME}/FreeBSD/dest" export TARGET=arm export KERNCONF=HS-DHGL make -j4 buildworld buildkernel (as root) make installworld distrib-dirs distribution. Now it boots nicely over NFS:.
blog.tjd.phlegethon.org
SETJMP: crctool
http://blog.tjd.phlegethon.org/post/65255215917/crctool
Systems programming in C, kernel and *NIX. The code is here (git). Or you can download a tarball.
blog.tjd.phlegethon.org
SETJMP
http://blog.tjd.phlegethon.org/tagged/time
Systems programming in C, kernel and *NIX. C is not your friend: pthread timeouts. So you have a multithreaded program, and you need to wait for something to happen: a server to respond, a resource to become available, that sort of thing. But you don’t want to wait forever – if the server hasn’t responded in a few seconds we’d like to try another one, or report an error. The POSIX threads API for this is. The third argument to. Timeout, with no option for a relative timeout (cf. Which reports the amount ...
blog.tjd.phlegethon.org
SETJMP
http://blog.tjd.phlegethon.org/tagged/pthreads
Systems programming in C, kernel and *NIX. C is not your friend: pthread timeouts. So you have a multithreaded program, and you need to wait for something to happen: a server to respond, a resource to become available, that sort of thing. But you don’t want to wait forever – if the server hasn’t responded in a few seconds we’d like to try another one, or report an error. The POSIX threads API for this is. The third argument to. Timeout, with no option for a relative timeout (cf. Which reports the amount ...
blog.tjd.phlegethon.org
SETJMP
http://blog.tjd.phlegethon.org/tagged/Soldering
Systems programming in C, kernel and *NIX. FreeBSD on the LinkStation Live, part 1: the hardware. I need a small server to hold backups and do one or two other odd jobs on my home network, so I bought a cheap (£40) NAS box from ebay, to see if I could get FreeBSD running on it. I chose a Buffalo LinkStation Pro, which uses the Marvell 88F5182 “Orion” SoC (based on ARM’s ARM926EJ-S. Core, and pretty widely supported), with U-Boot-based firmware. And soldered a cheapo Nokia data cable on to the board as a ...
blog.tjd.phlegethon.org
SETJMP: Technical interviews and the Towers of Hanoi
http://blog.tjd.phlegethon.org/post/107154349862/technical-interviews-and-the-towers-of-hanoi
Systems programming in C, kernel and *NIX. Technical interviews and the Towers of Hanoi. I’ve been interviewing job candidates lately, so I’ve been thinking about interview questions. I always ask people to write code in a technical interview, and I usually start with a fairly easy warm-up question — some sort of a toy problem like an operation on lists or trees, often the kind of thing that has a neat recursive solution. 1 2 2 (N-1) = (2 N) - 1. Total moves. The iterative algorithm looks like this:.