<?xml version="1.0" encoding="iso-8859-15" ?>
<rss version="2.0" 
   xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" 
   xmlns:html="http://www.w3.org/1999/html" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/">
<channel>
   <title>TBFKAYIBYNYAAYB</title>
   <link>http://0pointer.de/blog</link>
   <description>Lennart's Blog</description>
   <language>en</language>
   <copyright></copyright>
   <ttl>60</ttl>
   <pubDate>Mon, 23 Aug 2010 11:32 GMT</pubDate>
   <managingEditor>lennart (at) poettering (dot) de</managingEditor>
   <generator>PyBlosxom http://pyblosxom.sourceforge.net/ 1.4.3 01/10/2008</generator>
<item>
   <title>systemd Status Update</title>
   <guid isPermaLink="false">projects/systemd-update</guid>
   <link>http://0pointer.de/blog/projects/systemd-update.html</link>
   <description><![CDATA[

<p>It has been a while <a
href="http://0pointer.de/blog/projects/systemd.html">since my original
announcement of systemd</a>. Here's a little status update, on what
happened since then. For simplicity's sake I'll just list here what we
worked on in a bulleted list, with no particular order and without
trying to cover this comprehensively:</p>

<ul>

<li>systemd has been accepted as Feature for Fedora 14, and as it
looks right now everything worked out nicely and we'll ship F14 with
systemd as init system.</li>

<li>We added a number of additional unit types: <tt>.timer</tt> for
cron-style timer-based activation of services, <tt>.swap</tt> exposes
swap files and partitions the same way we handle mount points, and
<tt>.path</tt> can be used to activate units dependending on the
existance/creation of files or fill status of spool directories.</li>

<li>We hooked systemd up to SELinux: systemd is now capabale of
properly labelling directories, sockets and FIFOs it creates according
to the SELinux policy for the services we maintain.</li>

<li>We hooked systemd up to the Linux auditing subsystem: as first
init system at all systemd now generates auditing records for all
services it starts/stops, including their failure status.</li>

<li>We hooked systemd up to TCP wrappers, for all socket connections
it accepts.</li>

<li>We hooked systemd up to PAM, so that optionally, when systemd runs
a service as a different user it initializes the usual PAM session
setup and teardown hooks.</li>

<li>We hooked systemd up to D-Bus, so that D-Bus passes activation
requests to systemd and systemd becomes the central point for all
kinds of activation, thus greatly extending the control of the
execution environment of bus activated services, and making them
accessible through the same utilities as SysV services. Also, this
enables us to do race-free parallelized start-up for D-Bus services
and their clients, thus speeding up things even further.</li>

<li>systemd is now able to handle various Debian and OpenSUSE-specific
extensions to the classic SysV init script formats natively, on top of
the Fedora extensions we already parse.</li>

<li>The D-Bus coverage of the systemd interface is now complete,
allowing both introspection of runtime data and of parsed
configuration data. It's fun now to introspect systemd with <a
href="http://davidz25.blogspot.com/2010/08/gdbus1-bash-completion.html"><tt>gdbus</tt></a>
or <tt>d-feet</tt>.</li>

<li>We added a <a
href="http://0pointer.de/public/systemd-man/pam_systemd.html">systemd
PAM module</a>, which assigns the processes of each user session to
its own cgroup in the systemd cgroup tree. This also enables reliable
killing of all processes associated with a session when the user logs
out. This also manages a secure per-user <tt>/var/run</tt>-style directory
which is supposed to be used for sockets and similar files that shall
be cleaned up when the user logs out.</li>

<li>There's a new tool <a
href="http://0pointer.de/public/systemd-man/systemd-cgls.html"><tt>systemd-cgls</tt></a>,
which plots a pretty process tree based on the systemd cgroup
hierarchy. It's really pretty. Try it!</li>

<li>We now have our own cgroup hierarchy beneath
<tt>/cgroup/systemd</tt> (though is will move to <tt>/sys/fs/</tt>
before the F14 release).</li>

<li>We have pretty code that automatically spawns a getty on a serial
port when the kernel console is redirected to a serial TTY.</li>

<li><tt>systemctl</tt> got beefed up substantially (it can even draw
dependency graphs now, via <tt>dot</tt>!), and the SysV compatiblity
tools were extended to more completely and correctly support what was
historically provided by SysV. For example, we'll now warn the user
when systemd service files have changed but systemd was not asked to
reload its configuration. Also, you can now use systemd's native
client tools to reboot or shut-down an Upstart or sysvinit system, to
facilitate upgrades.</li>

<li>We provide a <a
href="http://cgit.freedesktop.org/systemd/plain/src/sd-daemon.h">reference
implementation</a> for the socket activation and other APIs for nicer
interaction with systemd.</li>

<li>We have a pretty complete <a
href="http://0pointer.de/public/systemd-man/">set of documentation</a>
now, <a href="http://0pointer.de/public/systemd-man/daemon.html">some
of it</a> even extending to areas not directly related to systemd
itself.</li>

<li>Quite a number of upstream packages now ship with systemd service
files out-of-the-box now, that work across all distributions that have
adopted systemd. It is our intention to unify the boot and service
management between distributions with systemd, and this shows fruits
already. Furthermore a number of upstream packages now ship our
patches for socket-based activation.</li>

<li>Even more options that control the process execution environment
or the sockets we create are now supported.</li>

<li>Earlier today I began my series of blog stories on <a
href="http://0pointer.de/blog/projects/systemd-for-admins-1">systemd
for administrators</a>.</li>

<li>We reimplemented almost all boot-up and shutdown scripts of the
standard Fedora install in much smaller, simpler and faster C
utilities, or in systemd itself. Most of this will not be enabled in
F14 however, even though it is shipped with systemd upstream. With
this enabled the entire Linux system gains a completely new feeling as
the number of shells we spawn approaches zero, and the PID of the
first user terminal is way &lt; 500 now, and the early boot-up is
fully parallelized. We looked at the boot scripts of Fedora, OpenSUSE
and Debian and distilled from this a list of functionality that makes
up the early boot process and reimplemented this in C, if possible
following the bahaviour of one of the existing implementations from
these three distributions. This turned out to be much less effort than
anticipated, and we are actually quite excited about this. Look
forward to the fruits of this work in F15, when we might be able to
present you a shell-less boot at least for standard desktop/laptop
systems.</li>

<li>We spent some time reinvestigating the current syslog logic, and
came up with an elegant and simple scheme to provide <tt>/dev/log</tt>
compatible logging right from the time systemd is first initialized
right until the time the kernel halts the machine. Through the wonders
of socket based activation we first connect the <tt>/dev/log</tt>
socket with a minimal bridge to the kernel log buffer (<tt>kmsg</tt>)
and then, as soon as the real syslog is started up as part of the
later bootup phase, we dynamically replace this minimal bridge by the
real syslog daemon -- without losing a single log message. Since one
of the first things the real syslog daemon does is flushing the kernel
log buffer into log files, all logged messages will sooner or later be
stored on disk, regardless whether they have been generated during
early boot, late boot or system runtime. On top of that if the syslog
daemon terminates or is shut down during runtime, the bridge becomes
active again and log output is written to kmsg again. The same applies
when the system goes down. This provides a simple an robust way how we
can ensure that no logs will ever be lost again, and logging is
available from the beginning of boot-up to the end of
shut-down. Plymouth will most likely adopt a similar scheme for initrd
logging, thus ensuring that everything ever logged on the system will
properly end up in the log files, whether it comes from the kernel,
from the initrd, from early-boot, from runtime or shutdown. And if
syslogd is not around, <tt>dmesg</tt> will provide you with access to
the log messages. While this bridge is part of systemd upstream, we'll
most likely enable this bridge in Fedora only starting with F15. Also
note that embedded systems that have no interest in shipping a full
syslogd solution can simply use this syslog bridge during the entire
runtime, and thus making the kernel log buffer the centralized log
storage, with all the advantages this offers: zero disk IO at runtime,
access to serial and netconsole logging, and remote debug access to
the kernel log buffer.</li>

<li>We now install autofs units for many "API" kernel virtual file
systems by default, such as <tt>binfmt_misc</tt> or
<tt>hugetlbfs</tt>. That means that the file system access is readily
available, client code no longer has to manually load the respective
kernel modules, as they are autoloaded on first access of the file
system. This has many advantages: it is not only faster to set up
during boot, but also simpler for applications, as they can just
assume the functionality is available. On top of that permission
problems for the initialization go away, since manual module loading
requires root privileges.</li>

<li>Many smaller fixes and enhancements, all across the board, which
if mentioned here would make this blog story another blog
novel. Suffice to say, we did a lot of polishing to ready systemd for
F14.</li>

</ul>

<p>All in all, systemd is progressing nicely, and the features we have
been working on in the last months are without exception features not
existing in any other of the init systems available on Linux and our
feature set already was far ahead of what the older init
implementations provide. And we have quite a bit planned for the
future. So, stay tuned!</p>

<p>Also note that I'll speak about systemd at <a
href="http://www.linux-kongress.org/2010/program.html">LinuxKongress
2010</a> in Nuremberg, Germany. Later this year I'll also be speaking
at the <a
href="http://www.linuxplumbersconf.org/2010/ocw/proposals/873">Linux
Plumbers Conference</a> in Boston, MA. Make sure to drop by if you
want to learn about systemd or discuss exiciting new ideas or features
with us.</p>

]]></description>
   <category domain="http://0pointer.de/blog">/projects</category>
   <pubDate>Mon, 23 Aug 2010 11:32 GMT</pubDate>
</item>
<item>
   <title>systemd for Administrators, Part 1</title>
   <guid isPermaLink="false">projects/systemd-for-admins-1</guid>
   <link>http://0pointer.de/blog/projects/systemd-for-admins-1.html</link>
   <description><![CDATA[

<p>As many of you know, <a
href="http://www.freedesktop.org/wiki/Software/systemd">systemd</a> is the new
Fedora init system, starting with F14, and it is also on its way to being adopted in
a number of other distributions as well (for example, <a
href="http://en.opensuse.org/SDB:Systemd">OpenSUSE</a>). For administrators
systemd provides a variety of new features and changes and enhances the
administrative process substantially. This blog story is the first part of a
series of articles I plan to post roughly every week for the next months. In
every post I will try to explain one new feature of systemd. Many of these features
are small and simple, so these stories should be interesting to a broader audience.
However, from time to time we'll dive a little bit deeper into the great new
features systemd provides you with.</p>

<h4>Verifying Bootup</h4>

<p>Traditionally, when booting up a Linux system, you see a lot of
little messages passing by on your screen. As we work on speeding up
and parallelizing the boot process these messages are becoming visible
for a shorter and shorter time only and be less and less readable --
if they are shown at all, given we use graphical boot splash
technology like Plymouth these days. Nonetheless the information of
the boot screens was and still is very relevant, because it shows you
for each service that is being started as part of bootup, wether it
managed to start up successfully or failed (with those green or red
<tt>[ OK ]</tt> or <tt>[ FAILED ]</tt> indicators). To improve the
situation for machines that boot up fast and parallelized and to make
this information more nicely available during runtime, we added a
feature to systemd that tracks and remembers for each service whether
it started up successfully, whether it exited with a non-zero exit
code, whether it timed out, or whether it terminated abnormally (by
segfaulting or similar), both during start-up and runtime. By simply
typing <tt>systemctl</tt> in your shell you can query the state of all
services, both systemd native and SysV/LSB services:</p>

<pre>[root@lambda] ~# systemctl
UNIT                                          LOAD   ACTIVE       SUB          JOB             DESCRIPTION
dev-hugepages.automount                       loaded active       running                      Huge Pages File System Automount Point
dev-mqueue.automount                          loaded active       running                      POSIX Message Queue File System Automount Point
proc-sys-fs-binfmt_misc.automount             loaded active       waiting                      Arbitrary Executable File Formats File System Automount Point
sys-kernel-debug.automount                    loaded active       waiting                      Debug File System Automount Point
sys-kernel-security.automount                 loaded active       waiting                      Security File System Automount Point
sys-devices-pc...0000:02:00.0-net-eth0.device loaded active       plugged                      82573L Gigabit Ethernet Controller
<i>[...]</i>
sys-devices-virtual-tty-tty9.device           loaded active       plugged                      /sys/devices/virtual/tty/tty9
-.mount                                       loaded active       mounted                      /
boot.mount                                    loaded active       mounted                      /boot
dev-hugepages.mount                           loaded active       mounted                      Huge Pages File System
dev-mqueue.mount                              loaded active       mounted                      POSIX Message Queue File System
home.mount                                    loaded active       mounted                      /home
proc-sys-fs-binfmt_misc.mount                 loaded active       mounted                      Arbitrary Executable File Formats File System
abrtd.service                                 loaded active       running                      ABRT Automated Bug Reporting Tool
accounts-daemon.service                       loaded active       running                      Accounts Service
acpid.service                                 loaded active       running                      ACPI Event Daemon
atd.service                                   loaded active       running                      Execution Queue Daemon
auditd.service                                loaded active       running                      Security Auditing Service
avahi-daemon.service                          loaded active       running                      Avahi mDNS/DNS-SD Stack
bluetooth.service                             loaded active       running                      Bluetooth Manager
console-kit-daemon.service                    loaded active       running                      Console Manager
cpuspeed.service                              loaded active       exited                       LSB: processor frequency scaling support
crond.service                                 loaded active       running                      Command Scheduler
cups.service                                  loaded active       running                      CUPS Printing Service
dbus.service                                  loaded active       running                      D-Bus System Message Bus
getty@tty2.service                            loaded active       running                      Getty on tty2
getty@tty3.service                            loaded active       running                      Getty on tty3
getty@tty4.service                            loaded active       running                      Getty on tty4
getty@tty5.service                            loaded active       running                      Getty on tty5
getty@tty6.service                            loaded active       running                      Getty on tty6
haldaemon.service                             loaded active       running                      Hardware Manager
hdapsd@sda.service                            loaded active       running                      sda shock protection daemon
irqbalance.service                            loaded active       running                      LSB: start and stop irqbalance daemon
iscsi.service                                 loaded active       exited                       LSB: Starts and stops login and scanning of iSCSI devices.
iscsid.service                                loaded active       exited                       LSB: Starts and stops login iSCSI daemon.
livesys-late.service                          loaded active       exited                       LSB: Late init script for live image.
livesys.service                               loaded active       exited                       LSB: Init script for live image.
lvm2-monitor.service                          loaded active       exited                       LSB: Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progress polling
mdmonitor.service                             loaded active       running                      LSB: Start and stop the MD software RAID monitor
modem-manager.service                         loaded active       running                      Modem Manager
netfs.service                                 loaded active       exited                       LSB: Mount and unmount network filesystems.
NetworkManager.service                        loaded active       running                      Network Manager
ntpd.service                                  loaded <span style="color: red"><b>maintenance  maintenance</b></span>                  Network Time Service
polkitd.service                               loaded active       running                      Policy Manager
prefdm.service                                loaded active       running                      Display Manager
rc-local.service                              loaded active       exited                       /etc/rc.local Compatibility
rpcbind.service                               loaded active       running                      RPC Portmapper Service
rsyslog.service                               loaded active       running                      System Logging Service
rtkit-daemon.service                          loaded active       running                      RealtimeKit Scheduling Policy Service
sendmail.service                              loaded active       running                      LSB: start and stop sendmail
sshd@172.31.0.53:22-172.31.0.4:36368.service  loaded active       running                      SSH Per-Connection Server
sysinit.service                               loaded active       running                      System Initialization
systemd-logger.service                        loaded active       running                      systemd Logging Daemon
udev-post.service                             loaded active       exited                       LSB: Moves the generated persistent udev rules to /etc/udev/rules.d
udisks.service                                loaded active       running                      Disk Manager
upowerd.service                               loaded active       running                      Power Manager
wpa_supplicant.service                        loaded active       running                      Wi-Fi Security Service
avahi-daemon.socket                           loaded active       listening                    Avahi mDNS/DNS-SD Stack Activation Socket
cups.socket                                   loaded active       listening                    CUPS Printing Service Sockets
dbus.socket                                   loaded active       running                      dbus.socket
rpcbind.socket                                loaded active       listening                    RPC Portmapper Socket
sshd.socket                                   loaded active       listening                    sshd.socket
systemd-initctl.socket                        loaded active       listening                    systemd /dev/initctl Compatibility Socket
systemd-logger.socket                         loaded active       running                      systemd Logging Socket
systemd-shutdownd.socket                      loaded active       listening                    systemd Delayed Shutdown Socket
dev-disk-by\x1...x1db22a\x1d870f1adf2732.swap loaded active       active                       /dev/disk/by-uuid/fd626ef7-34a4-4958-b22a-870f1adf2732
basic.target                                  loaded active       active                       Basic System
bluetooth.target                              loaded active       active                       Bluetooth
dbus.target                                   loaded active       active                       D-Bus
getty.target                                  loaded active       active                       Login Prompts
graphical.target                              loaded active       active                       Graphical Interface
local-fs.target                               loaded active       active                       Local File Systems
multi-user.target                             loaded active       active                       Multi-User
network.target                                loaded active       active                       Network
remote-fs.target                              loaded active       active                       Remote File Systems
sockets.target                                loaded active       active                       Sockets
swap.target                                   loaded active       active                       Swap
sysinit.target                                loaded active       active                       System Initialization

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.
JOB    = Pending job for the unit.

221 units listed. Pass --all to see inactive units, too.
[root@lambda] ~#</pre>

<p>(I have shortened the output above a little, and removed a few lines not relevant for this blog post.)</p>

<p>Look at the ACTIVE column, which shows you the high-level state of
a service (or in fact of any kind of unit systemd maintains, which can
be more than just services, but we'll have a look on this in a later
blog posting), whether it is <i>active</i> (i.e. running),
<i>inactive</i> (i.e. not running) or in any other state. If you look
closely you'll see one item in the list that is marked <i>maintenance</i>
and highlighted in red. This informs you about a service that failed
to run or otherwise encountered a problem. In this case this is
ntpd. Now, let's find out what actually
happened to ntpd, with the <tt>systemctl status</tt>
command:</p>

<pre>[root@lambda] ~# systemctl status ntpd.service
ntpd.service - Network Time Service
	  Loaded: loaded (/etc/systemd/system/ntpd.service)
	  Active: <span style="color: red"><b>maintenance</b></span>
	    Main: 953 (code=exited, status=255)
	  CGroup: name=systemd:/systemd-1/ntpd.service
[root@lambda] ~#</pre>

<p>This shows us that NTP terminated during runtime (when it ran as
PID 953), and tells us exactly the error condition: the process exited
with an exit status of 255.</p>

<p>In a later systemd version, we plan to hook this up to ABRT, <a
href="https://bugzilla.redhat.com/show_bug.cgi?id=622773">as soon as
this enhancement request is fixed</a>. Then, if <tt>systemctl
status</tt> shows you information about a service that crashed it will
direct you right-away to the appropriate crash dump in ABRT.</p>

<p><b>Summary:</b> use <tt>systemctl</tt> and <tt>systemctl
status</tt> as modern, more complete replacements for the traditional
boot-up status messages of SysV services. <tt>systemctl status</tt>
not only captures in more detail the error condition but also shows
runtime errors in addition to start-up errors.</p>

<p>That's it for this week, make sure to come back next week, for the
next posting about systemd for administrators!</p>

]]></description>
   <category domain="http://0pointer.de/blog">/projects</category>
   <pubDate>Mon, 23 Aug 2010 08:22 GMT</pubDate>
</item>
<item>
   <title>Dear Lazy Web,</title>
   <guid isPermaLink="false">lenovo-laptop-codes</guid>
   <link>http://0pointer.de/blog/lenovo-laptop-codes.html</link>
   <description><![CDATA[

<p>does anybody know how to decode those Lenovo ThinkPad model IDs? I am
interested in the T410s. For example, there's the model NUK3AGE, and there's
NUHFXGE, and there's NUHYXGE. Some web sites claim NUK3AGE has Nvidia graphics,
others claim VGA is Intel-only. Some web sites claim it has a touch screen,
others say the contrary. The Lenovo web site isn't helpful to figure out the
differences between the models and what the feature set of the various models
really is. I figured out the GE suffix indicates a german keyboard, but what
about the remaining code? Anybody knows how to decypher those IDs or knows a
reliable source explaining their feature set?</p>

<p>Love,</p>

<p>Lennart</p>

]]></description>
   <category domain="http://0pointer.de/blog"></category>
   <pubDate>Thu, 19 Aug 2010 11:27 GMT</pubDate>
</item>
<item>
   <title>Me too!</title>
   <guid isPermaLink="false">projects/bad-lennart</guid>
   <link>http://0pointer.de/blog/projects/bad-lennart.html</link>
   <description><![CDATA[

<p>I too forgot to mention that my accommodation at GUADEC was sponsored by the GNOME Foundation. Thanks guys!</p>

<p><img alt="Sponsored" src="http://1.bp.blogspot.com/_2o81e3u4ZFU/TFfrnz00y6I/AAAAAAAAAW0/h8eVbnSRcc4/s400/sponsored-badge-simple.png" width="213" height="213"/></p>

]]></description>
   <category domain="http://0pointer.de/blog">/projects</category>
   <pubDate>Tue, 03 Aug 2010 11:22 GMT</pubDate>
</item>
<item>
   <title>Beating a Dead Horse</title>
   <guid isPermaLink="false">projects/i-am-more-awesome-than-canonical</guid>
   <link>http://0pointer.de/blog/projects/i-am-more-awesome-than-canonical.html</link>
   <description><![CDATA[

<p>I guess it's a bit beating a dead horse, but I had a good laugh today when
<a href="http://www.neary-consulting.com/index.php/services/gnome-census/">I
learned</a> that I alone contributed more to GNOME than the entirety of
Canonical, and only 800 additional commits seperating me from being more awesome than Nokia.</p>

<p><tt>/me is amused</tt></p>

]]></description>
   <category domain="http://0pointer.de/blog">/projects</category>
   <pubDate>Mon, 02 Aug 2010 23:46 GMT</pubDate>
</item>
<item>
   <title>Interview With Yours Truly</title>
   <guid isPermaLink="false">projects/i-like-listening-to-myself</guid>
   <link>http://0pointer.de/blog/projects/i-like-listening-to-myself.html</link>
   <description><![CDATA[

<p><a href="http://linuxoutlaws.com/podcast/ogg/160">Here's a podcast interview
with yours truly</a> where I speak a little about PulseAudio and systemd. Seek
to 64:43 for my lovely impetuous voice. There's also an interview with Owen
just before mine.</p>

]]></description>
   <category domain="http://0pointer.de/blog">/projects</category>
   <pubDate>Mon, 02 Aug 2010 15:13 GMT</pubDate>
</item>
<item>
   <title>Linux Plumbers Conference 2010 CFP Ending Soon!</title>
   <guid isPermaLink="false">projects/plumbersconf-2010</guid>
   <link>http://0pointer.de/blog/projects/plumbersconf-2010.html</link>
   <description><![CDATA[

<p>The <a
href="http://www.linuxplumbersconf.org/2010/06/03/linux-plumbers-conference-call-for-papers">Call
for Papers</a> for the <a href="http://www.linuxplumbersconf.org/">Linux
Plumbers Conference (LPC)</a> in November in Cambridge, Massachusetts is ending
soon, on <b>July 19th 2010 (That's the upcoming monday!)</b>. It's a conference
about the core infrastructure of Linux systems: the part of the system where
userspace and the kernel interface. It's the only conference where the focus is
specifically on getting together the kernel people who work on the userspace
interfaces and the userspace people who have to deal with kernel interfaces.
It's supposed to be a place where all the people doing infrastructure work sit
down and talk, so that both parties understand better what the requirements and
needs of the other are, and where we can work towards fixing the major problems
we currently have with our lower-level infrastructure and APIs.</p>

<p>The two previous LPCs were hugely successful (as reported on LWN on various
occasions), and this time we hope to repeat that.</p> 

<p>Like the previous years, I will be running the Audio conference track of
LPC, this time together with Mark Brown. Audio infrastructure on Linux has been
steadily improving the last years all over the place, but there's still a lot
to do.  Join us at the LPC to discuss the next steps and help improving Linux
audio further! If you are doing <b>audio infrastructure work</b> on Linux, make
sure to attend and <b>submit a paper!</b></p>

<p><a href="http://www.linuxplumbersconf.org/2010/ocw/login">Sign up soon!</a>
<a
href="http://www.linuxplumbersconf.org/2010/ocw/events/LPC2010/proposals/new">Send
in your paper quickly!</a> <b>Only three days left to the end of the
CFP!</b></p>

<p><a href="http://www.linuxplumbersconf.org"><img style="border: 0" src="http://linuxplumbersconf.org/2010/style/tagline-2010.png" alt="Plumbers Logo" width="493" height="60"/></a></p>

<p>(I am also planning to do a presentation there about <a
href="http://www.freedesktop.org/wiki/Software/systemd">systemd</a>, together
with Kay. Make sure to attend if you are interested in that topic.)</p>

<p>See you in Boston!</p>

]]></description>
   <category domain="http://0pointer.de/blog">/projects</category>
   <pubDate>Fri, 16 Jul 2010 16:35 GMT</pubDate>
</item>
<item>
   <title>Addendum on the Brokenness of File Locking</title>
   <guid isPermaLink="false">projects/locking2</guid>
   <link>http://0pointer.de/blog/projects/locking2.html</link>
   <description><![CDATA[

<p>I forgot to mention another central problem in my <a
href="http://0pointer.de/blog/projects/locking">blog story about file locking
on Linux</a>:</p>

<p>Different machines have access to different features of the same file
system. Here's an example: let's say you have two machines in your home LAN.
You want them to share their <tt>$HOME</tt> directory, so that you (or your family) can
use either machine and have access to all your (or their) data. So you export
<tt>/home</tt> on one machine via NFS and mount it from the other machine.</p>

<p>So far so good. But what happens to file locking now? Programs on the first
machine see a fully-featured ext3 or ext4 file system, where all kinds of
locking works (even though the API might suck as mentioned in the earlier blog
story). But what about the other machine? If you set up <tt>lockd</tt> properly
then POSIX locking will work on both. If you didn't one machine can use POSIX
locking properly, the other cannot. And it gets even worse: as mentioned recent
NFS implementations on Linux transparently convert client-side BSD locking into
POSIX locking on the server side. Now, if the same application uses BSD locking on both
the client and the server side from two instances they will end up with two
orthogonal locks and although both sides think they have properly acquired a
lock (and they actually did) they will overwrite each other's data, because
those two locks are independent. (And one wonders why the NFS developers
implemented this brokenness nonetheless...).</p>

<p>This basically means that locking cannot be used unless it is verified that
<i>everyone</i> accessing a file system can make use of the same file system feature
set. If you use file locking on a file system you should do so only if you are
sufficiently sure that nobody using a broken or weird NFS implementation might
want to access and lock those files as well. And practically that is
impossible. Even if <tt>fpathconf()</tt> was improved so that it could inform
the caller whether it can successfully apply a file lock to a file, this would
still not give any hint if the same is true for everybody else accessing the
file. But that is essential when speaking of advisory (i.e.  cooperative) file
locking.</p>

<p>And no, this isn't easy to fix. So again, the recommendation: forget about
file locking on Linux, it's nothing more than a useless toy.</p>

<p>Also read <a
href="http://www.samba.org/samba/news/articles/low_point/tale_two_stds_os2.html">Jeremy
Allison's</a> (Samba) take on POSIX file locking. It's an interesting read.</p>

]]></description>
   <category domain="http://0pointer.de/blog">/projects</category>
   <pubDate>Mon, 28 Jun 2010 17:49 GMT</pubDate>
</item>
<item>
   <title>On the Brokenness of File Locking</title>
   <guid isPermaLink="false">projects/locking</guid>
   <link>http://0pointer.de/blog/projects/locking.html</link>
   <description><![CDATA[

<p>It's amazing how far Linux has come without providing for proper file
locking that works and is usable from userspace. A little overview why file
locking is still in a very sad state:</p>

<p>To begin with, there's a plethora of APIs, and all of them are awful:</p>

<ul>

<li>POSIX File locking as available with <tt>fcntl(F_SET_LK)</tt>: the POSIX
locking API is the most portable one and in theory works across NFS. It can do
byte-range locking. So much on the good side. On the bad side there's a lot
more however: locks are bound to processes, not file descriptors. That means
that this logic cannot be used in threaded environments unless combined with a
process-local mutex. This is hard to get right, especially in libraries that do
not know the environment they are run in, i.e. whether they are used in
threaded environments or not. The worst part however is that POSIX locks are
automatically released if a process calls <tt>close()</tt> on <i>any</i> (!) of
its open file descriptors for that file. That means that when one part of a
program locks a file and another by coincidence accesses it too for a short
time, the first part's lock will be broken and it won't be notified about that.
Modern software tends to load big frameworks (such as Gtk+ or Qt) into memory
as well as arbitrary modules via mechanisms such as NSS, PAM, gvfs,
GTK_MODULES, Apache modules, GStreamer modules where one module seldom can
control what another module in the same process does or accesses. The effect of
this is that POSIX locks are unusable in any non-trivial program where it
cannot be ensured that a file that is locked is <i>never</i> accessed by
any other part of the process at the same time. Example: a user managing
daemon wants to write <tt>/etc/passwd</tt> and locks the file for that. At
the same time in another thread (or from a stack frame further down)
something calls <tt>getpwuid()</tt> which internally accesses
<tt>/etc/passwd</tt> and causes the lock to be released, the first thread
(or stack frame) not knowing that. Furthermore should two threads use the
locking fcntl()s on the same file they will interfere with each other's locks
and reset the locking ranges and flags of each other. On top of that locking
cannot be used on any file that is publicly accessible (i.e. has the R bit set
for groups/others, i.e. more access bits on than 0600), because that would
otherwise effectively give arbitrary users a way to indefinitely block
execution of any process (regardless of the UID it is running under) that wants
to access and lock the file. This is generally not an acceptable security risk.
Finally, while POSIX file locks are supposedly NFS-safe they not always really
are as there are still many NFS implementations around where locking is not properly
implemented, and NFS tends to be used in heterogenous networks. The biggest
problem about this is that there is no way to properly detect whether file
locking works on a specific NFS mount (or any mount) or not.</li>

<li>The other API for POSIX file locks: <tt>lockf()</tt> is another API for the
same mechanism and suffers by the same problems. One wonders why there are two
APIs for the same messed up interface.</li>

<li>BSD locking based on <tt>flock()</tt>. The semantics of this kind of
locking are much nicer than for POSIX locking: locks are bound to file
descriptors, not processes. This kind of locking can hence be used safely
between threads and can even be inherited across <tt>fork()</tt> and
<tt>exec()</tt>. Locks are only automatically broken on the <tt>close()</tt>
call for the one file descriptor they were created with (or the last duplicate
of it). On the other hand this kind of locking does not offer byte-range
locking and suffers by the same security problems as POSIX locking, and works
on even less cases on NFS than POSIX locking (i.e. on BSD and Linux &lt; 2.6.12
they were NOPs returning success). And since BSD locking is not as portable as
POSIX locking this is sometimes an unsafe choice.  Some OSes even find it funny
to make <tt>flock()</tt> and <tt>fcntl(F_SET_LK)</tt> control the same locks.
Linux treats them independently -- except for the cases where it doesn't: on
Linux NFS they are transparently converted to POSIX locks, too now. What a chaos!</li>

<li>Mandatory locking is available too. It's based on the POSIX locking API but
not portable in itself. It's dangerous business and should generally be avoided
in cleanly written software.</li>

<li>Traditional lock file based file locking. This is how things where done
traditionally, based around known atomicity guarantees of certain basic file
system operations. It's a cumbersome thing, and requires polling of the file
system to get notifications when a lock is released. Also, On Linux NFS &lt; 2.6.5
it doesn't work properly, since O_EXCL isn't atomic there. And of course the
client cannot really know what the server is running, so again this brokeness
is not detectable.</li>

</ul>

<h4>The Disappointing Summary</h4>

<p>File locking on Linux is just broken. The broken semantics of POSIX locking
show that the designers of this API apparently never have tried to actually use
it in real software. It smells a lot like an interface that kernel people
thought makes sense but in reality doesn't when you try to use it from
userspace.</p>

<p>Here's a list of places where you shouldn't use file locking due to the
problems shown above: If you want to lock a file in $HOME, forget about it as
$HOME might be NFS and locks generally are not reliable there. The same applies
to every other file system that might be shared across the network. If the file
you want to lock is accessible to more than your own user (i.e. an access mode
> 0700), forget about locking, it would allow others to block your
application indefinitely. If your program is non-trivial or threaded or uses a
framework such as Gtk+ or Qt or any of the module-based APIs such as NSS, PAM,
... forget about about POSIX locking. If you care about portability, don't use
file locking.</p>

<p>Or to turn this around, the only case where it is kind of safe to use file locking
is in trivial applications where portability is not key and by using BSD
locking on a file system where you can rely that it is local and on files
inaccessible to others. Of course, that doesn't leave much, except for private
files in <tt>/tmp</tt> for trivial user applications.</p>

<p>Or in one sentence: in its current state Linux file locking is unusable.</p>

<p>And that is a shame.</p>

<p><b>Update</b>: <a href="http://0pointer.de/blog/projects/locking2">Check out the follow-up story on this topic.</a></p>

]]></description>
   <category domain="http://0pointer.de/blog">/projects</category>
   <pubDate>Sat, 26 Jun 2010 17:38 GMT</pubDate>
</item>
<item>
   <title>On IDs</title>
   <guid isPermaLink="false">projects/ids</guid>
   <link>http://0pointer.de/blog/projects/ids.html</link>
   <description><![CDATA[

<p>When programming software that cooperates with software running on behalf of
other users, other sessions or other computers it is often necessary to work with
unique identifiers. These can be bound to various hardware and software objects
as well as lifetimes. Often, when people look for such an ID to use they pick
the wrong one because semantics and lifetime or the IDs are not clear. Here's a
little incomprehensive list of IDs accessible on Linux and how you should or
should not use them.</p>

<h4>Hardware IDs</h4>

<ol>

<li><tt>/sys/class/dmi/id/product_uuid</tt>: The main board product UUID, as
set by the board manufacturer and encoded in the BIOS DMI information. It may
be used to identify a mainboard and only the mainboard. It changes when the
user replaces the main board. Also, often enough BIOS manufacturers write bogus
serials into it. In addition, it is x86-specific. Access for unprivileged users
is forbidden. Hence it is of little general use.</li>

<li><tt>CPUID/EAX=3</tt> CPU serial number: A CPU UUID, as set by the
CPU manufacturer and encoded on the CPU chip. It may be used to identify a CPU
and only a CPU. It changes when the user replaces the CPU. Also, most modern
CPUs don't implement this feature anymore, and older computers tend to disable
this option by default, controllable via a BIOS Setup option. In addition, it
is x86-specific. Hence this too is of little general use.</li>

<li><tt>/sys/class/net/*/address</tt>: One or more network MAC addresses, as
set by the network adapter manufacturer and encoded on some network card
EEPROM. It changes when the user replaces the network card. Since network cards
are optional and there may be more than one the availability if this ID is not
guaranteed and you might have more than one to choose from. On virtual machines
the MAC addresses tend to be random. This too is hence of little general use.</li>

<li><tt>/sys/bus/usb/devices/*/serial</tt>: Serial numbers of various USB
devices, as encoded in the USB device EEPROM. Most devices don't have a serial
number set, and if they have it is often bogus. If the user replaces his USB
hardware or plugs it into another machine these IDs may change or appear in
other machines. This hence too is of little use.</li>

</ol>

<p>There are various other hardware IDs available, many of which you may
discover via the ID_SERIAL udev property of various devices, such hard disks
and similar. They all have in common that they are bound to specific
(replacable) hardware, not universally available, often filled with bogus data
and random in virtualized environments. Or in other words: don't use them, don't
rely on them for identification, unless you really know what you are doing and
in general they do not guarantee what you might hope they guarantee.</p>

<h4>Software IDs</h4>

<ol>

<li><tt>/proc/sys/kernel/random/boot_id</tt>: A random ID that is regenerated
on each boot. As such it can be used to identify the local machine's current
boot. It's universally available on any recent Linux kernel. It's a good and
safe choice if you need to identify a specific boot on a specific booted
kernel.</li>

<li><tt>gethostname()</tt>, <tt>/proc/sys/kernel/hostname</tt>: A non-random ID
configured by the administrator to identify a machine in the network. Often
this is not set at all or is set to some default value such as
<tt>localhost</tt> and not even unique in the local network. In addition it
might change during runtime, for example because it changes based on updated
DHCP information. As such it is almost entirely useless for anything but
presentation to the user. It has very weak semantics and relies on correct
configuration by the administrator. Don't use this to identify machines in a
distributed environment. It won't work unless centrally administered, which
makes it useless in a globalized, mobile world. It has no place in
automatically generated filenames that shall be bound to specific hosts. Just
don't use it, please. It's really not what many people think it is.
<tt>gethostname()</tt> is standardized in POSIX and hence portable to other
Unixes.</li>

<li>IP Addresses returned by SIOCGIFCONF or the respective Netlink APIs: These
tend to be dynamically assigned and often enough only valid on local networks
or even only the local links (i.e. 192.168.x.x style addresses, or even
169.254.x.x/IPv4LL). Unfortunately they hence have little use outside of
networking.</li>

<li><tt>gethostid()</tt>: Returns a supposedly unique 32-bit identifier for the
current machine. The semantics of this is not clear. On most machines this
simply returns a value based on a local IPv4 address. On others it is
administrator controlled via the <tt>/etc/hostid</tt> file. Since the semantics
of this ID are not clear and most often is just a value based on the IP address it is
almost always the wrong choice to use. On top of that 32bit are not
particularly a lot. On the other hand this is standardized in POSIX and hence
portable to other Unixes. It's probably best to ignore this value and if people
don't want to ignore it they should probably symlink <tt>/etc/hostid</tt> to
<tt>/var/lib/dbus/machine-id</tt> or something similar.</li>

<li><tt>/var/lib/dbus/machine-id</tt>: An ID identifying a specific Linux/Unix
installation. It does not change if hardware is replaced. It is not unreliable
in virtualized environments. This value has clear semantics and is considered
part of the D-Bus API. It is supposedly globally unique and portable to all
systems that have D-Bus. On Linux, it is universally available, given that
almost all non-embedded and even a fair share of the embedded machines ship
D-Bus now.  This is the recommended way to identify a machine, possibly with a
fallback to the host name to cover systems that still lack D-Bus. If your
application links against <tt>libdbus</tt>, you may access this ID with
<tt>dbus_get_local_machine_id()</tt>, if not you can read it directly from the file system.</li>

<li><tt>/proc/self/sessionid</tt>: An ID identifying a specific Linux login
session. This ID is maintained by the kernel and part of the auditing logic. It
is uniquely assigned to each login session during a specific system boot,
shared by each process of a session, even across su/sudo and cannot be changed
by userspace. Unfortunately some distributions have so far failed to set things
up properly for this to work (Hey, you, Ubuntu!), and this ID is always
<tt>(uint32_t) -1</tt> for them. But there's hope they get this fixed
eventually. Nonetheless it is a good choice for a unique session identifier on
the local machine and for the current boot. To make this ID globally unique it
is best combined with <tt>/proc/sys/kernel/random/boot_id</tt>.</li>

<li><tt>getuid()</tt>: An ID identifying a specific Unix/Linux user. This ID is
usually automatically assigned when a user is created. It is not unique across
machines and may be reassigned to a different user if the original user was
deleted. As such it should be used only locally and with the limited validity
in time in mind. To make this ID globally unique it is not sufficient to
combine it with <tt>/var/lib/dbus/machine-id</tt>, because the same ID might be
used for a different user that is created later with the same UID. Nonetheless
this combination is often good enough. It is available on all POSIX systems.</li>

<li><tt>ID_FS_UUID</tt>: an ID that identifies a specific file system in the
udev tree. It is not always clear how these serials are generated but this
tends to be available on almost all modern disk file systems. It is not
available for NFS mounts or virtual file systems. Nonetheless this is often a
good way to identify a file system, and in the case of the root directory even
an installation. However due to the weakly defined generation semantics the
D-Bus machine ID is generally preferrable.</li>

</ol>

<h4>Generating IDs</h4>

<p>Linux offers a kernel interface to generate UUIDs on demand, by reading from
<tt>/proc/sys/kernel/random/uuid</tt>. This is a very simple interface to
generate UUIDs. That said, the logic behind UUIDs is unnecessarily complex and
often it is a better choice to simply read 16 bytes or so from
<tt>/dev/urandom</tt>.</p>

<h4>Summary</h4>

<p>And the gist of it all: <b>Use <tt>/var/lib/dbus/machine-id</tt>! Use
<tt>/proc/self/sessionid</tt>! Use <tt>/proc/sys/kernel/random/boot_id</tt>!
Use <tt>getuid()</tt>! Use <tt>/dev/urandom</tt>!</b> And forget about the
rest, in particular the host name, or the hardware IDs such as DMI. And keep in
mind that you may combine the aforementioned IDs in various ways to get
different semantics and validity constraints.</p>

]]></description>
   <category domain="http://0pointer.de/blog">/projects</category>
   <pubDate>Sat, 26 Jun 2010 15:02 GMT</pubDate>
</item>
<item>
   <title>Slides from LinuxTag 2010</title>
   <guid isPermaLink="false">projects/linuxtag-2010-slides</guid>
   <link>http://0pointer.de/blog/projects/linuxtag-2010-slides.html</link>
   <description><![CDATA[

<p>On popular request, <a href="http://0pointer.de/public/systemd-presentation-linuxtag2010.pdf">here are my (terse) slides</a> from LinuxTag on <a href="http://www.freedesktop.org/wiki/Software/systemd">systemd</a>.</p>

]]></description>
   <category domain="http://0pointer.de/blog">/projects</category>
   <pubDate>Tue, 15 Jun 2010 12:15 GMT</pubDate>
</item>
<item>
   <title>Change of Plans</title>
   <guid isPermaLink="false">projects/linuxtag2k10</guid>
   <link>http://0pointer.de/blog/projects/linuxtag2k10.html</link>
   <description><![CDATA[

<p>The upcoming week I'll do two talks at LinuxTag 2010 at the Berlin Fair Grounds. One of them was only
added to the schedule today, <a
href="http://www.linuxtag.org/2010/en/program/free-conference/wednesday/details.html?talkid=387">about
systemd</a>. Systemd has never been presented in a public talk before, so make
sure to attend this historic moment... ;-). <a
href="http://0pointer.de/blog/projects/systemd.html">Read about</a> <a
href="http://www.freedesktop.org/wiki/Software/systemd">what has</a> <a
href="http://lwn.net/Articles/389149/">been written</a> <a
href="http://0pointer.de/blog/projects/systemd-in-the-news.html">about systemd
so far</a>, so that you can ask the sharpest questions during my
presentation.</p>

<p>My second talk might be about stuff a little less reported in the press, but
still very interesting, about <a
href="http://www.linuxtag.org/2010/en/program/free-conference/all-speakers/details.html?talkid=425">Surround Sound in Gnome</a>.</p>

<p>See you at LinuxTag!</p>

]]></description>
   <category domain="http://0pointer.de/blog">/projects</category>
   <pubDate>Sat, 05 Jun 2010 17:25 GMT</pubDate>
</item>
<item>
   <title>Mango Lassi is Back</title>
   <guid isPermaLink="false">projects/mango-lassi-is-back</guid>
   <link>http://0pointer.de/blog/projects/mango-lassi-is-back.html</link>
   <description><![CDATA[

<p><img src="http://0pointer.de/public/mango-lassi-icon.png" width="48" height="48" alt="Mango Lassi's Icon"/></p>

<p><a href="http://github.com/herzi/mango-lassi">Sven Herzberg</a> has recently
been doing a lot of work on <a
href="http://0pointer.de/blog/projects/mango-lassi.html">Mango Lassi</a>, a
project deserving love but which I as its original author haven't touched
in 3 years.</p>

<p>His work is already bearing fruits:</p>

<p><a href="http://www.lanedo.com/~herzi/mango-lassi-herzi.png"><img src="http://www.lanedo.com/~herzi/mango-lassi-herzi.png" width="1280" height="800" alt="Mango Lassi"/></a></p>

<p>Distribution packagers, please go and package <a
href="http://github.com/herzi/mango-lassi">his version</a>, Mango Lassi is an
awesome, wonderful tool that needs distributor love.</p>

<p>If you want to use Mango Lassi without waiting for the distribution packagers to catch up, Sven <a href="https://build.opensuse.org/package/show?package=mango-lassi&amp;project=home%3Aherzi">has built some packages for you in the OpenSUSE Build Service</a>.</p>

<p>Sven, KUTGW!</p>

]]></description>
   <category domain="http://0pointer.de/blog">/projects</category>
   <pubDate>Wed, 19 May 2010 15:39 GMT</pubDate>
</item>
<item>
   <title>Name Your Threads</title>
   <guid isPermaLink="false">projects/name-your-threads</guid>
   <link>http://0pointer.de/blog/projects/name-your-threads.html</link>
   <description><![CDATA[

<p>Stefan Kost recently pointed me to the fact that the Linux system call
<tt>prctl(PR_SET_NAME)</tt> does not in fact change the process name, but the
task name (comm field) -- in contrast to what <a
href="http://www.kernel.org/doc/man-pages/online/pages/man2/prctl.2.html">the
man page</a> suggests.</p>

<p>That makes it very useful for naming threads, since you can read back the
name you set with PR_SET_NAME earlier from the <tt>/proc</tt> file system
(<tt>/proc/$PID/task/$TID/comm</tt> on newer kernels,
<tt>/proc/$PID/task/$TID/stat</tt>'s second field on older kernels), and hence
distuingish which thread might be responsible for the high CPU load or similar
problems.</p>

<p>So, now go, if you have a project which involves a lot of threads, name them
all individually, and make it easier to debug them. What's missing now, of
course, is that gdb learns this and shows the comm name when doing <tt>info
threads</tt>.</p>

<p>I have changed PulseAudio now to name all threads it creates.</p>

<p>Of course, what would be even better than this is full file system extended
attribute support in procfs, so that we could attach arbitrary information to
processes and threads, including references to <tt>.desktop</tt> files and such.</p>

]]></description>
   <category domain="http://0pointer.de/blog">/projects</category>
   <pubDate>Mon, 10 May 2010 23:22 GMT</pubDate>
</item>
<item>
   <title>systemd Now Has a Web Site</title>
   <guid isPermaLink="false">projects/systemd-website</guid>
   <link>http://0pointer.de/blog/projects/systemd-website.html</link>
   <description><![CDATA[

<p>We now have a <a href="http://www.freedesktop.org/wiki/Software/systemd">web
site</a>, a <a
href="http://lists.freedesktop.org/mailman/listinfo/systemd-devel">mailing
list</a>, a bugzilla component and moved our
<a href="http://cgit.freedesktop.org/systemd/">git repositories to freedesktop.org</a>. Make sure to update your check-outs.</p>

<p>For more details see <a href="http://www.freedesktop.org/wiki/Software/systemd">our new web site</a>.</p>

]]></description>
   <category domain="http://0pointer.de/blog">/projects</category>
   <pubDate>Fri, 07 May 2010 20:29 GMT</pubDate>
</item>
<item>
   <title>LAC Video Streams Online</title>
   <guid isPermaLink="false">projects/lac-video</guid>
   <link>http://0pointer.de/blog/projects/lac-video.html</link>
   <description><![CDATA[

<p>The great people from the <a href="http://lac.linuxaudio.org/2010/">Linux Audio Conference</a> <a
href="http://lists.linuxaudio.org/pipermail/linux-audio-dev/2010-May/027529.html">uploaded
the video streams from the event</a>. <a
href="http://www.linuxproaudio.org/lac2010/">Among them</a> you can find <a
href="http://www.linuxproaudio.org/lac2010/day1_1400_Pro_Audio_is_Easy_Consumer_Audio_is_Hard.ogv">my
own presentation</a>. Enjoy!</p>

]]></description>
   <category domain="http://0pointer.de/blog">/projects</category>
   <pubDate>Wed, 05 May 2010 18:22 GMT</pubDate>
</item>
<item>
   <title>PulseAudio and Jack</title>
   <guid isPermaLink="false">projects/when-pa-and-when-not</guid>
   <link>http://0pointer.de/blog/projects/when-pa-and-when-not.html</link>
   <description><![CDATA[

<p>One thing became very clear to me during my trip to the <a
href="http://lac.linuxaudio.org/2010/">Linux Audio Conference 2010</a>
in Utrecht: even many pro audio folks are not sure what <a
href="http://jackaudio.org/">Jack</a> does that <a
href="http://www.pulseaudio.org/">PulseAudio</a> doesn't do and what
PulseAudio does that Jack doesn't do; why they are not competing, why
you cannot replace one by the other, and why merging them (at least in
the short term) might not make immediate sense.  In other words, why
millions of phones on this world run PulseAudio and not Jack, and why
a music studio running PulseAudio is crack.</p>

<p>To light this up a bit and for future reference I'll try to explain in the
following text why there is this seperation between the two systems and why this isn't
necessarily bad. This is mostly a written up version of (parts of) <a href="http://lac.linuxaudio.org/2010/download/lennarts-talk-auf-der-lac-2010.pdf">my slides
from LAC</a>, so if you attended that event you might find little new, but I hope
it is interesting nonetheless.</p>

<p>This is mostly written from my perspective as a hacker working on
consumer audio stuff (more specifically having written most of
PulseAudio), but I am sure most pro audio folks would agree with the
points I raise here, and have more things to add. What I explain below
is in no way comprehensive, just a list of a couple of points I think
are the most important, as they touch the very core of both
systems (and we ignore all the toppings here, i.e. sound effects, yadda, yadda).</p>

<p>First of all let's clear up the background of the sound server use cases here:</p>

<table border="1">
<tr><th>Consumer Audio (i.e. PulseAudio)</th>
<th>Pro Audio (i.e. Jack)</th></tr>

<tr><td>Reducing power usage is a defining requirement, most systems are battery powered (Laptops, Cell Phones).</td>
<td>Power usage usually not an issue, power comes out of the wall.</td></tr>

<tr><td>Must support latencies low enough for telephony and
games. Also covers high latency uses, such as movie and music playback
(2s of latency is a good choice).</td> <td>Minimal latencies are a
definining requirement.</td></tr>

<tr><td>System is highly dynamic, with applications starting/stopping, hardware added and removed all the time.</td>
<td>System is usually static in its configuration during operation.</td></tr>

<tr><td>User is usually not proficient in the technologies used.<small><sup>[1]</sup></small></td>
<td>User is usually a professional and knows audio technology and computers well.</td></tr>

<tr><td>User is not necessarily the administrator of his machine, might have limited access.</td>
<td>User usually administrates his own machines, has root privileges.</td></tr>

<tr><td>Audio is just one use of the system among many, and often just a background job.</td>
<td>Audio is the primary purpose of the system.</td></tr>

<tr><td>Hardware tends to have limited resources and be crappy and cheap.</td>
<td>Hardware is powerful, expensive and high quality.</td></tr>
</table>

<p>Of course, things are often not as black and white like this, there are uses
that fall in the middle of these two areas.</p>

<p>From the table above a few conclusions may be drawn:</p>

<ul>

<li>A consumer sound system must support both low and high latency operation.
Since low latencies mean high CPU load and hence high power
consumption<small><sup>[2]</sup></small> (Heisenberg...), a system should always run with the
highest latency latency possible, but the lowest latency necessary.</li>

<li>Since the consumer system is highly dynamic in its use latencies must be
adjusted dynamically too. That makes a design such as PulseAudio's <a
href="http://0pointer.de/blog/projects/pulse-glitch-free.html">timer-based scheduling</a> important.</li>

<li>A pro audio system's primary optimization target is low latency. Low
power usage, dynamic changeble configuration (i.e. a short drop-out while you
change your pipeline is acceptable) and user-friendliness may be sacrificed for
that.</li>

<li>For large buffer sizes a zero-copy design suggests itself: since data
blocks are large the cache pressure can be considerably reduced by zero-copy
designs. Only for large buffers the cost of passing pointers around is
considerable smaller than the cost of passing around the data itself (or the
other way round: if your audio data has the same size as your pointers, then
passing pointers around is useless extra work).</li>

<li>On a resource constrained system the ideal audio pipeline does not touch
and convert the data passed along it unnecessarily. That makes it important to
support natively the sample types and interleaving modes of the audio source or
destination.</li>

<li>A consumer system needs to simplify the view on the hardware, hide the its
complexity: hide redundant mixer elements, or merge them while making use of
the hardware capabilities, and extending it in software so that the same
functionality is provided on all hardware. A production system should not hide
or simplify the hardware functionality.</li>

<li>A consumer system should not drop-out when a client misbehaves or the
configuration changes (OTOH if it happens in exceptions it is not disastrous
either). A synchronous pipeline is hence not advisable, clients need to supply
their data asynchronously.</li>

<li>In a pro audio system a drop-out during reconfiguration is acceptable,
during operation unacceptable.</li>

<li>In consumer audio we need to make compromises on resource usage,
which pro audio does not have to commit to. Example: a pro audio
system can issue <tt>memlock()</tt> with little limitations since the
hardware is powerful (i.e. a lot of RAM available) and audio is the
primary purpose. A consumer audio system cannot do that because that
call practically makes memory unavailable to other applications,
increasing their swap pressure. And since audio is not the primary
purpose of the system and resources limited we hence need to find a
different way.</li>

</ul>

<p>Jack has been designed for low latencies, where synchronous
operation is advisable, meaning that a misbehaving client call stall
the entire pipeline. Changes of the pipeline or latencies usually
result in drop-outs in one way or the other, since the entire pipeline
is reconfigured, from the hardware to the various clients. Jack only
supports FLOAT32 samples and non-interleaved audio channels (and that
is a good thing). Jack does not employ reference-counted zero-copy
buffers. It does not try to simplify the hardware mixer in any
way.</p>

<p>PulseAudio OTOH can deal with varying latancies, <a
href="http://0pointer.de/blog/projects/pulse-glitch-free.html">dynamically
adjusting to the lowest latencies any of the connected clients
needs</a>. Client communication is fully asynchronous, a single client
cannot stall the entire pipeline. PulseAudio supports a variety of PCM
formats and channel setups. PulseAudio's design is heavily based on
reference-counted zero-copy buffers that are passed around, even
between processes, instead of the audio data itself. PulseAudio tries
to simplify the hardware mixer as suggested above.</p>

<p>Now, the two paragraphs above hopefully show how Jack is more
suitable for the pro audio use case and PulseAudio more for the
consumer audio use case. One question asks itself though: can we marry
the two approaches? Yes, we probably can, MacOS has a unified approach
for both uses. However, it is not clear this would be a good
idea. First of all, a system with the complexities introduced by
sample format/channel mapping conversion, as well as dynamically
changing latencies and pipelines, and asynchronous behaviour would
certainly be much less attractive to pro audio developers. In fact,
that Jack limits itself to synchronous, FLOAT32-only,
non-interleaved-only audio streams is one of the big features of its
design. Marrying the two approaches would corrupt that. A merged
solution would probably not have a good stand in the community.</p>

<p>But it goes even further than this: what would the use case for
this be? After all, most of the time, you don't want your event
sounds, your Youtube, your VoIP and your Rhythmbox mixed into the new
record you are producing. Hence a clear seperation between the two
worlds might even be handy?</p>

<p>Also, let's not forget that we lack the manpower to even create
such an audio chimera.</p>

<p>So, where to from here? Well, I think we should put the focus on
cooperation instead of amalgamation: teach PulseAudio to go out of the
way as soon as Jack needs access to the device, and optionally make
PulseAudio a normal JACK client while both are running. That way, the
user has the option to use the PulseAudio supplied streams, but
normally does not see them in his pipeline. The first part of this has
already been implemented: Jack2 and PulseAudio do not fight for the
audio device, a friendly handover takes place. Jack takes precedence,
PulseAudio takes the back seat. The second part is still missing: you
still have to manually hookup PulseAudio to Jack if you are interested
in its streams. If both are implemented starting Jack basically has
the effect of replacing PulseAudio's core with the Jack core, while
still providing full compatibility with PulseAudio clients.</p>

<p>And that I guess is all I have to say on the entire Jack and
PulseAudio story.</p>

<p>Oh, one more thing, while we are at clearing things up: some news
sites claim that PulseAudio's not necessarily stellar reputation in
some parts of the community comes from Ubuntu and other distributions
having integrated it too early. Well, let me stress here explicitly,
that while they might have made a mistake or two in packaging
PulseAudio and I publicly pointed that out (and probably not in a too
friendly way), I do believe that the point in time they adopted it was
right. Why? Basically, it's a chicken and egg problem. If it is not
used in the distributions it is not tested, and there is no pressure
to get fixed what then turns out to be broken: in PulseAudio itself,
and in both the layers on top and below of it. Don't forget that
pushing a new layer into an existing stack will break a lot of
assumptions that the neighboring layers made. Doing this <i>must</i>
break things. Most Free Software projects could probably use more
developers, and that is particularly true for Audio on Linux. And
given that that is how it is, pushing the feature in at that point in
time was the right thing to do. Or in other words, if the features are
right, and things do work correctly as far as the limited test base
the developers control shows, then one day you need to push into the
distributions, even if this might break setups and software that
previously has not been tested, unless you want to stay stuck in your
development indefinitely. So yes, Ubuntu, I think you did well with
adopting PulseAudio when you did.</p>

<h5>Footnotes</h5>

<p><small>[1] Side note: yes, consumers tend not to know what <a
href="http://en.wikipedia.org/wiki/Decibel">dB</a> is, and expect
volume settings in "percentages", a mostly meaningless unit in
audio. This even spills into projects like VLC or Amarok which expose
linear volume controls (which is a really bad idea).</small></p>

<p><small>[2] In case you are wondering why that is the case: if the latency is
low the buffers must be sized smaller. And if the buffers are sized smaller
then the CPU will have to wake up more often to fill them up for the same
playback time. This drives up the CPU load since less actual payload can be
processed for the amount of housekeeping that the CPU has to do during each
buffer iteration. Also, frequent wake-ups make it impossible for the CPU to go
to deeper sleep states. Sleep states are the primary way for modern CPUs
to save power.</small></p>

]]></description>
   <category domain="http://0pointer.de/blog">/projects</category>
   <pubDate>Wed, 05 May 2010 00:44 GMT</pubDate>
</item>
<item>
   <title>systemd In The News</title>
   <guid isPermaLink="false">projects/systemd-in-the-news</guid>
   <link>http://0pointer.de/blog/projects/systemd-in-the-news.html</link>
   <description><![CDATA[

<p>A few news sites brought articles (some shorter, others longer) about <a href="http://0pointer.de/blog/projects/systemd.html">last week's blog story on systemd</a>:</p>

<ul>
<li><a href="http://lwn.net/Articles/385536/">Linux Weekly News</a></li>
<li><a href="http://www.h-online.com/open/news/item/Systemd-presented-as-SysV-Init-and-Upstart-alternative-991875.html">The H Open</a></li>
<li><a href="http://www.osnews.com/story/23232/Rethinking_PID_1">OSNews</a></li>
<li><a href="http://www.pro-linux.de/news/1/15621/systemd-alternative-zu-init-vorgeschlagen.html">Pro Linux (german)</a></li>
<li><a href="http://www.golem.de/1005/74884.html">Golem (german)</a></li>
<li><a href="http://www.heise.de/ct/meldung/SysVinit-und-Upstart-Alternative-Systemd-vorgestellt-991662.html">c't (german)</a></li>
<li><a href="http://www.reddit.com/r/coding/comments/bym56/systemd_rethinking_pid_1/">Reddit #1</a>, <a href="http://www.reddit.com/r/linux/comments/bybxf/rethinking_pid_1/">Reddit #2</a></li>
</ul>

<p>Related to this, <a href="http://www.netsplit.com/2010/04/30/on-systemd/">Scott's cordial reply</a>.</p>

<p><a href="http://brainstorm.ubuntu.com/idea/24701/">And this I find funny, make sure to vote for it... ;-)</a></p>

<p>Many of the comments on those stories are quite interesting, though sometimes a little, uh..., misled... ;-)</p>

<p>Generally the reception of the ideas seems to be very positive. And that's certainly good news and encouraging.</p>

]]></description>
   <category domain="http://0pointer.de/blog">/projects</category>
   <pubDate>Tue, 04 May 2010 23:30 GMT</pubDate>
</item>
<item>
   <title>Rethinking PID 1</title>
   <guid isPermaLink="false">projects/systemd</guid>
   <link>http://0pointer.de/blog/projects/systemd.html</link>
   <description><![CDATA[

    <p>If you are well connected or good at reading between the lines
    you might already know what this blog post is about. But even then
    you may find this story interesting. So grab a cup of coffee,
    sit down, and read what's coming.</p>

    <p>This blog story is long, so even though I can only recommend
    reading the long story, here's the one sentence summary: we are
    experimenting with a new init system and it is fun.</p>

    <p><a href="http://git.0pointer.de/?p=systemd.git">Here's the code.</a> And here's the story:</p>

    <h4>Process Identifier 1</h4>

    <p>On every Unix system there is one process with the special
    process identifier 1. It is started by the kernel before all other
    processes and is the parent process for all those other processes
    that have nobody else to be child of. Due to that it can do a lot
    of stuff that other processes cannot do. And it is also
    responsible for some things that other processes are not
    responsible for, such as bringing up and maintaining userspace
    during boot.</p>

    <p>Historically on Linux the software acting as PID 1 was the
    venerable sysvinit package, though it had been showing its age for
    quite a while. Many replacements have been suggested, only one of
    them really took off: <a
    href="http://upstart.ubuntu.com/">Upstart</a>, which has by now found
    its way into all major distributions.</p>

    <p>As mentioned, the central responsibility of an init system is
    to bring up userspace. And a good init system does that
    fast. Unfortunately, the traditional SysV init system was not
    particularly fast.</p>

    <p>For a fast and efficient boot-up two things are crucial:</p>

    <ul>
      <li>To start <b>less</b>.</li>

      <li>And to start <b>more</b> in <i>parallel</i>.</li>
    </ul>

    <p>What does that mean? Starting less means starting fewer
    services or deferring the starting of services until they are
    actually needed. There are some services where we know that they
    will be required sooner or later (syslog, D-Bus system bus, etc.),
    but for many others this isn't the case. For example, bluetoothd
    does not need to be running unless a bluetooth dongle is actually
    plugged in or an application wants to talk to its D-Bus
    interfaces. Same for a printing system: unless the machine
    physically is connected to a printer, or an application wants to
    print something, there is no need to run a printing daemon such as
    CUPS. Avahi: if the machine is not connected to a
    network, there is no need to run <a
    href="http://avahi.org">Avahi</a>, unless some application wants
    to use its APIs. And even SSH: as long as nobody wants to contact
    your machine there is no need to run it, as long as it is then
    started on the first connection. (And admit it, on most machines
    where sshd might be listening somebody connects to it only every
    other month or so.)</p>

    <p>Starting more in parallel means that if we have
    to run something, we should not serialize its start-up (as sysvinit
    does), but run it all at the same time, so that the available
    CPU and disk IO bandwidth is maxed out, and hence
    the overall start-up time minimized.</p>

    <h4>Hardware and Software Change Dynamically</h4>

    <p>Modern systems (especially general purpose OS) are highly
    dynamic in their configuration and use: they are mobile, different
    applications are started and stopped, different hardware added and
    removed again. An init system that is responsible for maintaining
    services needs to listen to hardware and software
    changes. It needs to dynamically start (and sometimes stop)
    services as they are needed to run a program or enable some
    hardware.</p>

    <p>Most current systems that try to parallelize boot-up still
    synchronize the start-up of the various daemons involved: since
    Avahi needs D-Bus, D-Bus is started first, and only when D-Bus
    signals that it is ready, Avahi is started too. Similar for other
    services: livirtd and X11 need HAL (well, I am considering the
    Fedora 13 services here, ignore that HAL is obsolete), hence HAL
    is started first, before livirtd and X11 are started. And
    libvirtd also needs Avahi, so it waits for Avahi too. And all of
    them require syslog, so they all wait until Syslog is fully
    started up and initialized. And so on.</p>

    <h4>Parallelizing Socket Services</h4>

    <p>This kind of start-up synchronization results in the
    serialization of a significant part of the boot process. Wouldn't
    it be great if we could get rid of the synchronization and
    serialization cost? Well, we can, actually. For that, we need to
    understand what exactly the daemons require from each other, and
    why their start-up is delayed. For traditional Unix daemons,
    there's one answer to it: they wait until the socket the other
    daemon offers its services on is ready for connections. Usually
    that is an AF_UNIX socket in the file-system, but it could be
    AF_INET[6], too.  For example, clients of D-Bus wait that
    <tt>/var/run/dbus/system_bus_socket</tt> can be connected to,
    clients of syslog wait for <tt>/dev/log</tt>, clients of CUPS wait
    for <tt>/var/run/cups/cups.sock</tt> and NFS mounts wait for
    <tt>/var/run/rpcbind.sock</tt> and the portmapper IP port, and so
    on. And think about it, this is actually the only thing they wait
    for!</p>

    <p>Now, if that's all they are waiting for, if we manage to make
    those sockets available for connection earlier and only actually
    wait for that instead of the full daemon start-up, then we can
    speed up the entire boot and start more processes in parallel. So,
    how can we do that? Actually quite easily in Unix-like systems: we
    can create the listening sockets <b>before</b> we actually start
    the daemon, and then just pass the socket during <tt>exec()</tt>
    to it. That way, we can create <b>all</b> sockets for <b>all</b>
    daemons in one step in the init system, and then in a second step
    run all daemons at once. If a service needs another, and it is not
    fully started up, that's completely OK: what will happen is that
    the connection is queued in the providing service and the client
    will potentially block on that single request. But only that one
    client will block and only on that one request. Also, dependencies
    between services will no longer necessarily have to be configured
    to allow proper parallelized start-up: if we start all sockets at
    once and a service needs another it can be sure that it can
    connect to its socket.</p>

    <p>Because this is at the core of what is following, let me say
    this again, with different words and by example: if you start
    syslog and and various syslog clients at the same time, what will
    happen in the scheme pointed out above is that the messages of the
    clients will be added to the <tt>/dev/log</tt> socket buffer. As
    long as that buffer doesn't run full, the clients will not have to
    wait in any way and can immediately proceed with their start-up. As
    soon as syslog itself finished start-up, it will dequeue all
    messages and process them. Another example: we start D-Bus and
    several clients at the same time. If a synchronous bus
    request is sent and hence a reply expected, what will happen is
    that the client will have to block, however only that one client
    and only until D-Bus managed to catch up and process it.</p>

    <p>Basically, the kernel socket buffers help us to maximize
    parallelization, and the ordering and synchronization is done by
    the kernel, without any further management from userspace! And if
    all the sockets are available before the daemons actually start-up,
    dependency management also becomes redundant (or at least
    secondary): if a daemon needs another daemon, it will just connect
    to it. If the other daemon is already started, this will
    immediately succeed. If it isn't started but in the process of
    being started, the first daemon will not even have to wait for it,
    unless it issues a synchronous request. And even if the other
    daemon is not running at all, it can be auto-spawned. From the
    first daemon's perspective there is no difference, hence dependency
    management becomes mostly unnecessary or at least secondary, and
    all of this in optimal parallelization and optionally with
    on-demand loading. On top of this, this is also more robust, because
    the sockets stay available regardless whether the actual daemons
    might temporarily become unavailable (maybe due to crashing). In
    fact, you can easily write a daemon with this that can run, and
    exit (or crash), and run again and exit again (and so on), and all
    of that without the clients noticing or loosing any request.</p>

    <p>It's a good time for a pause, go and refill your coffee mug,
    and be assured, there is more interesting stuff following.</p>

    <p>But first, let's clear a few things up: is this kind of logic
    new? No, it certainly is not. The most prominent system that works
    like this is Apple's launchd system: on MacOS the listening of the
    sockets is pulled out of all daemons and done by launchd. The
    services themselves hence can all start up in parallel and
    dependencies need not to be configured for them. And that is
    actually a really ingenious design, and the primary reason why
    MacOS manages to provide the fantastic boot-up times it
    provides. I can highly recommend <a
    href="http://video.google.com/videoplay?docid=1781045834610400422">this
    video</a> where the launchd folks explain what they are
    doing. Unfortunately this idea never really took on outside of the Apple
    camp.</p>

    <p>The idea is actually even older than launchd. Prior to launchd
    the venerable <tt>inetd</tt> worked much like this: sockets were
    centrally created in a daemon that would start the actual service
    daemons passing the socket file descriptors during
    <tt>exec()</tt>. However the focus of <tt>inetd</tt> certainly
    wasn't local services, but Internet services (although later
    reimplementations supported AF_UNIX sockets, too). It also wasn't a
    tool to parallelize boot-up or even useful for getting implicit
    dependencies right.</p>

    <p>For TCP sockets <tt>inetd</tt> was primarily used in a way that
    for every incoming connection a new daemon instance was
    spawned. That meant that for each connection a new
    process was spawned and initialized, which is not a
    recipe for high-performance servers. However, right from the
    beginning <tt>inetd</tt> also supported another mode, where a
    single daemon was spawned on the first connection, and that single
    instance would then go on and also accept the follow-up connections
    (that's what the <tt>wait</tt>/<tt>nowait</tt> option in
    <tt>inetd.conf</tt> was for, a particularly badly documented
    option, unfortunately.) Per-connection daemon starts probably gave
    inetd its bad reputation for being slow. But that's not entirely
    fair.</p>

    <h4>Parallelizing Bus Services</h4>

    <p>Modern daemons on Linux tend to provide services via D-Bus
    instead of plain AF_UNIX sockets. Now, the question is, for those
    services, can we apply the same parallelizing boot logic as for
    traditional socket services? Yes, we can, D-Bus already has all
    the right hooks for it: using bus activation a service can be
    started the first time it is accessed. Bus activation also gives
    us the minimal per-request synchronisation we need for starting up
    the providers and the consumers of D-Bus services at the same
    time: if we want to start Avahi at the same time as CUPS (side
    note: CUPS uses Avahi to browse for mDNS/DNS-SD printers), then we
    can simply run them at the same time, and if CUPS is quicker than
    Avahi via the bus activation logic we can get D-Bus to queue the
    request until Avahi manages to establish its service name.</p>

    <p>So, in summary: the socket-based service activation and the
    bus-based service activation together enable us to start
    <b>all</b> daemons in parallel, without any further
    synchronization. Activation also allows us to do lazy-loading of
    services: if a service is rarely used, we can just load it the
    first time somebody accesses the socket or bus name, instead of
    starting it during boot.</p>

    <p>And if that's not great, then I don't <b>know</b> what is
    great!</p>

    <h4>Parallelizing File System Jobs</h4>

    <p>If you look <a
    href="http://picasaweb.google.com/betsubetsu43/Fedora#5179125455943690130">at
    the serialization graphs of the boot process</a> of current
    distributions, there are more synchronisation points than just
    daemon start-ups: most prominently there are file-system related
    jobs: mounting, fscking, quota. Right now, on boot-up a lot of
    time is spent idling to wait until all devices that are listed in
    <tt>/etc/fstab</tt> show up in the device tree and are then
    fsck'ed, mounted, quota checked (if enabled). Only after that is
    fully finished we go on and boot the actual services.</p>

    <p>Can we improve this? It turns out we can. Harald Hoyer came up
    with the idea of using the venerable autofs system for this:</p>

    <p>Just like a <tt>connect()</tt> call shows that a service is
    interested in another service, an <tt>open()</tt> (or a similar
    call) shows that a service is interested in a specific file or
    file-system. So, in order to improve how much we can parallelize
    we can make those apps wait only if a file-system they are looking
    for is not yet mounted and readily available: we set up an autofs
    mount point, and then when our file-system finished fsck and quota
    due to normal boot-up we replace it by the real mount. While the
    file-system is not ready yet, the access will be queued by the
    kernel and the accessing process will block, but only that one
    daemon and only that one access. And this way we can begin
    starting our daemons even before all file systems have been fully
    made available -- without them missing any files, and maximizing
    parallelization.</p>

    <p>Parallelizing file system jobs and service jobs does
    not make sense for <tt>/</tt>, after all that's where the service
    binaries are usually stored. However, for file-systems such as
    <tt>/home</tt>, that usually are bigger, even encrypted, possibly
    remote and seldom accessed by the usual boot-up daemons, this
    can improve boot time considerably. It is probably not necessary
    to mention this, but virtual file systems, such as
    procfs or sysfs should never be mounted via autofs.</p>

    <p>I wouldn't be surprised if some readers might find integrating
    autofs in an init system a bit fragile and even weird, and maybe
    more on the "crackish" side of things. However, having played
    around with this extensively I can tell you that this actually
    feels quite right. Using autofs here simply means that we can
    create a mount point without having to provide the backing file
    system right-away. In effect it hence only delays accesses. If an
    application tries to access an autofs file-system and we take very
    long to replace it with the real file-system, it will hang in an
    interruptible sleep, meaning that you can safely cancel it, for
    example via C-c. Also note that at any point, if the mount point
    should not be mountable in the end (maybe because fsck failed), we
    can just tell autofs to return a clean error code (like
    ENOENT). So, I guess what I want to say is that even though
    integrating autofs into an init system might appear adventurous at
    first, our experimental code has shown that this idea works
    surprisingly well in practice -- if it is done for the right
    reasons and the right way.</p>

    <p>Also note that these should be <i>direct</i> autofs
    mounts, meaning that from an application perspective there's
    little effective difference between a classic mount point and one
    based on autofs.</p>

    <h4>Keeping the First User PID Small</h4>

    <p>Another thing we can learn from the MacOS boot-up logic is
    that shell scripts are evil. Shell is fast and shell is slow. It
    is fast to hack, but slow in execution. The classic sysvinit boot
    logic is modelled around shell scripts. Whether it is
    <tt>/bin/bash</tt> or any other shell (that was written to make
    shell scripts faster), in the end the approach is doomed to be
    slow. On my system the scripts in <tt>/etc/init.d</tt> call
    <tt>grep</tt> at least 77 times. <tt>awk</tt> is called 92
    times, <tt>cut</tt> 23 and <tt>sed</tt> 74. Every time those
    commands (and others) are called, a process is spawned, the
    libraries searched, some start-up stuff like i18n and so on set up
    and more. And then after seldom doing more than a trivial string
    operation the process is terminated again. Of course, that has to
    be incredibly slow. No other language but shell would do something like
    that. On top of that, shell scripts are also very fragile, and
    change their behaviour drastically based on environment variables
    and suchlike, stuff that is hard to oversee and control.</p>

    <p>So, let's get rid of shell scripts in the boot process! Before
    we can do that we need to figure out what they are currently
    actually used for: well, the big picture is that most of the time,
    what they do is actually quite boring. Most of the scripting is
    spent on trivial setup and tear-down of services, and should be
    rewritten in C, either in separate executables, or moved into the
    daemons themselves, or simply be done in the init system.</p>

    <p>It is not likely that we can get rid of shell scripts during
    system boot-up entirely anytime soon. Rewriting them in C takes
    time, in a few case does not really make sense, and sometimes
    shell scripts are just too handy to do without. But we can
    certainly make them less prominent.</p>

    <p>A good metric for measuring shell script infestation of the
    boot process is the PID number of the first process you can start
    after the system is fully booted up. Boot up, log in, open a
    terminal, and type <tt>echo $$</tt>. Try that on your Linux
    system, and then compare the result with MacOS! (Hint, it's
    something like this: Linux PID 1823; MacOS PID 154, measured on
    test systems we own.)</p>

    <h4>Keeping Track of Processes</h4>

    <p>A central part of a system that starts up and maintains
    services should be process babysitting: it should watch
    services. Restart them if they shut down. If they crash it should
    collect information about them, and keep it around for the
    administrator, and cross-link that information with what is
    available from crash dump systems such as abrt, and in logging
    systems like syslog or the audit system.</p>

    <p>It should also be capable of shutting down a service
    completely. That might sound easy, but is harder than you
    think. Traditionally on Unix a process that does double-forking
    can escape the supervision of its parent, and the old parent will
    not learn about the relation of the new process to the one it
    actually started. An example: currently, a misbehaving CGI script
    that has double-forked is not terminated when you shut down
    Apache. Furthermore, you will not even be able to figure out its
    relation to Apache, unless you know it by name and purpose.</p>

    <p>So, how can we keep track of processes, so that they cannot
    escape the babysitter, and that we can control them as one unit
    even if they fork a gazillion times?</p>

    <p>Different people came up with different solutions for this. I
    am not going into much detail here, but let's at least say that
    approaches based on ptrace or the netlink connector (a kernel
    interface which allows you to get a netlink message each time any
    process on the system fork()s or exit()s) that some people have
    investigated and implemented, have been criticised as ugly and not
    very scalable.</p>

    <p>So what can we do about this? Well, since quite a while the
    kernel knows <a
    href="http://git.kernel.org/gitweb.cgi?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/cgroups/cgroups.txt;hb=HEAD">Control
    Groups</a> (aka "cgroups"). Basically they allow the creation of a
    hierarchy of groups of processes. The hierarchy is directly
    exposed in a virtual file-system, and hence easily accessible. The
    group names are basically directory names in that file-system. If
    a process belonging to a specific cgroup fork()s, its child will
    become a member of the same group. Unless it is privileged and has
    access to the cgroup file system it cannot escape its
    group. Originally, cgroups have been introduced into the kernel
    for the purpose of containers: certain kernel subsystems can
    enforce limits on resources of certain groups, such as limiting
    CPU or memory usage. Traditional resource limits (as implemented
    by <tt>setrlimit()</tt>) are (mostly) per-process. cgroups on the
    other hand let you enforce limits on entire groups of
    processes. cgroups are also useful to enforce limits outside of
    the immediate container use case. You can use it for example to
    limit the total amount of memory or CPU Apache and all its
    children may use. Then, a misbehaving CGI script can no longer
    escape your <tt>setrlimit()</tt> resource control by simply
    forking away.</p>

    <p>In addition to container and resource limit enforcement cgroups
    are very useful to keep track of daemons: cgroup membership is
    securely inherited by child processes, they cannot escape. There's
    a notification system available so that a supervisor process can
    be notified when a cgroup runs empty. You can find the cgroups of
    a process by reading <tt>/proc/$PID/cgroup</tt>. cgroups hence
    make a very good choice to keep track of processes for babysitting
    purposes.</p>

    <h4>Controlling the Process Execution Environment</h4>

    <p>A good babysitter should not only oversee and control when a
    daemon starts, ends or crashes, but also set up a good, minimal,
    and secure working environment for it.</p>

    <p>That means setting obvious process parameters such as the
    <tt>setrlimit()</tt> resource limits, user/group IDs or the
    environment block, but does not end there. The Linux kernel gives
    users and administrators a lot of control over processes (some of
    it is rarely used, currently). For each process you can set CPU
    and IO scheduler controls, the capability bounding set, CPU
    affinity or of course cgroup environments with additional limits,
    and more.</p>

    <p>As an example, <tt>ioprio_set()</tt> with
    <tt>IOPRIO_CLASS_IDLE</tt> is a great away to minimize the effect
    of <tt>locate</tt>'s <tt>updatedb</tt> on system interactivity.</p>

    <p>On top of that certain high-level controls can be very useful,
    such as setting up read-only file system overlays based on
    read-only bind mounts. That way one can run certain daemons so
    that all (or some) file systems appear read-only to them, so that
    EROFS is returned on every write request. As such this can be used
    to lock down what daemons can do similar in fashion to a poor
    man's SELinux policy system (but this certainly doesn't replace
    SELinux, don't get any bad ideas, please).</p>

    <p>Finally logging is an important part of executing services:
    ideally every bit of output a service generates should be logged
    away. An init system should hence provide logging to daemons it
    spawns right from the beginning, and connect stdout and stderr to
    syslog or in some cases even <tt>/dev/kmsg</tt> which in many
    cases makes a very useful replacement for syslog (embedded folks,
    listen up!), especially in times where the kernel log buffer is
    configured ridiculously large out-of-the-box.</p>

    <h4>On Upstart</h4>

    <p>To begin with, let me emphasize that I actually like the code
    of Upstart, it is very well commented and easy to
    follow. It's certainly something other projects should learn
    from (including my own).</p>

    <p>That being said, I can't say I agree with the general approach
    of Upstart. But first, a bit more about the project:</p>

    <p>Upstart does not share code with sysvinit, and its
    functionality is a super-set of it, and provides compatibility to
    some degree with the well known SysV init scripts. It's main
    feature is its event-based approach: starting and stopping of
    processes is bound to "events" happening in the system, where an
    "event" can be a lot of different things, such as: a network
    interfaces becomes available or some other software has been
    started.</p>

    <p>Upstart does service serialization via these events: if the
    <tt>syslog-started</tt> event is triggered this is used as an
    indication to start D-Bus since it can now make use of Syslog. And
    then, when <tt>dbus-started</tt> is triggered,
    <tt>NetworkManager</tt> is started, since it may now use
    <tt>D-Bus</tt>, and so on.</p>

    <p>One could say that this way the actual logical dependency tree
    that exists and is understood by the admin or developer is
    translated and encoded into event and action rules: every logical
    "a needs b" rule that the administrator/developer is aware of
    becomes a "start a when b is started" plus "stop a when b is
    stopped". In some way this certainly is a simplification:
    especially for the code in Upstart itself. However I would argue
    that this simplification is actually detrimental. First of all,
    the logical dependency system does not go away, the person who is
    writing Upstart files must now translate the dependencies manually
    into these event/action rules (actually, two rules for each
    dependency). So, instead of letting the computer figure out what
    to do based on the dependencies, the user has to manually
    translate the dependencies into simple event/action rules. Also,
    because the dependency information has never been encoded it is
    not available at runtime, effectively meaning that an
    administrator who tries to figure our <i>why</i> something
    happened, i.e. why a is started when b is started, has no chance
    of finding that out.</p>

    <p>Furthermore, the event logic turns around all dependencies,
    from the feet onto their head. Instead of <i>minimizing</i> the
    amount of work (which is something that a good init system should
    focus on, as pointed out in the beginning of this blog story), it
    actually <i>maximizes</i> the amount of work to do during
    operations. Or in other words, instead of having a clear goal and
    only doing the things it really needs to do to reach the goal, it
    does one step, and then after finishing it, it does <b>all</b>
    steps that possibly could follow it.</p>

    <p>Or to put it simpler: the fact that the user just started D-Bus
    is in no way an indication that NetworkManager should be started
    too (but this is what Upstart would do). It's right the other way
    round: when the user asks for NetworkManager, that is definitely
    an indication that D-Bus should be started too (which is certainly
    what most users would expect, right?).</p>

    <p>A good init system should start only what is needed, and that
    on-demand. Either lazily or parallelized and in advance. However
    it should not start more than necessary, particularly not
    everything installed that could use that service.</p>

    <p>Finally, I fail to see the actual usefulness of the event
    logic. It appears to me that most events that are exposed in
    Upstart actually are not punctual in nature, but have duration: a
    service starts, is running, and stops. A device is plugged in, is
    available, and is plugged out again. A mount point is in the
    process of being mounted, is fully mounted, or is being
    unmounted. A power plug is plugged in, the system runs on AC, and
    the power plug is pulled. Only a minority of the events an init
    system or process supervisor should handle are actually punctual,
    most of them are tuples of start, condition, and stop. This
    information is again not available in Upstart, because it focuses
    in singular events, and ignores durable dependencies.</p>

    <p>Now, I am aware that some of the issues I pointed out above are
    in some way mitigated by certain more recent changes in Upstart,
    particularly condition based syntaxes such as <tt>start on
    (local-filesystems and net-device-up IFACE=lo)</tt> in Upstart
    rule files. However, to me this appears mostly as an attempt to
    fix a system whose core design is flawed.</p>

    <p>Besides that Upstart does OK for babysitting daemons, even though
    some choices might be questionable (see above), and there are certainly a lot
    of missed opportunities (see above, too).</p>

    <p>There are other init systems besides sysvinit, Upstart and
    launchd. Most of them offer little substantial more than Upstart or
    sysvinit. The most interesting other contender is Solaris SMF,
    which supports proper dependencies between services. However, in
    many ways it is overly complex and, let's say, a bit <i>academic</i>
    with its excessive use of XML and new terminology for known
    things. It is also closely bound to Solaris specific features such
    as the <i>contract</i> system.</p>

    <h4>Putting it All Together: systemd</h4>

    <p>Well, this is another good time for a little pause, because
    after I have hopefully explained above what I think a good PID 1
    should be doing and what the current most used system does, we'll
    now come to where the beef is. So, go and refill you coffee mug
    again. It's going to be worth it.</p>

    <p>You probably guessed it: what I suggested above as requirements
    and features for an ideal init system is actually available now,
    in a (still experimental) init system called <tt>systemd</tt>, and
    which I hereby want to announce. <a
    href="http://git.0pointer.de/?p=systemd.git">Again, here's the
    code.</a> And here's a quick rundown of its features, and the
    rationale behind them:</p>

    <p>systemd starts up and supervises the entire system (hence the
    name...). It implements all of the features pointed out above and
    a few more. It is based around the notion of <i>units</i>. Units
    have a name and a type. Since their configuration is usually
    loaded directly from the file system, these unit names are
    actually file names. Example: a unit <tt>avahi.service</tt> is
    read from a configuration file by the same name, and of course
    could be a unit encapsulating the Avahi daemon. There are several
    kinds of units:</p>

    <ol>
      <li><tt>service</tt>: these are the most obvious kind of unit:
      daemons that can be started, stopped, restarted, reloaded. For
      compatibility with SysV we not only support our own
      configuration files for services, but also are able to read
      classic SysV init scripts, in particular we parse the LSB
      header, if it exists. <tt>/etc/init.d</tt> is hence not much
      more than just another source of configuration.</li>

      <li><tt>socket</tt>: this unit encapsulates a socket in the
      file-system or on the Internet. We currently support AF_INET,
      AF_INET6, AF_UNIX sockets of the types stream, datagram, and
      sequential packet. We also support classic FIFOs as
      transport. Each <tt>socket</tt> unit has a matching
      <tt>service</tt> unit, that is started if the first connection
      comes in on the socket or FIFO. Example: <tt>nscd.socket</tt>
      starts <tt>nscd.service</tt> on an incoming connection.</li>

      <li><tt>device</tt>: this unit encapsulates a device in the
      Linux device tree. If a device is marked for this via udev
      rules, it will be exposed as a <tt>device</tt> unit in
      systemd. Properties set with <tt>udev</tt> can be used as
      configuration source to set dependencies for device units.</li>

      <li><tt>mount</tt>: this unit encapsulates a mount point in the
      file system hierarchy. systemd monitors all mount points how
      they come and go, and can also be used to mount or
      unmount mount-points. <tt>/etc/fstab</tt> is used here as an
      additional configuration source for these mount points, similar to
      how SysV init scripts can be used as additional configuration
      source for <tt>service</tt> units.</li>

      <li><tt>automount</tt>: this unit type encapsulates an automount
      point in the file system hierarchy. Each <tt>automount</tt>
      unit has a matching <tt>mount</tt> unit, which is started
      (i.e. mounted) as soon as the automount directory is
      accessed.</li>

      <li><tt>target</tt>: this unit type is used for logical
      grouping of units: instead of actually doing anything by itself
      it simply references other units, which thereby can be controlled
      together. Examples for this are: <tt>multi-user.target</tt>,
      which is a target that basically plays the role of run-level 5 on
      classic SysV system, or <tt>bluetooth.target</tt> which is
      requested as soon as a bluetooth dongle becomes available and
      which simply pulls in bluetooth related services that otherwise
      would not need to be started: <tt>bluetoothd</tt> and
      <tt>obexd</tt> and suchlike.</li>

      <li><tt>snapshot</tt>: similar to <tt>target</tt> units
      snapshots do not actually do anything themselves and their only
      purpose is to reference other units. Snapshots can be used to
      save/rollback the state of all services and units of the init
      system. Primarily it has two intended use cases: to allow the
      user to temporarily enter a specific state such as "Emergency
      Shell", terminating current services, and provide an easy way to
      return to the state before, pulling up all services again that
      got temporarily pulled down. And to ease support for system
      suspending: still many services cannot correctly deal with
      system suspend, and it is often a better idea to shut them down
      before suspend, and restore them afterwards.</li>
    </ol>

    <p>All these units can have dependencies between each other (both
    positive and negative, i.e. 'Requires' and 'Conflicts'): a device
    can have a dependency on a service, meaning that as soon as a
    device becomes available a certain service is started. Mounts get
    an implicit dependency on the device they are mounted from. Mounts
    also gets implicit dependencies to mounts that are their prefixes
    (i.e. a mount <tt>/home/lennart</tt> implicitly gets a dependency
    added to the mount for <tt>/home</tt>) and so on. </p>

    <p>A short list of other features:</p>

    <ol>
      <li>For each process that is spawned, you may control: the
      environment, resource limits, working and root directory, umask,
      OOM killer adjustment, nice level, IO class and priority, CPU policy
      and priority, CPU affinity, timer slack, user id, group id,
      supplementary group ids, readable/writable/inaccessible
      directories, shared/private/slave mount flags,
      capabilities/bounding set, secure bits, CPU scheduler reset of
      fork, private <tt>/tmp</tt> name-space, cgroup control for
      various subsystems. Also, you can easily connect
      stdin/stdout/stderr of services to syslog, <tt>/dev/kmsg</tt>,
      arbitrary TTYs. If connected to a TTY for input systemd will make
      sure a process gets exclusive access, optionally waiting or enforcing
      it.</li>

      <li>Every executed process gets its own cgroup (currently by
      default in the debug subsystem, since that subsystem is not
      otherwise used and does not much more than the most basic
      process grouping), and it is very easy to configure systemd to
      place services in cgroups that have been configured externally,
      for example via the libcgroups utilities.</li>

      <li>The native configuration files use a syntax that closely
      follows the well-known <tt>.desktop</tt> files. It is a simple syntax for
      which parsers exist already in many software frameworks. Also, this
      allows us to rely on existing tools for i18n for service
      descriptions, and similar. Administrators and developers don't
      need to learn a new syntax.</li>

      <li>As mentioned, we provide compatibility with SysV init
      scripts. We take advantages of LSB and Red Hat chkconfig headers
      if they are available. If they aren't we try to make the best of
      the otherwise available information, such as the start
      priorities in <tt>/etc/rc.d</tt>. These init scripts are simply
      considered a different source of configuration, hence an easy
      upgrade path to proper systemd services is available. Optionally
      we can read classic PID files for services to identify the main
      pid of a daemon. Note that we make use of the dependency
      information from the LSB init script headers, and translate
      those into native systemd dependencies. Side note: Upstart is
      unable to harvest and make use of that information. Boot-up on a
      plain Upstart system with mostly LSB SysV init scripts will
      hence not be parallelized, a similar system running systemd
      however will. In fact, for Upstart all SysV scripts together
      make one job that is executed, they are not treated
      individually, again in contrast to systemd where SysV init
      scripts are just another source of configuration and are all
      treated and controlled individually, much like any other native
      systemd service.</li>

      <li>Similarly, we read the existing <tt>/etc/fstab</tt>
      configuration file, and consider it just another source of
      configuration. Using the <tt>comment=</tt> fstab option you can
      even mark <tt>/etc/fstab</tt> entries to become <tt>systemd</tt>
      controlled automount points.</li>

      <li>If the same unit is configured in multiple configuration
      sources (e.g. <tt>/etc/systemd/system/avahi.service</tt> exists,
      and <tt>/etc/init.d/avahi</tt> too), then the native
      configuration will always take precedence, the legacy format is
      ignored, allowing an easy upgrade path and packages to carry
      both a SysV init script and a systemd service file for a
      while.</li>

      <li>We support a simple templating/instance mechanism. Example:
      instead of having six configuration files for six gettys, we
      only have one <tt>getty@.service</tt> file which gets instantiated to
      <tt>getty@tty2.service</tt> and suchlike. The interface part can
      even be inherited by dependency expressions, i.e. it is easy to
      encode that a service <tt>dhcpcd@eth0.service</tt> pulls in
      <tt>avahi-autoipd@eth0.service</tt>, while leaving the
      <tt>eth0</tt> string wild-carded.</li>

      <li>For socket activation we support full compatibility with the
      traditional inetd modes, as well as a very simple mode that
      tries to mimic launchd socket activation and is recommended for
      new services. The inetd mode only allows passing one socket to
      the started daemon, while the native mode supports passing
      arbitrary numbers of file descriptors. We also support one
      instance per connection, as well as one instance for all
      connections modes. In the former mode we name the cgroup the
      daemon will be started in after the connection parameters, and
      utilize the templating logic mentioned above for this. Example:
      <tt>sshd.socket</tt> might spawn services
      <tt>sshd@192.168.0.1-4711-192.168.0.2-22.service</tt> with a
      cgroup of <tt>sshd@.service/192.168.0.1-4711-192.168.0.2-22</tt>
      (i.e. the IP address and port numbers are used in the instance
      names. For AF_UNIX sockets we use PID and user id of the
      connecting client). This provides a nice way for the
      administrator to identify the various instances of a daemon and
      control their runtime individually. The native socket passing
      mode is very easily implementable in applications: if
      <tt>$LISTEN_FDS</tt> is set it contains the number of sockets
      passed and the daemon will find them sorted as listed in the
      <tt>.service</tt> file, starting from file descriptor 3 (a
      nicely written daemon could also use <tt>fstat()</tt> and
      <tt>getsockname()</tt> to identify the sockets in case it
      receives more than one). In addition we set <tt>$LISTEN_PID</tt>
      to the PID of the daemon that shall receive the fds, because
      environment variables are normally inherited by sub-processes and
      hence could confuse processes further down the chain. Even
      though this socket passing logic is very simple to implement in
      daemons, we will provide a BSD-licensed reference implementation
      that shows how to do this. We have ported a couple of existing
      daemons to this new scheme.</li>

      <li>We provide compatibility with <tt>/dev/initctl</tt> to a
      certain extent. This compatibility is in fact implemented with a
      FIFO-activated service, which simply translates these legacy
      requests to D-Bus requests. Effectively this means the old
      <tt>shutdown</tt>, <tt>poweroff</tt> and similar commands from
      Upstart and <tt>sysvinit</tt> continue to work with
      systemd.</li>

      <li>We also provide compatibility with <tt>utmp</tt> and
      <tt>wtmp</tt>. Possibly even to an extent that is far more
      than healthy, given how crufty <tt>utmp</tt> and <tt>wtmp</tt>
      are.</li>

      <li>systemd supports several kinds of
      dependencies between units. <tt>After</tt>/<tt>Before</tt> can be used to fix
      the ordering how units are activated. It is completely
      orthogonal to <tt>Requires</tt> and <tt>Wants</tt>, which
      express a positive requirement dependency, either mandatory, or
      optional. Then, there is <tt>Conflicts</tt> which
      expresses a negative requirement dependency. Finally, there are
      three further, less used dependency types.</li>

      <li>systemd has a minimal transaction system. Meaning: if a unit
      is requested to start up or shut down we will add it and all its
      dependencies to a temporary <i>transaction</i>. Then, we will
      verify if the transaction is consistent (i.e. whether the
      ordering via <tt>After</tt>/<tt>Before</tt> of all units is
      cycle-free). If it is not, systemd will try to fix it up, and
      removes non-essential jobs from the transaction that might
      remove the loop. Also, systemd tries to suppress non-essential
      jobs in the transaction that would stop a running
      service. Non-essential jobs are those which the original request
      did not directly include but which where pulled in by
      <tt>Wants</tt> type of dependencies. Finally we check whether
      the jobs of the transaction contradict jobs that have already
      been queued, and optionally the transaction is aborted then. If
      all worked out and the transaction is consistent and minimized
      in its impact it is merged with all already outstanding jobs and
      added to the run queue. Effectively this means that before
      executing a requested operation, we will verify that it makes
      sense, fixing it if possible, and only failing if it really cannot
      work.</li>

      <li>We record start/exit time as well as the PID and exit status
      of every process we spawn and supervise. This data can be used
      to cross-link daemons with their data in abrtd, auditd and
      syslog. Think of an UI that will highlight crashed daemons for
      you, and allows you to easily navigate to the respective UIs for
      syslog, abrt, and auditd that will show the data generated from
      and for this daemon on a specific run.</li>

      <li>We support reexecution of the init process itself at any
      time. The daemon state is serialized before the reexecution and
      deserialized afterwards. That way we provide a simple way to
      facilitate init system upgrades as well as handover from an
      initrd daemon to the final daemon. Open sockets and autofs
      mounts are properly serialized away, so that they stay
      connectible all the time, in a way that clients will not even
      notice that the init system reexecuted itself. Also, the fact
      that a big part of the service state is encoded anyway in the
      cgroup virtual file system would even allow us to resume
      execution without access to the serialization data. The
      reexecution code paths are actually mostly the same as the init
      system configuration reloading code paths, which
      guarantees that reexecution (which is probably more seldom
      triggered) gets similar testing as reloading (which is probably
      more common).</li>

      <li>Starting the work of removing shell scripts from the boot
      process we have recoded part of the basic system setup in C and
      moved it directly into systemd. Among that is mounting of the API
      file systems (i.e. virtual file systems such as <tt>/proc</tt>,
      <tt>/sys</tt> and <tt>/dev</tt>.) and setting of the
      host-name.</li>

      <li>Server state is introspectable and controllable via
      D-Bus. This is not complete yet but quite extensive.</li>

      <li>While we want to emphasize socket-based and bus-name-based
      activation, and we hence support dependencies between sockets and
      services, we also support traditional inter-service
      dependencies. We support multiple ways how such a service can
      signal its readiness: by forking and having the start process
      exit (i.e. traditional <tt>daemonize()</tt> behaviour), as well
      as by watching the bus until a configured service name appears.</li>

      <li>There's an interactive mode which asks for confirmation each
      time a process is spawned by systemd. You may enable it by
      passing <tt>systemd.confirm_spawn=1</tt> on the kernel command
      line.</li>

      <li>With the <tt>systemd.default=</tt> kernel command line
      parameter you can specify which unit systemd should start on
      boot-up. Normally you'd specify something like
      <tt>multi-user.target</tt> here, but another choice could even
      be a single service instead of a target, for example
      out-of-the-box we ship a service <tt>emergency.service</tt> that
      is similar in its usefulness as <tt>init=/bin/bash</tt>, however
      has the advantage of actually running the init system, hence
      offering the option to boot up the full system from the
      emergency shell.</li>

      <li>There's a minimal UI that allows you to
      start/stop/introspect services. It's far from complete but
      useful as a debugging tool. It's written in Vala (yay!) and goes
      by the name of <tt>systemadm</tt>.</li>

    </ol>

    <p>It should be noted that systemd uses many Linux-specific
    features, and does not limit itself to POSIX. That unlocks a lot
    of functionality a system that is designed for portability to
    other operating systems cannot provide.</p>

    <h4>Status</h4>

    <p>All the features listed above are already implemented. Right
    now systemd can already be used as a drop-in replacement for
    Upstart and sysvinit (at least as long as there aren't too many
    native upstart services yet. Thankfully most distributions don't
    carry too many native Upstart services yet.)</p>

    <p>However, testing has been minimal, our version number is
    currently at an impressive 0. Expect breakage if you run this in
    its current state. That said, overall it should be quite stable
    and some of us already boot their normal development systems with
    systemd (in contrast to VMs only). YMMV, especially if you try
    this on distributions we developers don't use.</p>

    <h4>Where is This Going?</h4>

    <p>The feature set described above is certainly already
    comprehensive. However, we have a few more things on our plate. I
    don't really like speaking too much about big plans but here's a
    short overview in which direction we will be pushing this:</p>

    <p>We want to add at least two more unit types: <tt>swap</tt>
    shall be used to control swap devices the same way we
    already control mounts, i.e. with automatic dependencies on the
    device tree devices they are activated from, and
    suchlike. <tt>timer</tt> shall provide functionality similar to
    <tt>cron</tt>, i.e. starts services based on time events, the
    focus being both monotonic clock and wall-clock/calendar
    events. (i.e. "start this 5h after it last ran" as well as "start
    this every monday 5 am")</p>

    <p>More importantly however, it is also our plan to experiment with
    systemd not only for optimizing boot times, but also to make it
    the ideal session manager, to replace (or possibly just augment)
    <tt>gnome-session</tt>, <tt>kdeinit</tt> and similar daemons. The problem set of a
    session manager and an init system are very similar: quick start-up
    is essential and babysitting processes the focus. Using the same
    code for both uses hence suggests itself. Apple recognized that
    and does just that with launchd. And so should we: socket and bus
    based activation and parallelization is something session services
    and system services can benefit from equally.</p>

    <p>I should probably note that all three of these features are
    already partially available in the current code base, but not
    complete yet. For example, already, you can run systemd just fine
    as a normal user, and it will detect that is run that way and
    support for this mode has been available since the very beginning,
    and is in the very core. (It is also exceptionally useful for
    debugging! This works fine even without having the system
    otherwise converted to systemd for booting.)</p>

    <p>However, there are some things we probably should fix in the
    kernel and elsewhere before finishing work on this: we
    need swap status change notifications from the kernel similar to
    how we can already subscribe to mount changes; we want a
    notification when CLOCK_REALTIME jumps relative to
    CLOCK_MONOTONIC; we want to allow <a
    href="http://lkml.org/lkml/2010/2/2/165">normal processes to get
    some init-like powers</a>; we need a <a
    href="http://lists.freedesktop.org/archives/xdg/2010-April/011446.html">well-defined
    place where we can put user sockets</a>. None of these issues are
    really essential for systemd, but they'd certainly improve
    things.</p>

    <h4>You Want to See This in Action?</h4>

    <p>Currently, there are no tarball releases, but it should be
    straightforward to check out the code <a
    href="http://git.0pointer.de/?p=systemd.git">from our
    repository</a>. In addition, to have something to start with, <a
    href="http://0pointer.de/public/etc-systemd-system.tar.gz">here's
    a tarball with unit configuration files</a> that allows an
    otherwise unmodified Fedora 13 system to work with systemd. We
    have no RPMs to offer you for now.</p>

    <p>An easier way is to download <a href="http://surfsite.org/f13-systemd-livecd.torrent">this Fedora 13 qemu image</a>, which
    has been prepared for systemd. In the grub menu you can select
    whether you want to boot the system with Upstart or systemd. Note
    that this system is minimally modified only. Service information
    is read exclusively from the existing SysV init scripts. Hence it
    will not take advantage of the full socket and bus-based
    parallelization pointed out above, however it will interpret the
    parallelization hints from the LSB headers, and hence boots faster
    than the Upstart system, which in Fedora does not employ any
    parallelization at the moment. The image is configured to output
    debug information on the serial console, as well as writing it to
    the kernel log buffer (which you may access with <tt>dmesg</tt>).
    You might want to run <tt>qemu</tt> configured with a virtual
    serial terminal. All passwords are set to <tt>systemd</tt>.</p>

    <p>Even simpler than downloading and booting the qemu image is
    looking at pretty screen-shots. Since an init system usually is
    well hidden beneath the user interface, some shots of
    <tt>systemadm</tt> and <tt>ps</tt> must do:</p>

    <p><img src="http://0pointer.de/public/systemadm.png" width="1057" height="881" alt="systemadm"/></p>

    <p>That's systemadm showing all loaded units, with more detailed
    information on one of the getty instances.</p>

    <p><img src="http://0pointer.de/public/pscgroups.png" width="1057" height="881" alt="ps"/></p>

    <p>That's an excerpt of the output of <tt>ps xaf -eo
    pid,user,args,cgroup</tt> showing how neatly the processes are
    sorted into the cgroup of their service. (The fourth column is the
    cgroup, the <tt>debug:</tt> prefix is shown because we use the
    debug cgroup controller for systemd, as mentioned earlier. This is
    only temporary.)</p>

    <p>Note that both of these screenshots show an only minimally
    modified Fedora 13 Live CD installation, where services are
    exclusively loaded from the existing SysV init scripts. Hence,
    this does not use socket or bus activation for any existing
    service.</p>

    <p>Sorry, no bootcharts or hard data on start-up times for the
    moment. We'll publish that as soon as we have fully parallelized
    all services from the default Fedora install. Then, we'll welcome
    you to benchmark the systemd approach, and provide our own
    benchmark data as well.</p>

    <p>Well, presumably everybody will keep bugging me about this, so
    here are two numbers I'll tell you. However, they are completely
    unscientific as they are measured for a VM (single CPU) and by
    using the stop timer in my watch. Fedora 13 booting up with
    Upstart takes 27s, with systemd we reach 24s (from grub to gdm,
    same system, same settings, shorter value of two bootups, one
    immediately following the other). Note however that this shows
    nothing more than the speedup effect reached by using the LSB
    dependency information parsed from the init script headers for
    parallelization. Socket or bus based activation was not utilized
    for this, and hence these numbers are unsuitable to assess the
    ideas pointed out above. Also, systemd was set to debug verbosity
    levels on a serial console. So again, this benchmark data has
    barely any value.</p>

    <h4>Writing Daemons</h4>

    <p>An ideal daemon for use with systemd does a few things
    differently then things were traditionally done. Later on, we will
    publish a longer guide explaining and suggesting how to write a daemon for use
    with this systemd. Basically, things get simpler for daemon
    developers:</p>

    <ul>
      <li>We ask daemon writers not to fork or even double fork
      in their processes, but run their event loop from the initial process
      systemd starts for you. Also, don't call <tt>setsid()</tt>.</li>

      <li>Don't drop user privileges in the daemon itself, leave this
      to systemd and configure it in systemd service configuration
      files. (There are exceptions here. For example, for some daemons
      there are good reasons to drop privileges inside the daemon
      code, after an initialization phase that requires elevated
      privileges.)</li>

      <li>Don't write PID files</li>

      <li>Grab a name on the bus</li>

      <li>You may rely on systemd for logging, you are welcome to log
      whatever you need to log to stderr.</li>

      <li>Let systemd create and watch sockets for you, so that socket
      activation works. Hence, interpret <tt>$LISTEN_FDS</tt> and
      <tt>$LISTEN_PID</tt> as described above.</li>

      <li>Use SIGTERM for requesting shut downs from your daemon.</li>

    </ul>

    <p>The list above is very similar to what <a
    href="http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPSystemStartup/Articles/LaunchOnDemandDaemons.html">Apple
    recommends for daemons compatible with launchd</a>. It should be
    easy to extend daemons that already support launchd
    activation to support systemd activation as well.</p>

    <p>Note that systemd supports daemons not written in this style
    perfectly as well, already for compatibility reasons (launchd has
    only limited support for that). As mentioned, this even extends to
    existing inetd capable daemons which can be used unmodified for
    socket activation by systemd.</p>

    <p>So, yes, should systemd prove itself in our experiments and get
    adopted by the distributions it would make sense to port at least
    those services that are started by default to use socket or
    bus-based activation. <a
    href="http://people.freedesktop.org/~kay/LISTEN_FDS/">We have
    written proof-of-concept patches</a>, and the porting turned out
    to be very easy. Also, we can leverage the work that has already
    been done for launchd, to a certain extent. Moreover, adding
    support for socket-based activation does not make the service
    incompatible with non-systemd systems.</p>

    <h4 id="faqs">FAQs</h4>

    <dl>

      <dt>Who's behind this?</dt>

      <dd>Well, the current code-base is mostly my work, Lennart
      Poettering (Red Hat). However the design in all its details is
      result of close cooperation between Kay Sievers (Novell) and
      me. Other people involved are Harald Hoyer (Red Hat), Dhaval
      Giani (Formerly IBM), and a few others from various
      companies such as Intel, SUSE and Nokia.</dd>

      <dt>Is this a Red Hat project?</dt>

      <dd>No, this is my personal side project. Also, let me emphasize
      this: <i>the opinions reflected here are my own. They are not
      the views of my employer, or Ronald McDonald, or anyone
      else.</i></dd>

      <dt>Will this come to Fedora?</dt>

      <dd>If our experiments prove that this approach works out, and
      discussions in the Fedora community show support for this, then
      yes, we'll certainly try to get this into Fedora.</dd>

      <dt>Will this come to OpenSUSE?</dt>

      <dd>Kay's pursuing that, so something similar as for Fedora applies here, too.</dd>

      <dt>Will this come to Debian/Gentoo/Mandriva/MeeGo/Ubuntu/[insert your favourite distro here]?</dt>

      <dd>That's up to them. We'd certainly welcome their interest, and help with the integration.</dd>

      <dt>Why didn't you just add this to Upstart, why did you invent something new?</dt>

      <dd>Well, the point of the part about Upstart above was to show
      that the core design of Upstart is flawed, in our
      opinion. Starting completely from scratch suggests itself if the
      existing solution appears flawed in its core. However, note that
      we took a lot of inspiration from Upstart's code-base
      otherwise.</dd>

      <dt>If you love Apple launchd so much, why not adopt that?</dt>

      <dd>launchd is a great invention, but I am not convinced that it
      would fit well into Linux, nor that it is suitable for a system
      like Linux with its immense scalability and flexibility to
      numerous purposes and uses.</dd>

      <dt>Is this an <a href="http://en.wikipedia.org/wiki/Not_Invented_Here">NIH</a> project?</dt>

      <dd>Well, I hope that I managed to explain in the text above why
      we came up with something new, instead of building on Upstart or
      launchd. We came up with systemd due to technical
      reasons, not political reasons.</dd>

      <dd>Don't forget that it is Upstart that includes
      <a href="https://launchpad.net/libnih">a library called NIH</a>
      (which is kind of a reimplementation of glib) -- not systemd!</dd>

      <dt>Will this run on [insert non-Linux OS here]?</dt>

      <dd>Unlikely. As pointed out, systemd uses many Linux specific
      APIs (such as epoll, signalfd, libudev, cgroups, and numerous
      more), a port to other operating systems appears to us as not
      making a lot of sense. Also, we, the people involved are
      unlikely to be interested in merging possible ports to other
      platforms and work with the constraints this introduces. That said,
      git supports branches and rebasing quite well, in case
      people really want to do a port.</dd>

      <dd>Actually portability is even more limited than just to other OSes: we require a very
      recent Linux kernel, glibc, libcgroup and libudev.  No support for
      less-than-current Linux systems, sorry.</dd>

      <dd>If folks want to implement something similar for other
      operating systems, the preferred mode of cooperation is probably
      that we help you identify which interfaces can be shared with
      your system, to make life easier for daemon writers to support
      both systemd and your systemd counterpart. Probably, the focus should be
      to share interfaces, not code.</dd>

      <dt>I hear [fill one in here: the Gentoo boot system, initng,
      Solaris SMF, runit, uxlaunch, ...] is an awesome init system and
      also does parallel boot-up, so why not adopt that?</dt>

      <dd>Well, before we started this we actually had a very close
      look at the various systems, and none of them did what we had in
      mind for systemd (with the exception of launchd, of course). If
      you cannot see that, then please read again what I wrote
      above.</dd>

<!--      <dt>First you <a href="http://pulseaudio.org/">break my
      audio</a>, and now you want to corrupt my boot?</dt>

      <dd>Yes. And don't forget that I am also responsible for <a
      href="http://avahi.org/">crucifying your network</a>. I am
      coming after you! Muhahahaha!</dd>-->

    </dl>

    <h4 id="contributions">Contributions</h4>

    <p>We are very interested in patches and help. It should be common
    sense that every Free Software project can only benefit from the
    widest possible external contributions. That is particularly true
    for a core part of the OS, such as an init system. We value your
    contributions and hence do not require copyright assignment (<a
    href="http://www.ebb.org/bkuhn/blog/2010/02/01/copyright-not-all-equal.html">Very
    much unlike Canonical/Upstart</a>!). And also, we use git,
    everybody's favourite VCS, yay!</p>

    <p>We are particularly interested in help getting systemd to work
    on other distributions, besides Fedora and OpenSUSE. (Hey, anybody
    from Debian, Gentoo, Mandriva, MeeGo looking for something to do?)
    But even beyond that we are keen to attract contributors on every
    level: we welcome C hackers, packagers, as well as folks who are interested
    to write documentation, or contribute a logo.</p>

    <h4 id="community">Community</h4>

    <p>At this time we only have <a
    href="http://git.0pointer.de/?p=systemd.git">source code
    repository</a> and an IRC channel (<tt>#systemd</tt> on
    Freenode). There's no mailing list, web site or bug tracking
    system. We'll probably set something up on freedesktop.org
    soon. If you have any questions or want to contact us otherwise we
    invite you to join us on IRC!</p>

    <p><b>Update: <a href="http://0pointer.de/blog/projects/systemd-website.html">our GIT repository has moved.</a></b></p>


]]></description>
   <category domain="http://0pointer.de/blog">/projects</category>
   <pubDate>Fri, 30 Apr 2010 08:46 GMT</pubDate>
</item>
<item>
   <title>A Few Notes on Bloom Filters</title>
   <guid isPermaLink="false">projects/bloom</guid>
   <link>http://0pointer.de/blog/projects/bloom.html</link>
   <description><![CDATA[

<p>For future reference (mostly for myself), here's a little summary of how to
use <a href="http://en.wikipedia.org/wiki/Bloom_filter">Bloom filters</a> in
real world applications.</p>

<p>Most references are terse and vague on how to pick the hash functions for
bloom filters, so here's some detail about that: For small filters, just use a
boring and fast hash function like the <a
href="http://www.google.com/codesearch?q=djb+hash+function&amp;hl=en">djb hash
function</a> and split up the 32bit result into smaller independent chunks for
each of the k hash indexes you'll need. Often those 32 bits already provide
enough hash bits to get enough independent bloom filter indexes. And if they
don't you basically have three options:</p>

<ul>
<li>Use multiple different hash functions, and then <a
href="http://sites.google.com/site/murmurhash/">MurmurHash</a> seems to be a
very good choice. It's simple, readily usable code (even in C, though the
reference implementation claims to be C++), and properly licensed. It is a hash
function that takes a seed parameter which can be used to create as many
independent hash functions as needed.</li>

<li>Use a cryptographic hash function. Most of them can be implemented really
fast on modern CPUs and are already available in some library you use anyway.
SHA512 for example outputs plenty bits you can split into k chunks as you need
them for your k bloom filter indexes. (Of course, if you are afraid of US
export regulations this might be a choice you want to avoid.)</li>

<li>Use two independent hash functions and combine <a
href="http://www.eecs.harvard.edu/~kirsch/pubs/bbbf/esa06.pdf">them
linearly</a>.</li>
</ul>

<p>The size of the bloom filter and the number of hash functions you should be
using depending on your application can be calculated using the formulas on the
Wikipedia page:</p>

<p><tt>m = -n*ln(p)/(ln(2)^2)</tt></p>

<p>This will tell you the number of bits m to use for your filter, given the
number n of elements in your filter and the false positive probability p you
want to achieve. All that for the ideal number of hash functions k which you
can calculate like this:</p>

<p><tt>k = 0.7*m/n</tt></p>

<p>And that's already everything you need to know to build good bloom filters.
If you know the p and n for your use case the above will tell you the m and k, and
how to choose the k hash functions.</p>

<p>Bloom filters are a really really useful tool, and given their simplicity
something every developer should be aware of.</p>

<p>(And in case you were wondering what this all is about, Kay Sievers and I
were discussing using bloom filters in the libudev netlink BSD socket filters,
to allow monitoring a certain subset of devices that is orthogonal to the usual
subsystem hierarchy, and all that in a way where the number of wakeups in
listening clients is minimized)</p>

]]></description>
   <category domain="http://0pointer.de/blog">/projects</category>
   <pubDate>Tue, 20 Apr 2010 20:01 GMT</pubDate>
</item>
<item>
   <title>Down the Amazon II</title>
   <guid isPermaLink="false">photos/amazon2</guid>
   <link>http://0pointer.de/blog/photos/amazon2.html</link>
   <description><![CDATA[

<p>As a followup to <a href="http://0pointer.de/blog/photos/amazon.html">this
blog story</a> here are a couple of non-panorama shots from the trip:</p>

<p>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=206"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-206.jpg" alt="Image 206" width="120" height="80"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=144"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-144.jpg" alt="Image 144" width="120" height="80"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=142"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-142.jpg" alt="Image 142" width="120" height="80"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=113"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-113.jpg" alt="Image 113" width="120" height="80"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=96"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-96.jpg" alt="Image 96" width="120" height="80"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=897"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-897.jpg" alt="Image 897" width="120" height="80"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=91"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-91.jpg" alt="Image 91" width="120" height="80"/></a>
</p>
<p>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=751"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-751.jpg" alt="Image 751" width="120" height="80"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=112"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-112.jpg" alt="Image 112" width="120" height="80"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=72"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-72.jpg" alt="Image 72" width="120" height="80"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=131"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-131.jpg" alt="Image 131" width="120" height="80"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=233"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-233.jpg" alt="Image 233" width="120" height="80"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=488"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-488.jpg" alt="Image 488" width="120" height="80"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=249"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-249.jpg" alt="Image 249" width="120" height="80"/></a>
</p>
<p>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=272"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-272.jpg" alt="Image 272" width="120" height="80"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=356"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-356.jpg" alt="Image 356" width="120" height="80"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=393"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-393.jpg" alt="Image 393" width="120" height="80"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=234"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-234.jpg" alt="Image 234" width="120" height="80"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=435"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-435.jpg" alt="Image 435" width="120" height="80"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=450"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-450.jpg" alt="Image 450" width="120" height="80"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=485"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-485.jpg" alt="Image 485" width="120" height="80"/></a>
</p>
<p>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=60"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-60.jpg" alt="Image 60" width="120" height="80"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=502"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-502.jpg" alt="Image 502" width="120" height="80"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=753"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-753.jpg" alt="Image 753" width="120" height="80"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=822"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-822.jpg" alt="Image 822" width="120" height="80"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=951"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-951.jpg" alt="Image 951" width="120" height="80"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=960"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-960.jpg" alt="Image 960" width="120" height="80"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=85"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-85.jpg" alt="Image 85" width="120" height="80"/></a>
</p>
<p>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=199"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-199.jpg" alt="Image 199" width="80" height="120"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=653"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-653.jpg" alt="Image 653" width="80" height="120"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=194"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-194.jpg" alt="Image 194" width="80" height="120"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=164"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-164.jpg" alt="Image 164" width="80" height="120"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=89"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-89.jpg" alt="Image 89" width="80" height="120"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=231"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-231.jpg" alt="Image 231" width="80" height="120"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=240"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-240.jpg" alt="Image 240" width="80" height="120"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=263"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-263.jpg" alt="Image 263" width="80" height="120"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=685"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-685.jpg" alt="Image 685" width="80" height="120"/></a>
</p>
<p>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=331"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-331.jpg" alt="Image 331" width="80" height="120"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=334"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-334.jpg" alt="Image 334" width="80" height="120"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=337"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-337.jpg" alt="Image 337" width="80" height="120"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=389"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-389.jpg" alt="Image 389" width="80" height="120"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=537"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-537.jpg" alt="Image 537" width="80" height="120"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=570"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-570.jpg" alt="Image 570" width="80" height="120"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=582"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-582.jpg" alt="Image 582" width="80" height="120"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=197"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-197.jpg" alt="Image 197" width="80" height="120"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=655"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-655.jpg" alt="Image 655" width="80" height="120"/></a>
</p>
<p>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=660"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-660.jpg" alt="Image 660" width="80" height="120"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=108"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-108.jpg" alt="Image 108" width="80" height="120"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=697"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-697.jpg" alt="Image 697" width="80" height="120"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=710"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-710.jpg" alt="Image 710" width="80" height="120"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=747"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-747.jpg" alt="Image 747" width="80" height="120"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=705"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-705.jpg" alt="Image 705" width="80" height="120"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=776"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-776.jpg" alt="Image 776" width="80" height="120"/></a>
<a href="http://0pointer.de/photos/?gallery=Amazon%202010-03&amp;photo=832"><img src="http://0pointer.de/photos/galleries/Amazon%202010-03/thumbs/img-832.jpg" alt="Image 832" width="80" height="120"/></a>
</p>

]]></description>
   <category domain="http://0pointer.de/blog">/photos</category>
   <pubDate>Sat, 03 Apr 2010 22:59 GMT</pubDate>
</item>
<item>
   <title>Down the Amazon</title>
   <guid isPermaLink="false">photos/amazon</guid>
   <link>http://0pointer.de/blog/photos/amazon.html</link>
   <description><![CDATA[

<p>After <a href="http://0pointer.de/blog/projects/bossa2010.html">BOSSA in
Manaus/Brazil</a> we took a very enjoyable boat trip down the Amazon, to
Santar&eacute;m and particularly Alter do Ch&atilde;o, a ridiculously amazing
island paradise with glaring white sand in the middle of the jungle:</p>

<p><a href="http://0pointer.de/static/tapajos2"><img style="border: 10px solid #232729; background-color: #6b6c6; padding: 1px; -moz-border-radius: 7px; margin: 0.5cm" src="http://0pointer.de/static/tapajos2-gimped-small.jpeg" width="1024" height="188" alt="Tapajos 2"/></a></p>

<p>The town is located on the Tapaj&oacute;s River:</p>

<p><a href="http://0pointer.de/static/tapajos1"><img style="border: 10px solid #232729; background-color: #6b6c6; padding: 1px; -moz-border-radius: 7px; margin: 0.5cm" src="http://0pointer.de/static/tapajos1-gimped-small.jpeg" width="1024" height="155" alt="Tapajos 1"/></a></p>

<p><a href="http://0pointer.de/static/tapajos3"><img style="border: 10px solid #232729; background-color: #6b6c6; padding: 1px; -moz-border-radius: 7px; margin: 0.5cm" src="http://0pointer.de/static/tapajos3-gimped-small.jpeg" width="1024" height="184" alt="Tapajos 3"/></a></p>

<p>Up the river you find the Tapaj&oacute;s National Forest:</p>

<p><a href="http://0pointer.de/static/tapajos4"><img style="border: 10px solid #232729; background-color: #6b6c6; padding: 1px; -moz-border-radius: 7px; margin: 0.5cm" src="http://0pointer.de/static/tapajos4-gimped-small.jpeg" width="1024" height="231" alt="Tapajos 4"/></a></p>

<p>From there we went on to S&atilde;o Lu&iacute;s, a beautiful old colonial town:</p>

<p><a href="http://0pointer.de/static/saoluis1"><img style="border: 10px solid #232729; background-color: #6b6c6; padding: 1px; -moz-border-radius: 7px; margin: 0.5cm" src="http://0pointer.de/static/saoluis1-gimped-small.jpeg" width="1024" height="168" alt="Sao Luis 1"/></a></p>
<p><a href="http://0pointer.de/static/saoluis3"><img style="border: 10px solid #232729; background-color: #6b6c6; padding: 1px; -moz-border-radius: 7px; margin: 0.5cm" src="http://0pointer.de/static/saoluis3-gimped-small.jpeg" width="1024" height="255" alt="Sao Luis 3"/></a></p>
<p><a href="http://0pointer.de/static/saoluis4"><img style="border: 10px solid #232729; background-color: #6b6c6; padding: 1px; -moz-border-radius: 7px; margin: 0.5cm" src="http://0pointer.de/static/saoluis4-gimped-small.jpeg" width="1024" height="172" alt="Sao Luis 4"/></a></p>
<p><a href="http://0pointer.de/static/saoluis2"><img style="border: 10px solid #232729; background-color: #6b6c6; padding: 1px; -moz-border-radius: 7px; margin: 0.5cm" src="http://0pointer.de/static/saoluis2-gimped-small.jpeg" width="1024" height="288" alt="Sao Luis 2"/></a></p>

<p>A windy and wet sailing catamaran ride from S&atilde;o Lu&iacute;s you find Alc&acirc;ntara, another old colonial town, now partly in ruins and deserted:</p>

<p><a href="http://0pointer.de/static/alcantara1"><img style="border: 10px solid #232729; background-color: #6b6c6; padding: 1px; -moz-border-radius: 7px; margin: 0.5cm" src="http://0pointer.de/static/alcantara1-gimped-small.jpeg" width="1024" height="159" alt="Alcantara 1"/></a></p>
<p><a href="http://0pointer.de/static/alcantara2"><img style="border: 10px solid #232729; background-color: #6b6c6; padding: 1px; -moz-border-radius: 7px; margin: 0.5cm" src="http://0pointer.de/static/alcantara2-gimped-small.jpeg" width="1024" height="186" alt="Alcantara 2"/></a></p>
<p><a href="http://0pointer.de/static/alcantara3"><img style="border: 10px solid #232729; background-color: #6b6c6; padding: 1px; -moz-border-radius: 7px; margin: 0.5cm" src="http://0pointer.de/static/alcantara3-gimped-small.jpeg" width="1024" height="151" alt="Alcantara 3"/></a></p>



]]></description>
   <category domain="http://0pointer.de/blog">/photos</category>
   <pubDate>Sat, 03 Apr 2010 20:25 GMT</pubDate>
</item>
<item>
   <title>Public Service Announcement: Beware of rsvg_term()!</title>
   <guid isPermaLink="false">projects/beware-of-rsvg-term</guid>
   <link>http://0pointer.de/blog/projects/beware-of-rsvg-term.html</link>
   <description><![CDATA[

<p>As a short followup on <a href="http://0pointer.de/blog/projects/beware-of-xmlCleanupParser">an older blog posting of mine</a>:</p>

<p>So you are using librsvg's <tt>rsvg_term()</tt> in your code?  If so then
you are probably misusing it and triggering crashes in PulseAudio related code.
The same way everybody should stop using libxml2's <tt>xmlCleanupParser()</tt>
call, stop using <tt>rsvg_term()</tt>! It's really hard to use it correctly,
and uneeded anyway. <a
href="https://bugzilla.gnome.org/show_bug.cgi?id=592100">Also see this bug
report.</a></p>

]]></description>
   <category domain="http://0pointer.de/blog">/projects</category>
   <pubDate>Tue, 23 Mar 2010 20:29 GMT</pubDate>
</item>
<item>
   <title>Bossa 2010/Manaus Slides</title>
   <guid isPermaLink="false">projects/bossa2010</guid>
   <link>http://0pointer.de/blog/projects/bossa2010.html</link>
   <description><![CDATA[

<p>The slides for my talk about the audio infrastructure of Linux mobile
devices at <a href="http://bossaconference.indt.org/">BOSSA 2010</a> in Manaus/Brazil <a
href="http://0pointer.de/public/pulse-bossa2010.pdf">are now available
online</a>. They are terse (as usual), and the most interesting stuff is
probably in what I said, and not so much in what I wrote in those slides.  But
nonetheless I believe this might still be quite interesting for attendees as
well as non-attendees.</p>

<p>The talk focuses on the audio architecture of the Nokia N900 and the Palm
Pre, and of course particularly their use of <a
href="http://pulseaudio.org">PulseAudio</a> for all things audio. I analyzed
and compared their patch sets to figure out what their priorities are, what we
should move into PulseAudio mainline, and what should better be left in their
private patch sets.</p>

]]></description>
   <category domain="http://0pointer.de/blog">/projects</category>
   <pubDate>Tue, 09 Mar 2010 18:04 GMT</pubDate>
</item>
<item>
   <title>Measure Your Sound Card!</title>
   <guid isPermaLink="false">projects/decibel-data</guid>
   <link>http://0pointer.de/blog/projects/decibel-data.html</link>
   <description><![CDATA[

<p>In recent versions <a href="http://pulseaudio.org/">PulseAudio</a>
integrates the <a href="http://people.redhat.com/alexl/files/why-alsa-sucks.png">numerous mixer
elements ALSA exposes</a> into one single powerful slider which tries to make
the best of the granularity and range of the hardware and extends that in
software so that we can provide an equally powerful slider on all systems.
That means if your hardware only supports a limited volume range (many
integrated USB speakers for example cannot be completely muted with the
hardware volume slider), limited granularity (some hardware sliders only have 8
steps or so), or no per-channel volumes (many sound cards have a single slider
that covers all channels), then PulseAudio tries its best to make use of the
next hardware volume slider in the pipeline to compensate for that, and so on,
finally falling back to software for everything that cannot be done in
hardware. <a href="http://pulseaudio.org/wiki/PulseAudioStoleMyVolumes">This is
explained in more detail here.</a></p>

<p>Now this algorithm depends on that we know the actual attenuation factors
(factors like that are usually written in units of dB which is why I will call
this the "dB data" from now on) of the hardware volume controls. Thankfully
ALSA includes that information in its driver interfaces. However for some
hardware this data is not reliable. For example, one of my own cards (a
Terratec Aureon 5.1 MkII USB) contains invalid dB data in its USB descriptor
and ALSA passes that on to PulseAudio. The effect of that is that the
PulseAudio volume control behaves very weirdly for this card, in a way that the
volume "jumps" and changes in unexpected ways (or doesn't change at all in some
ranges!) when you slowly move the slider, or that the volume is completely
muted over large ranges of the slider where it should not be. Also this breaks the
<i>flat volume</i> logic in PulseAudo, to the result that playing one stream
(let's say a music stream) and then adding a second one (let's say an event
sound) might incorrectly attenuate the first one (i.e. whenever you play an
event sound the music changes in volume).</p>

<p>Incorrect dB data is not a new problem. However PulseAudio is the first
application that actually depends on the correctness of this data. Previously
the dB info was shown as auxiliary information in some volume controls, and
only noticed and understood by very few, technical people. It was not used for
further calculations.</p>

<p>Now, the reasons I am writing this blog posting are firstly to inform you
about this type of bug and the results it has on the logic PulseAudio
implements, and secondly (and more importantly) to point you to <a
href="http://pulseaudio.org/wiki/BadDecibel">this little Wiki page</a> I wrote
that explains how to verify if this is indeed a problem on your card (in case
you are experiencing any of the symptoms mentioned above) and secondly what to
do to improve the situation, and how to get correct dB data that can be
included as quirk in your driver.</p>

<p>Thank you for your attention.</p>

]]></description>
   <category domain="http://0pointer.de/blog">/projects</category>
   <pubDate>Wed, 24 Feb 2010 00:49 GMT</pubDate>
</item>
<item>
   <title>Horizontal Panoramas Are So 2009!</title>
   <guid isPermaLink="false">photos/brussels-cathedral</guid>
   <link>http://0pointer.de/blog/photos/brussels-cathedral.html</link>
   <description><![CDATA[

<p>Horizontal panoramas are so 2009 -- which is why I now give you the <i>vertical panorama</i>:</p>

<p><a href="http://0pointer.de/static/cathedral"><img style="border: 10px solid #232729; background-color: #6b6c6; padding: 1px; -moz-border-radius: 7px; margin: 0.5cm" src="http://0pointer.de/static/cathedral-gimped-small.jpeg" width="1024" height="266" alt="Brussels Cathedral"/></a></p>

<p>Now if I wasn't too stupid to hold my camera steady shooting upwards, this could actually have been a really good picture.</p>

]]></description>
   <category domain="http://0pointer.de/blog">/photos</category>
   <pubDate>Sun, 21 Feb 2010 01:31 GMT</pubDate>
</item>
<item>
   <title>Speaker Setup</title>
   <guid isPermaLink="false">projects/speaker-setup</guid>
   <link>http://0pointer.de/blog/projects/speaker-setup.html</link>
   <description><![CDATA[

<p>While tracking down some surround sound related bugs I was missing a speaker
setup and testing utility. So I decided to do something about it and I present you <a
href="http://git.0pointer.de/?p=gnome-speaker-setup.git">gnome-speaker-setup</a>:</p>

<img src="http://0pointer.de/public/gnome-speaker-setup.png" width="729" height="736" alt="gnome-speaker-setup"/>

<p>The tool should be very robust and even deal with the weirdest channel
mappings. OTOH the artwork is not really good and appropriate. But I hope it still shows some resemblance to <a
href="http://people.fedoraproject.org/~hadess/gnome-volume-control/multi-speaker/drivers1.gif">other</a>
<a
href="http://people.fedoraproject.org/~hadess/gnome-volume-control/multi-speaker/3.jpg">UIs</a>
of this type. If you are an artist wand want to contribute better artwork make
sure to go through the <a
href="http://live.gnome.org/GnomeArt/ArtRequests/">Gnome Art Requests</a> page,
and more specifically <a
href="http://live.gnome.org/GnomeArt/ArtRequests/issue22">this particular
request</a>.</p>

<p>This (or something like it) will hopefully and eventually end up in some way
or another in gnome-media. Until that day comes I'll maintain this tool independently.</p>

<p>To compile this you need a recent <a
href="http://live.gnome.org/Vala">Vala</a> and <a
href="http://0pointer.de/lennart/projects/libcanberra/">libcanberra
0.23</a>.</p>

]]></description>
   <category domain="http://0pointer.de/blog">/projects</category>
   <pubDate>Sat, 20 Feb 2010 23:58 GMT</pubDate>
</item>
<item>
   <title>India, 360 Degrees at a Time, Part Seven</title>
   <guid isPermaLink="false">photos/india-360-at-a-time-7</guid>
   <link>http://0pointer.de/blog/photos/india-360-at-a-time-7.html</link>
   <description><![CDATA[

<p>Here's the seventh and <a href="http://0pointer.de/blog/photos/india-360-at-a-time-1.html">final</a> <a href="http://0pointer.de/blog/photos/india-360-at-a-time-2.html">part</a> <a href="http://0pointer.de/blog/photos/india-360-at-a-time-3.html">of</a> <a href="http://0pointer.de/blog/photos/india-360-at-a-time-4.html">my</a> <a href="http://0pointer.de/blog/photos/india-360-at-a-time-5.html">ongoing</a> <a href="http://0pointer.de/blog/photos/india-360-at-a-time-6.html">series</a>.</p>

<p>One of the grandest sights in Delhi is <a href="http://en.wikipedia.org/wiki/Humayun%27s_Tomb">Humayun's tomb</a>, a predecessor of the greatest mausoleum of them all, the <a href="http://0pointer.de/static/tajmahal2.html">Taj Mahal</a>:</p>

<p><a href="http://0pointer.de/static/delhi3"><img alt="Humayun's Tomb" style="border: 10px solid #232729; background-color: #6b6c6; padding: 1px; -moz-border-radius: 7px; margin: 0.5cm" src="http://0pointer.de/static/delhi3-gimped-small.jpeg" width="1024" height="174"/></a></p>

<p>A little bit further down a view on the garden:</p>

<p><a href="http://0pointer.de/static/delhi4"><img alt="Humayun's Tomb" style="border: 10px solid #232729; background-color: #6b6c6; padding: 1px; -moz-border-radius: 7px; margin: 0.5cm" src="http://0pointer.de/static/delhi4-gimped-small.jpeg" width="1024" height="177"/></a></p>

<p>From a different corner:</p>

<p><a href="http://0pointer.de/static/delhi2"><img alt="Humayun's Tomb" style="border: 10px solid #232729; background-color: #6b6c6; padding: 1px; -moz-border-radius: 7px; margin: 0.5cm" src="http://0pointer.de/static/delhi2-gimped-small.jpeg" width="1024" height="159"/></a></p>

<p>We'll finish with our last panorama that shows the courtyard the <a href="http://en.wikipedia.org/wiki/Jama_Masjid,_Delhi">Jama Masjid</a> of Old Delhi:</p>

<p><a href="http://0pointer.de/static/delhi5"><img alt="Jama Masjid" style="border: 10px solid #232729; background-color: #6b6c6; padding: 1px; -moz-border-radius: 7px; margin: 0.5cm" src="http://0pointer.de/static/delhi5-gimped-small.jpeg" width="1024" height="183"/></a></p>

<p>That's all panoramas from this trip. Thanks for your interest.</p>

]]></description>
   <category domain="http://0pointer.de/blog">/photos</category>
   <pubDate>Tue, 19 Jan 2010 20:43 GMT</pubDate>
</item>
<item>
   <title>India, 360 Degrees at a Time, Part Six</title>
   <guid isPermaLink="false">photos/india-360-at-a-time-6</guid>
   <link>http://0pointer.de/blog/photos/india-360-at-a-time-6.html</link>
   <description><![CDATA[

<p>Here's the sixth <a href="http://0pointer.de/blog/photos/india-360-at-a-time-1.html">part</a> <a href="http://0pointer.de/blog/photos/india-360-at-a-time-2.html">of</a> <a href="http://0pointer.de/blog/photos/india-360-at-a-time-3.html">my</a> <a href="http://0pointer.de/blog/photos/india-360-at-a-time-4.html">ongoing</a> <a href="http://0pointer.de/blog/photos/india-360-at-a-time-5.html">series</a>.</p>

<p>Leaving Jodhpur we continued our journey to <a href="http://en.wikipedia.org/wiki/Jaisalmer">Jaisalmer</a>, a sand castle of a town in the <a href="http://en.wikipedia.org/wiki/Thar_Desert">Thar desert</a>:</p>

<p><a href="http://0pointer.de/static/jaisalmer2"><img alt="Jaisalmer" style="border: 10px solid #232729; background-color: #6b6c6; padding: 1px; -moz-border-radius: 7px; margin: 0.5cm" src="http://0pointer.de/static/jaisalmer2-gimped-small.jpeg" width="1024" height="213"/></a></p>

<p>In the vicinity of Jaisalmer you'll find cliche sand dunes like you'd expect from a grown-up desert:</p>

<p><a href="http://0pointer.de/static/jaisalmer1"><img alt="Jaisalmer" style="border: 10px solid #232729; background-color: #6b6c6; padding: 1px; -moz-border-radius: 7px; margin: 0.5cm" src="http://0pointer.de/static/jaisalmer1-gimped-small.jpeg" width="1024" height="194"/></a></p>

<p>Our next station after a long, cold and dusty train ride was <a href="http://en.wikipedia.org/wiki/Delhi">Delhi</a>. The principal mosque of Old Delhi is the <a href="http://en.wikipedia.org/wiki/Jama_Masjid,_Delhi">Jama Masjid</a>:</p>

<p><a href="http://0pointer.de/static/delhi1"><img alt="Jama Masjid" style="border: 10px solid #232729; background-color: #6b6c6; padding: 1px; -moz-border-radius: 7px; margin: 0.5cm" src="http://0pointer.de/static/delhi1-gimped-small.jpeg" width="1024" height="183"/></a></p>

<p>That's all for now, tomorrow I'll post the rest of my panoramas from this trip, all from Delhi.</p>

]]></description>
   <category domain="http://0pointer.de/blog">/photos</category>
   <pubDate>Mon, 18 Jan 2010 21:14 GMT</pubDate>
</item>
<item>
   <title>India, 360 Degrees at a Time, Part Five</title>
   <guid isPermaLink="false">photos/india-360-at-a-time-5</guid>
   <link>http://0pointer.de/blog/photos/india-360-at-a-time-5.html</link>
   <description><![CDATA[

<p>Here's the fourth part <a href="http://0pointer.de/blog/photos/india-360-at-a-time-1.html">of</a> <a href="http://0pointer.de/blog/photos/india-360-at-a-time-2.html">my</a> <a href="http://0pointer.de/blog/photos/india-360-at-a-time-3.html">ongoing</a> <a href="http://0pointer.de/blog/photos/india-360-at-a-time-4.html">series</a>.</p>

<p>After Udaipur the next stop on our trip was <a href="http://en.wikipedia.org/wiki/Jodhpur">Jodhpur</a>, the blue city. Which is called that way due of the blue colour of many of its houses:</p>

<p><a href="http://0pointer.de/static/jodhpur2"><img alt="Jodhpur" style="border: 10px solid #232729; background-color: #6b6c6; padding: 1px; -moz-border-radius: 7px; margin: 0.5cm" src="http://0pointer.de/static/jodhpur2-gimped-small.jpeg" width="1024" height="159"/></a></p>

<p>On a hill next to <a href="http://en.wikipedia.org/wiki/Mehrangarh_Fort">Mehrangarh Fort</a>, one of the biggest Forts in India (the big sand castle on the hill in the panorama above), you find the <a href="http://en.wikipedia.org/wiki/Jaswant_Thada">Jaswant Thada</a>, a memorial of the Maharajas of Jodhpur:</p>

<p><a href="http://0pointer.de/static/jodhpur1"><img alt="Jodhpur" style="border: 10px solid #232729; background-color: #6b6c6; padding: 1px; -moz-border-radius: 7px; margin: 0.5cm" src="http://0pointer.de/static/jodhpur1-gimped-small.jpeg" width="1024" height="235"/></a></p>

<p>Inside the fort you'll find highly decorated courtyards:</p>

<p><a href="http://0pointer.de/static/jodhpur3"><img alt="Jodhpur" style="border: 10px solid #232729; background-color: #6b6c6; padding: 1px; -moz-border-radius: 7px; margin: 0.5cm" src="http://0pointer.de/static/jodhpur3-gimped-small.jpeg" width="1024" height="247"/></a></p>

<p>That's all for Jodhpur, tomorrow I'll post more panoramas, from other stops of our trip.</p>

]]></description>
   <category domain="http://0pointer.de/blog">/photos</category>
   <pubDate>Sun, 17 Jan 2010 17:43 GMT</pubDate>
</item>
<item>
   <title>India, 360 Degrees at a Time, Part Four</title>
   <guid isPermaLink="false">photos/india-360-at-a-time-4</guid>
   <link>http://0pointer.de/blog/photos/india-360-at-a-time-4.html</link>
   <description><![CDATA[

<p>Here's the fourth part of <a href="http://0pointer.de/blog/photos/india-360-at-a-time-1.html">my</a> <a href="http://0pointer.de/blog/photos/india-360-at-a-time-2.html">ongoing</a> <a href="http://0pointer.de/blog/photos/india-360-at-a-time-3.html">series</a>.</p>

<p>After Hampi we went to Bangalore to attend <a
href="http://foss.in/">foss.in</a>. (Fantastic conference, btw. The concerts at
the venue are unparalleled.) From there we flew up to <a
href="http://en.wikipedia.org/wiki/Udaipur">Udaipur</a>, in Rajasthan. Udaipur
is (among other things) famous for being the place where the central scenes of <a
href="http://en.wikipedia.org/wiki/Octopussy">Octopussy</a> were filmed.
Octopussy's famous white palace is on Jagniwas Island in Lake Pichola:</p>

<p><a href="http://0pointer.de/static/udaipur1"><img alt="Udaipur" style="border: 10px solid #232729; background-color: #6b6c6; padding: 1px; -moz-border-radius: 7px; margin: 0.5cm" src="http://0pointer.de/static/udaipur1-gimped-small.jpeg" width="1024" height="70"/></a></p>

<p>This panorama was taken from another island in the lake, Jagmandir Island, which is visible in the following shot on the left:</p>

<p><a href="http://0pointer.de/static/udaipur2"><img alt="Udaipur" style="border: 10px solid #232729; background-color: #6b6c6; padding: 1px; -moz-border-radius: 7px; margin: 0.5cm" src="http://0pointer.de/static/udaipur2-gimped-small.jpeg" width="1024" height="150"/></a></p>

<p>Udaipur's scenery, seen from the Maharaja's City Palace down onto Pichola Lake:</p>

<p><a href="http://0pointer.de/static/udaipur3"><img alt="Udaipur" style="border: 10px solid #232729; background-color: #6b6c6; padding: 1px; -moz-border-radius: 7px; margin: 0.5cm" src="http://0pointer.de/static/udaipur3-gimped-small.jpeg" width="1024" height="175"/></a></p>

<p>That's all for Udaipur, tomorrow I'll post more panoramas, from other stops of our trip.</p>

]]></description>
   <category domain="http://0pointer.de/blog">/photos</category>
   <pubDate>Sat, 16 Jan 2010 02:10 GMT</pubDate>
</item>
<item>
   <title>Announcing udev-browse</title>
   <guid isPermaLink="false">projects/udev-browse</guid>
   <link>http://0pointer.de/blog/projects/udev-browse.html</link>
   <description><![CDATA[

<p>It's easy to get lost in <tt>/sys</tt> and not much fun typing long
<tt>udevadm info</tt> command lines all the time. Today, when I had enough of
that I sat down and spent an hour to write a little UI for exploring the
udev/sysfs tree: <tt>udev-browse</tt>. I wrote it for my own use, but I am quite sure I am not the only
one who wants a little bit simpler access to the device tree. <a
href="http://git.0pointer.de/?p=udev-browse.git">So here you go.</a></p>

<p>And since everybody loves screenshots here you go:</p>

<p><a href="http://0pointer.de/public/udev-browse"><img src="http://0pointer.de/public/udev-browse" width="931" height="728" alt="udev-browse" style="border: 0px"/></a></p>

<p>Two usability hints: if you run <tt>udev-browse</tt> from a directory in
<tt>/sys</tt> <tt>udev-browse</tt> will automatically present the device of
that path on startup. And if you know the name of a device you can just type it
into the device listbox (which is focussed by default). The usual Gtk+ live
search will then find you the right entry right-away. It's pretty nifty.</p>

<p>It's written in Vala with minimal dependencies.</p>

<p>I want to keep the maintainership burden for this minimal. So no tarballs, no releases, and I won't reply to your emails regarding this tool, unless they include a good, clean, git formatted patch. Thank you for your understanding.</p>

<p>Anyone wants to package this for Fedora? I'd be very thankful if someone would pick it up.</p>

<p>Have fun.</p>

]]></description>
   <category domain="http://0pointer.de/blog">/projects</category>
   <pubDate>Sat, 16 Jan 2010 01:19 GMT</pubDate>
</item>
<item>
   <title>India, 360 Degrees at a Time, Part Three</title>
   <guid isPermaLink="false">photos/india-360-at-a-time-3</guid>
   <link>http://0pointer.de/blog/photos/india-360-at-a-time-3.html</link>
   <description><![CDATA[

<p>Here's the third part of my <a href="http://0pointer.de/blog/photos/india-360-at-a-time-1.html">ongoing</a> <a href="http://0pointer.de/blog/photos/india-360-at-a-time-2.html">series</a>.</p>

<p>Still in Hampi here's another 360 from the Hills in Hampi down to the Achyutaraya Temple:</p>

<p><a href="http://0pointer.de/static/hampi5"><img alt="Matanga Hill" style="border: 10px solid #232729; background-color: #6b6c6; padding: 1px; -moz-border-radius: 7px; margin: 0.5cm" src="http://0pointer.de/static/hampi5-gimped-small.jpeg" width="1024" height="234"/></a></p>

<p>A little further down, before dawn, here's a shot from the rocky path leading up the hill:</p>

<p><a href="http://0pointer.de/static/hampi6"><img alt="Matanga Hill" style="border: 10px solid #232729; background-color: #6b6c6; padding: 1px; -moz-border-radius: 7px; margin: 0.5cm" src="http://0pointer.de/static/hampi6-gimped-small.jpeg" width="1024" height="250"/></a></p>

<p>Our last picture for today is a view down from Hemakuta Hill which is
covered with old temples and other structures. In the middle you'll see the
large <a href="http://en.wikipedia.org/wiki/Virupaksha_Temple">Virupaksha
Temple</a> which is still in full use. In that temple you'll find an amazing <a
href="http://en.wikipedia.org/wiki/Camera_obscura">camera obscura</a>, a
physics teacher's dream that projects the temple tower onto a wall (<a
href="http://0pointer.de/photos/?gallery=India%20Karnataka%202009-11&amp;photo=871">projection</a>,
<a
href="http://0pointer.de/photos/?gallery=India%20Karnataka%202009-11&amp;photo=865">subject</a>, more interesting in reality. Really.)</p>

<p><a href="http://0pointer.de/static/hampi8"><img alt="Hemakuta Hill" style="border: 10px solid #232729; background-color: #6b6c6; padding: 1px; -moz-border-radius: 7px; margin: 0.5cm" src="http://0pointer.de/static/hampi8-gimped-small.jpeg" width="1024" height="155"/></a></p>

<p>That's all for Hampi, tomorrow I'll post more panoramas, from other stops of our trip.</p>

]]></description>
   <category domain="http://0pointer.de/blog">/photos</category>
   <pubDate>Thu, 14 Jan 2010 22:47 GMT</pubDate>
</item>
<item>
   <title>Public Service Announcement: Beware of xmlCleanupParser()!</title>
   <guid isPermaLink="false">projects/beware-of-xmlCleanupParser</guid>
   <link>http://0pointer.de/blog/projects/beware-of-xmlCleanupParser.html</link>
   <description><![CDATA[

<p>Everyone and his dog seem to call libxml2's xmlCleanupParser() at
inappropriate places. For example <a
href="https://bugzilla.redhat.com/show_bug.cgi?id=532307">Empathy</a> does it,
and Abiword does it too. <a href="http://www.google.com/codesearch?q=xmlCleanupParser">Google Code Search</a> seems to reveal at least Inkscape and Dia
do it as well.</p>

<p>So, please, if your project links against libxml2 verify that it calls
xmlCleanupParser() only once, and right before exiting! And if it calls it more
often or somewhere else, then please fix that!</p>

<p>For more information <a
href="http://lists.fedoraproject.org/pipermail/devel/2010-January/129117.html">see
my post on fedora-devel</a>.</p>

<p>Thanks for your time.</p>

]]></description>
   <category domain="http://0pointer.de/blog">/projects</category>
   <pubDate>Tue, 12 Jan 2010 23:29 GMT</pubDate>
</item>
<item>
   <title>India, 360 Degrees at a Time, Part Two</title>
   <guid isPermaLink="false">photos/india-360-at-a-time-2</guid>
   <link>http://0pointer.de/blog/photos/india-360-at-a-time-2.html</link>
   <description><![CDATA[

<p>Here's the second part of my <a href="http://0pointer.de/blog/photos/india-360-at-a-time-1.html">ongoing series</a>.</p>

<p>Climbing down the hills, on the banks of the Tungabhadra river you find people washing laundry and bathing, and <a href="http://0pointer.de/photos/?gallery=India%20Karnataka%202009-11&amp;photo=1434">coracles</a> waiting to be used for a trip through the river.</p>

<p><a href="http://0pointer.de/static/hampi2"><img alt="Tungabhadra River" style="border: 10px solid #232729; background-color: #6b6c6; padding: 1px; -moz-border-radius: 7px; margin: 0.5cm" src="http://0pointer.de/static/hampi2-gimped-small.jpeg" width="1024" height="146"/></a></p>

<p>The greatest of the ancient temples in Hampi is the <a href="http://en.wikipedia.org/wiki/Vijayanagara#Vittala_Temple">Vitthala Temple</a>:</p>

<p><a href="http://0pointer.de/static/hampi3"><img alt="Vitthala Temple" style="border: 10px solid #232729; background-color: #6b6c6; padding: 1px; -moz-border-radius: 7px; margin: 0.5cm" src="http://0pointer.de/static/hampi3-gimped-small.jpeg" width="1024" height="162"/></a></p>

<p>Set in in lush green scenery you find the Achyutaraya Temple, which you already might have seen, from above, in <a href="http://0pointer.de/static/hampi7">yesterday's series</a>:</p>

<p><a href="http://0pointer.de/static/hampi4"><img alt="Achyutaraya Temple" style="border: 10px solid #232729; background-color: #6b6c6; padding: 1px; -moz-border-radius: 7px; margin: 0.5cm" src="http://0pointer.de/static/hampi4-gimped-small.jpeg" width="1024" height="164"/></a></p>

<p>That's it for today, tomorrow I'll post more panoramas, both from Hampi and other stops of our trip.</p>

]]></description>
   <category domain="http://0pointer.de/blog">/photos</category>
   <pubDate>Tue, 12 Jan 2010 18:05 GMT</pubDate>
</item>
<item>
   <title>India, 360 Degrees at a Time, Part One</title>
   <guid isPermaLink="false">photos/india-360-at-a-time-1</guid>
   <link>http://0pointer.de/blog/photos/india-360-at-a-time-1.html</link>
   <description><![CDATA[

<p>Yes, I won't spare you my panorama shots from my recent trip to India. After
arriving in Goa <a href="http://en.wikipedia.org/wiki/Badami">Badami</a> was
our next stop. It's a very pretty little town in northern Karnataka, and here's
a panorama shot from the entrance of the town's famous caves:</p>

<p><a href="http://0pointer.de/static/badami1"><img alt="Badami" style="border: 10px solid #232729; background-color: #6b6c6; padding: 1px; -moz-border-radius: 7px; margin: 0.5cm" src="http://0pointer.de/static/badami1-gimped-small.jpeg" width="1024" height="324"/></a></p>

<p>Next step was one of the most amazing places on earth, <a
href="http://en.wikipedia.org/wiki/Hampi">Hampi</a> in central Karnataka. It
is definitely one of the greatest sights I have ever seen, and I guess I can
say I have seen quite a few in my life. A vast landscape of hills covered in
boulders, lush mango and banana plantations, rice fields, dotted with age-old
temples and impressive ruins. Locals crossing the river in <a href="http://0pointer.de/photos/?gallery=India%20Karnataka%202009-11&amp;photo=1434">coracles</a> that look
like they belong in a time centuries ago. Women washing colourful laundry in
the river, pilgrims wading across the river in their black clothes.  An India
that delivers every bit of that promise it makes to its visitors.  The ruins
rival the grand sites in Greece and the landscape sometimes looks like a
Crysis in-game scene.</p>

<p>Taken from one of the hills in Hampi this is the sunset:</p>

<p><a href="http://0pointer.de/static/hampi1"><img alt="Hampi Sunset" style="border: 10px solid #232729; background-color: #6b6c6; padding: 1px; -moz-border-radius: 7px; margin: 0.5cm" src="http://0pointer.de/static/hampi1-gimped-small.jpeg" width="1024" height="122"/></a></p>

<p>And then, the next day at dawn make your way up the hills again and you can get an even greater view on the whole scenery:</p>

<p><a href="http://0pointer.de/static/hampi7"><img alt="Hampi Dawn" style="border: 10px solid #232729; background-color: #6b6c6; padding: 1px; -moz-border-radius: 7px; margin: 0.5cm" src="http://0pointer.de/static/hampi7-gimped-small.jpeg" width="1024" height="200"/></a></p>

<p>That's it for today, tomorrow I'll post more panoramas, both from Hampi and other stops of our trip.</p>

<p>Also, if you haven't seen them yet, don't miss <a href="http://0pointer.de/blog/photos/india-again.html">my panoramas from my India trip the year before</a>.</p>

]]></description>
   <category domain="http://0pointer.de/blog">/photos</category>
   <pubDate>Mon, 11 Jan 2010 19:56 GMT</pubDate>
</item>
<item>
   <title>Jodhpur After Dark</title>
   <guid isPermaLink="false">photos/jodhpur</guid>
   <link>http://0pointer.de/blog/photos/jodhpur.html</link>
   <description><![CDATA[

<div> <a
href="http://0pointer.de/photos/?gallery=India%20Rajasthan%202009-12&amp;photo=1536"><img
src="http://0pointer.de/photos/galleries/India%20Rajasthan%202009-12/lq/img-1536.jpg"
width="320" height="480" alt="Jodhpur"/></a>&nbsp;<a
href="http://0pointer.de/photos/?gallery=India%20Rajasthan%202009-12&amp;photo=1505"><img
src="http://0pointer.de/photos/galleries/India%20Rajasthan%202009-12/lq/img-1505.jpg"
width="320" height="480" alt="Jodhpur"/></a>&nbsp;<a
href="http://0pointer.de/photos/?gallery=India%20Rajasthan%202009-12&amp;photo=1526"><img
src="http://0pointer.de/photos/galleries/India%20Rajasthan%202009-12/lq/img-1526.jpg"
width="320" height="480" alt="Jodhpur"/></a> </div>

<p>India is a weird and beautiful country. And I am too lazy to retouch my photos.</p>

]]></description>
   <category domain="http://0pointer.de/blog">/photos</category>
   <pubDate>Thu, 31 Dec 2009 15:33 GMT</pubDate>
</item>
<item>
   <title>On OOM</title>
   <guid isPermaLink="false">projects/on-oom</guid>
   <link>http://0pointer.de/blog/projects/on-oom.html</link>
   <description><![CDATA[

<p>Building on what <a href="http://log.ometer.com/2008-02.html#4.2">Havoc
wrote two years ago about the fallacies of OOM safety (Out Of Memory) in user code</a> I'd
like to point you to <a
href="http://article.gmane.org/gmane.comp.audio.jackit/19998">this little mail
I just posted to jack-devel</a> which tries to give you the bigger picture.
Should be interesting for non-audio folks, too.</p>

<p>Say <b>NO</b> to OOM safety!</p>

]]></description>
   <category domain="http://0pointer.de/blog">/projects</category>
   <pubDate>Fri, 13 Nov 2009 01:25 GMT</pubDate>
</item>
<item>
   <title>Public Service Announcement</title>
   <guid isPermaLink="false">projects/no-more-dmidecode</guid>
   <link>http://0pointer.de/blog/projects/no-more-dmidecode.html</link>
   <description><![CDATA[

<p>Folks! Since quite some time now the kernel exports the DMI machine
information below <tt>/sys/class/dmi/id/</tt>. You may stop now parsing the
output of <tt>dmidecode</tt> thus depending on external tools and privileged
code.</p>

<p>For example, to read your BIOS vendor string all you need to do is this:</p>

<pre>$ read bv &lt; /sys/class/dmi/id/bios_vendor
$ echo $bv</pre>

<p>Which is of course much simpler, and cleaner, and safer than anything involving <tt>dmidecode</tt>.</p>

<p>Thank you for your time!</p>


]]></description>
   <category domain="http://0pointer.de/blog">/projects</category>
   <pubDate>Fri, 06 Nov 2009 10:14 GMT</pubDate>
</item>
</channel>
</rss>
