Another exotic system

[Updated May 7 2012] (by hxtools sysinfo) [silver] Linux 3.1.0-4-ppc64 ppc64 | 2-thr PPC970FX 2300MHz | Load: 0.00 Tasks: 65 | Mem: 188/1975MB | Disk: 4/146GB | Gfx: Advanced Micro Devices [AMD] nee ATI Rage 128 RE/SG. Apple XServe G5 PPC boot log, lspci and /proc/cpuinfo.

Turns out this PPC architecture is not alignment sensitive. Too bad. More love for SPARC ensues.

Helpful links. Apple XServe G5 PPC: Enter PROM using front-panel key, Eject CD from PROM — since there is no manual eject button on oh so many server slot-loading CD drives.

Disable autoboot (= always enter OpenFirmware): setenv auto-boot? false at the OF ok> prompt.

Posted 2011-10-10 12:10 / Tags: Apple, Hardware, Linux, Powerpc. / link


Film. Spotted the ((re)al)pine mail client, with its typical top bar, menu structure (7 items, 1 highlighted by cursor), and 2-rows bottom key bar, in use in The Big Bang Theory episode 4x09. Chances are this is classic PINE 4.x, since the top line for (re)alpine is necessarily filled with more chars. Posted 2011-09-24 15:09 / link


Error condition propagation in the Linux kernel source

At the request of Philip Fry on a comment posted by me on David Zeuthen's blog post “Writing a C library, part 3”, I am posting a short overview of error conveyance in the Linux kernel (source).

David Zeuthen wrote in his blog post about the integer variable errno: “For simple libraries just using libc's errno is often [the] simplest approach to handling run-time errors (since it's thread-safe and every C programmer knows it)”.

A global variable — is it simple? Yes, I could agree on that. Thread-safe? Yes, contemporary implementations of C-derived environments that support threads, in other words, POSIX, have redefined errno such that it has a per-thread-specific location. It may look something like:

extern int *errno_location(void);
#define errno (*errno_location())

Whereby errno_location is a function with deeper magic that just eventually returns a pointer to a thread-unique location. The indirection via the pointer is necessary because errno is supposed to be an lvalue that can be assigned to. Due to the new macro, I am reluctant to still call it a “variable” in this context, since it is not a named variable anymore, but a dereference of a function's return value.

Anyhow, it does retain errno's properties: it is, in essence, still a “global variable”, or to be more exact, an object with static storage duration with added global scope/visibility. The pro and contra for such objects I need not repeat here.

So my replying comment to David's posting was: “It may be safe from other threads due to TLS [thread-local storage], but it is still a object with global scope, which results in having to longwindingly save and restore errno across calls to other opaque library functions. The Linux kernel in contrast shows how to do without such a global.”. An example to the necessary save-and-restore cycle is this piece of common housekeeping done just before forking:

bool all_or_nothing(int *p)
{
        unsigned int i;

        for (i = 0; i < PIPE_PAIRS * 2; ++i)
                p[i] = -1;
        if (build_pipes(p) != 0) {
                saved_errno = errno;
                kill_pipes(p); /* calls close() */
                errno = saved_errno;
                return false;
        }
        return true;
}

The handling in the error path is somewhat cumbersome, because close can set errno. This prompted me to present the case of how the Linux kernel internally conveys error conditions. One code example:

int all_or_nothing(int *p)
{
        unsigned int i;
        int ret;

        for (i = 0; i < PIPE_PAIRS * 2; ++i)
                p[i] = -1;
        ret = build_pipes(p);
        if (ret < 0)
                kill_pipes(p);
        return ret;
}

Error conveyance in the Linux kernel generally follows this abstract ruleset:

Posted 2011-07-06 07:07 / Tags: Kernel, Linux. / link


Software Development. Wrong colors (in syntax highlighting) are as good as no colors. Posted 2011-03-17 07:03 / link


Empirical Experiments. Have someone who is pessimistic about the topic of your questionnaire look over it to suggest missing possible answers. Especially, there might be missing “Never” options. Posted 2011-03-05 00:03 / link


Fun, Microsoft. So Microsoft started their IE6 countdown. Except that the graphic is so nicely generic that, you guessed it, there is no way of telling what is behind the link:

Posted 2011-03-05 11:03 / link


Games, Minecraft. Minecraft [in Singleplayer] quickly loses its appeal (after say, 20 hours) because there is no set game goal. Posted 2011-03-05 00:03 / link


Memorable Quotes, Science. Gardening meets CS. “Proof that a binary search tree with n>=2 leaves can be arranged to have height ceil(log n): Logs are made from trees. Since a log can obviously never be higher than the tree it comes from, the maximum height of any particular log, ceil(log n), will always be less than the height of the tree. QED.” Posted 2011-03-01 15:03 / link


Film, Memorable Quotes. JAG episode 2x01: Harm: “Don't judge an apartment by its elevator.” Mac: “Looks more like a storage facility to me.” Posted 2011-03-01 15:03 / link


Film, Memorable Quotes. A-Team episode 3x17: Murdock: “You can fool some of the poeple all the time, and all the people some of the time.” Posted 2011-03-01 15:03 / link