OpenBSD Journal

g2k16 Hackathon Report: Christian Weisgerber on gettext progress, RTC work, removing kernel cruft

Contributed by rueda on from the the raw and the texted dept.

Next up in our series of g2k16 hackathon reports is Christian Weisgerber, who writes:

Another hackathon, another devel/gettext update. This proved to be disappointingly routine and after some other, equally uneventful port updates, I turned my attention to the kernel.
Previously, the kernel would update the RTC ("CMOS clock") only (a) when the time was set hard with clock_settime(2) or settimeofday(2), (b) before suspend, and (c) when the system was properly shut down. The first of these never happens for a typical ntpd setup. This meant that if a machine had been running for months and lost power, the RTC had sometimes drifted away, and when the machine came back up again, the system time could be significantly off, causing all sorts of trouble. (Reader exercise: Consider the situations where ntpd -s is insufficient.) Inspired by FreeBSD, I implemented a simple fix to sync the system time back to the RTC every 30 minutes. My first patch to tech@, sent the better part of a year ago, had been pointedly criticized by kettenis@, and I finally sat down in Cambridge to learn some more about the kernel infrastructure, get the missing pieces and details right, ultimately fixing this rare but annoying problem.

Having added something to the kernel, I was then ready to remove something: block devices for tapes. Don't be alarmed! If you use a tape drive with dump/restore, tar, mt, and so on, you access it through the character ("raw") device. Block devices are only used for mount(8)ing a file system, a practice people stopped applying to tapes by the end of the 1980s. An inherent problem with ancient cruft is that you can't remove it if you have forgotten its very existence! I received a recent reminder when a user on another operating system fell into the trap of accidentally trying to use the block device to read a tape, resulting in weird errors. Uprooting this particular tree stump was straightforward but educational. I even resorted to "The Design and Implementation of the 4.4BSD Operating System" to find the entry point for the conversion of major device numbers to kernel routines (hint: bdevsw) and these are clearly parts of the kernel that have changed little in a very long time. Regarding the device nodes in /dev, a brief opinion poll led to the decision to simply remove the block devices (e.g. /dev/st0) and leave the character device names untouched (e.g. /dev/rst0), so _PATH_DEFTAPE and user habits wouldn't need to change, even if the 'r' for "raw" had now become meaningless. I guess many people already thought it stood for "rewinding" anyway.

Overall, I'm reasonably happy with what I managed to accomplish during the hackathon, and I got to cross another item off my bucket list: traveling the Euro^H^H^H^HChannel tunnel by train.

Thanks for the report, Christian!

(Comments are closed)

  1. By Martin Natano (natano) on

    Yay for removing tape block devices!


Copyright © - Daniel Hartmeier. All rights reserved. Articles and comments are copyright their respective authors, submission implies license to publish on this web site. Contents of the archive prior to as well as images and HTML templates were copied from the fabulous original with Jose's and Jim's kind permission. This journal runs as CGI with httpd(8) on OpenBSD, the source code is BSD licensed. undeadly \Un*dead"ly\, a. Not subject to death; immortal. [Obs.]