BSD Planet * BSD People

September 02, 2010

FreeBSD Diary

3Ware Nagios plugin

I liked it, but I wanted more

September 02, 2010 11:48 PM

September 01, 2010

Hubertf's NetBSD Blog

BSD Professional (BSDP) Certification Exam Objectives published

In its mission to create certifications for BSD Un*x systems, the BSD Certification Group has now published the "BSD Professional" (BSDP) certification exam objectives:

`` The 78 page document outlines 11 knowledge domains, each containing a number of objectives, that form the basis of the certification. The document, a collaborative effort by members of the BSD community, is a followup effort to the BSDP Job Task Analysis report published earlier this year.

"The BSDP Certification Requirements Document provides a comprehensive set of objectives that a BSD Professional should master, ranging from general system administration to advanced security and system maintenance," said Babak Farrokhi, a seasoned BSD administrator and author of 'Network Administration with FreeBSD 7'.

Set to launch in 2011, the BSD Professional certification exam has been in development for over two years. Since the launch of the BSD Associate exam in 2008, there has been a continual effort to put together a certification for the next level of achievement for BSD system administrators.

"The BSD Professional certification is aimed at assessing practical skills of senior level BSD system administrators," said Jim Brown, BSDCG board member. "With the publication of these objectives, the BSD Certification Group is aiming to produce a high quality certification, giving the computing industry a new standard for excellence in system administration."

The BSDP Requirements document is available as a downloadable PDF in English''

The publication of the BSDP exam objectives is the next step after the BSD Associate (BSDA) certification exam objectives were published in 2005, which was then followed by quite a number of successful BSDA certifications. See the BSD Certification group's website for more details!

September 01, 2010 09:28 PM

August 29, 2010

FreeBSD Diary

Where is my SCSI card?

Things are hidden right before your eyes

August 29, 2010 11:48 PM

August 20, 2010

FreeBSD Diary

cssh - cluster ssh

Sometimes you need more than one

August 20, 2010 12:48 AM

August 16, 2010

Hubertf's NetBSD Blog

New NetBSD Core Team announced

NetBSD's core team is responsible for technical steering of the project. In the past the group was five people, and it was increased to seven people now. Read more in Alistair Crooks' announcement:

``We take great pleasure in announcing that the NetBSD core team, responsible for technical management within the NetBSD project, has increased its numbers to seven. This is to help in the running of a project with an ever-growing source base and developer community, and mirrors a similar change made to the board of directors, which has worked extremely well.

To help with the running of the project, we have asked Antti Kantee (pooka%NetBSD.org@localhost) and Chuck Silvers (chs%NetBSD.org@localhost), and they have very kindly agreed to join the core team. Antti is well known to many both inside and outside the project, and has contributed many new and exciting ideas, the most memorable and useful of these being the rump kernel architecture. Chuck is also well-known in NetBSD circles - his work on UBC, and his recent update of the Linux emulation code are just two examples of his contributions.

We therefore thank them both for their outstanding work to date, and to their joining the core team to lead and guide progress in the future.

For the current core team:

August 16, 2010 10:30 PM

August 09, 2010

Hubertf's NetBSD Blog

Of course it runs ... 2.11BSD (or: PDP-11 in a FPGA)

It's about time NetBSD gets the PDP11 port done: the PDP-11/70 CPU core is now available as implementation on a FPGA-board, and there's need for a newer operating system than 2.11BSD! Citing from the homepage:

``The project contains a complete PDP-11 system: a 11/70 CPU with memory management unit, but without floating point unit, a basic set of UNIBUS peripherals (DL11, LP11, PC11, RK11/RK05), and last but not least a cache and memory controllers for SRAM and PSRAM. The design is FPGA proven, runs currently on Digilent S3BOARD and NEXYS2 boards and boots 5th Edition UNIX and 2.11BSD UNIX. ''

August 09, 2010 10:55 PM

August 08, 2010

Hubertf's NetBSD Blog

Janitorial code maintenance with coccinelle (Updated)

According to its homepage, coccinelle is ``a program matching and transformation engine which provides the language SmPL (Semantic Patch Language) for specifying desired matches and transformations in C code. Coccinelle was initially targeted towards performing collateral evolutions in Linux. Such evolutions comprise the changes that are needed in client code in response to evolutions in library APIs, and may include modifications such as renaming a function, adding a function argument whose value is somehow context-dependent, and reorganizing a data structure.''

Jean-Yves Migeon has applied coccinelle to NetBSD, and suggested performing two manual tasks, citing from his email to tech-kern:

Implementation of the coccinelle scripts, resulting patched for NetBSD and more information can be found in Jean-Yves Migeon's posting, his list of patches, and on his wiki page.

Update: Jean-Yves' follow-up includes further examples:

August 08, 2010 11:22 PM

August 03, 2010

FreeBSD Diary

ZFS: Resizing your zpool

Got space? Need more?

August 03, 2010 11:48 PM

August 01, 2010

FreeBSD Diary

ZFS: do not give it all your HDD

Sometimes, holding out is the best decision.

August 01, 2010 09:48 PM

July 14, 2010

Hubertf's NetBSD Blog

NYCBSDCon 2010 Call for Papers

Citing from the call for papers: ``The New York City BSD Conference (NYCBSDCon) is the main technical conference on the US East Coast for the BSD community to get together to share and gain knowledge, to network with like-minded people, and to have fun. This event is organized by members of the New York City *BSD Users Group (NYC*BUG).

The NYCBSDCon program committee is accepting submissions for imaginative, embryonic and energizing presentations surrounding the BSD operating systems. We are looking to attract a wide range of speakers and attendees; therefore, topics of interest range from the esoteric to development to practical, everyday sysadmin life. Of course, original topics are preferred in most cases.

Each talk is expected to be 45-50 minutes, including a few minutes for questions and answers. All presentations will be recorded for audio and video. Presenters will have audio/visual and network connectivity.

Abstracts for presentations are due July 31, 2010.

Authors of accepted submissions should be able to provide the full presentation for publication on NYCBSDCon sponsored mediums. Further instructions will follow notification of acceptance. Submissions accompanied by a non-disclosure agreement or a product advertisement will be rejected.

Abstract submissions should be emailed to cfp@nycbsdcon.org in text, ps or pdf format.

Conference Location: Cooper Union, New York, NY Conference Dates: November 12-14, 2010''

Submission of NetBSD related entries is highly appreciated! See the call for papers for more information on important milestones, subsidizing of speakers and the mailing list to stay upto-date.

July 14, 2010 09:13 PM

July 06, 2010

Dru Lavigne @ O'Reilly Network

Dru Lavigne at Summercamp - Aug 14 2010

Dru Lavigne (BSD Hacks) will be presenting "Getting Started in an Open Source Community."

by Dru Lavigne at July 06, 2010 08:46 PM

July 02, 2010

The Julipedia (Blog)

ATF 0.10 released

Ladies and gentlemen: I have just released ATF 0.10! This release with such a magic number includes lots of new exciting features and provides a much simplified source tree.&lt;br /&gt;&lt;br /&gt;Dive into the &lt;a href="http://www.netbsd.org/~jmmv/atf/releases/0.10/"&gt;0.10 release page&lt;/a&gt; for details!&lt;br /&gt;&lt;br /&gt;I'm now working in getting this release into the NetBSD tree to remove some of the custom patches that have been superseded by the official release. Will be there soon.&lt;br /&gt;&lt;br /&gt;And all this while I am a &lt;a href="http://www.meetbsd.org/"&gt;meetBSD&lt;/a&gt; in Kraków :-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17885055-4316464728404819592?l=blog.julipedia.org' alt='' /&gt;&lt;/div&gt;</content>

by Julio Merino at July 02, 2010 03:48 PM

July 01, 2010

Hubertf's NetBSD Blog

BSD Magazine archive available

Olga Kartseva writes: ``BSD Magazine archives available without subscribing to BSDMag newsletter for freebsd-announce subscribers!'' Here are direct PDF links:

Enjoy - and remember: more NetBSD content is good content, authors are always welcome!

July 01, 2010 12:02 AM

June 24, 2010

The Julipedia (Blog)

Testing NetBSD: Easy Does It

Antti Kantee has been, for a while, writing unit/integration tests for the puffs and rump systems (for which he is the author) shipped with NetBSD. Recently, he has been working on fixing the NetBSD test suite to report 0 failures in the i386 platform so as to encourage developers to keep it that way while doing changes to the tree. The goal is to require developers to run the tests themselves before submitting code.&lt;br /&gt;&lt;br /&gt;Antti has just published an introductory article, titled &lt;a href="http://blog.netbsd.org/tnf/entry/testing_netbsd_easy_does_it"&gt;Testing NetBSD: Easy Does It&lt;/a&gt;, that describes what &lt;a href="http://www.NetBSD.org/~jmmv/atf/"&gt;ATF&lt;/a&gt; and &lt;a href="http://www.gson.org/netbsd/anita/"&gt;Anita&lt;/a&gt; are, how to use them and how they can help in NetBSD development and deployment. Nice work!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17885055-1741546407166795638?l=blog.julipedia.org' alt='' /&gt;&lt;/div&gt;</content>

by Julio Merino at June 24, 2010 08:48 AM

June 20, 2010

Hubertf's NetBSD Blog

NetBSD 5.1_RC3 binaries available for download

NetBSD release-engineer Soren Jacobsen announces: ``The third (and hopefully final) release candidate of NetBSD 5.1 is now available for download at:

http://ftp.NetBSD.org/pub/NetBSD/NetBSD-5.1_RC3/

Those of you who prefer to build from source can continue to follow the netbsd-5 branch, but the netbsd-5-1-RC3 tag is available as well.

See src/doc/CHANGES-5.1 for the list of changes from RC2 to RC3.

Please help us test this release candidate as much as possible. Remember, any feedback is good feedback. We'd love to hear from you, whether you've got a complaint or a compliment. That said, we hope your feedback is positive, as we would like this to be the final release candidate before 5.1. ''

June 20, 2010 10:36 PM

June 18, 2010

The Julipedia (Blog)

ATF 0.9 released (late announcement)

Oops! Looks like I forgot to announce the &lt;a href="http://www.netbsd.org/~jmmv/atf/news.html#20100603-atf-0-9-released"&gt;release of ATF 0.9&lt;/a&gt; here a couple of weeks ago. Just a short notice that the formal release has been available since June 3rd and that 0.9 has been in NetBSD since June 4th!&lt;br /&gt;&lt;br /&gt;You can also enjoy a &lt;a href="http://www.netbsd.org/~jmmv/atf/"&gt;shiny-new web site&lt;/a&gt;! It even includes a &lt;a href="http://www.netbsd.org/~jmmv/atf/docs/faq.html"&gt;FAQ&lt;/a&gt;!&lt;br /&gt;&lt;br /&gt;And, as a side note: I have added a &lt;tt&gt;test&lt;/tt&gt; target to the NetBSD Makefiles, so now it's possible to just do &lt;tt&gt;make test&lt;/tt&gt; within any subdirectory of &lt;tt&gt;src/tests/&lt;/tt&gt; and get what you expect.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17885055-5879847356596187843?l=blog.julipedia.org' alt='' /&gt;&lt;/div&gt;</content>

by Julio Merino at June 18, 2010 06:48 PM

June 16, 2010

Hubertf's NetBSD Blog

EuroBSDCon 2010 - Call for Papers

From some mails I see: ``EuroBSDCon 2010 - Call for Papers

9th European BSD Conference
October 8 - 10, 2010
Karlsruhe, Germany
http://2010.eurobsdcon.org/

Introduction

The European BSD Community will meet again this year for the ninth conference in the EuroBSDCon series. This is a great opportunity to present new ideas to the community, inform your fellow BSD enthusiasts about the newest developments and work for the continued success of your favorite operating system. The two day conference program (October 9 - 10) will be preceeded by a tutorial day (Oct 8). Call for Papers

We are inviting contributions on all areas relating to the BSD family of operating systems, e.g. applications, architecture, implementation, administration and security of *BSD operating systems ranging from embedded systems to mainframes. Investigations on economic aspects regarding the operation of BSD systems are also welcome.

Prospective authors of contributions to the technical program are requested to submit an abstract via http://2010.eurobsdcon.org/. Presentations should last about 40 minutes including time for questions from the audience. Authors of accepted submissions should provide a full paper for publication in the conference proceedings and give permission to the organizers to publish the results in the printed proceedings and on the conference web site at www.eurobsdcon.org.

Call for Tutorial Proposals

Selected tutorials will be offered on the day before the conference. If you are interested in presenting a tutorial, please submit your suggestion on the conference website using the same mechanism as for submitting a paper. Please indicate if this would be a half- or full-day tutorial.

Sponsorship Opportunities

We are seeking companies or institutions to sponsor various elements of the conference in order to keep delegate fees as low as possible. Sponsorship opportunities include: paying for a speaker's travel or accommodation; providing bursaries for delegates who cannot pay the conference fee themselves; sponsoring the social event or the printing of proceedings. Please see the conference website for details.

Important Dates

Final abstract deadline: July 6th 2010
Final tutorial deadline: July 6th
Final papers due: September 1st
Tutorial day: October 8th
Conference: October 9 - 10

For more, see http://2010.eurobsdcon.org/''

June 16, 2010 11:56 PM

June 05, 2010

Hubertf's NetBSD Blog

Hiding other users' processes

Thus it was asked on #NetBSD:

<batence> I wanna set the top command work only for users process, not
                for all system
<batence> in freebsd command is sysctl security.bsd.see_other_uids=0/1
<batence> but I dunno for netbsd
<batence> eg I don't want users see other uids
<batence> only which they owned
Looking at the output of "sysctl -a" didn'r show anything obvious, but recalling the topic and with some digging, there actually is a sysctl switch for that in NetBSD: security.models.bsd44.curtain=1

Here's an example top(1) output with the default setting (0). My username is "feyrer", note that besides my processes, other users' processes are shown as well:

Likewise, I see a number of processes in ps(1):
% ps -aux | wc -l
      26
Now let's change the sysctl:
# sysctl -d security.models.bsd44.curtain
security.models.bsd44.curtain: Curtain information about objects to users not owning them.
# sysctl -w security.models.bsd44.curtain=1
security.models.bsd44.curtain: 0 -> 1
After this, the top(1) output looks like this: This reduced set of processes is also shown in ps(1):
% ps -aux | wc -l
       7
In other words, only my processes are displayed. (If you wonder about the difference between the 7 processes shown in top and the seven ps(1)-lines: the latter includes a heading).

Note that this "filtering" does not apply to the root user, i.e. he can still see all processes.

June 05, 2010 06:42 PM

May 31, 2010

Hubertf's NetBSD Blog

Videos: Booting NetBSD [Update #3]

Jun Ebihara wrote me that there are a bunch of videos on YouTube, showing NetBSD boot on various machines:

Update: Links added for those not seeing the embedded videos (which I've seen happens via at least two RSS aggregators)

Update #2: Added booting NetBSD/hpcsh 5.1_RC2 from Windows CE on PERSONA, also submitted by Jun Ebihara. Thanks a lot!

Update #3: Added booting NetBSD/dreamcast 5.1_RC2 with IDE HDD and NE2000 NIC

May 31, 2010 09:15 PM

May 28, 2010

Hubertf's NetBSD Blog

NetBSD 5.1_RC2 binaries available for download

Soren Jacobsen writes on netbsd-announce: ``The second release candidate of NetBSD 5.1 is now available for download at:

http://ftp.NetBSD.org/pub/NetBSD/NetBSD-5.1_RC2/

Those of you who prefer to build from source can continue to follow the netbsd-5 branch, but the netbsd-5-1-RC2 tag is available as well.

See src/doc/CHANGES-5.1 for the list of changes from RC1 to RC2.

Please help us test this and any upcoming release candidates as much as possible. Remember, any feedback is good feedback. We'd love to hear from you, whether you've got a complaint or a compliment. ''

May 28, 2010 02:30 PM

Source-changes ketchup Dec'09 - May'10 [Updated]

Here's what I have in my source-changes folder as interesting changes between Dec '09 and May '10. YMMV:

May 28, 2010 02:22 AM

NetBSD ketchup - news from my mailbox

Here's another bunch of NetBSD-related news that has been lingering in my inbox for far too long:

May 28, 2010 01:31 AM

May 16, 2010

Hubertf's NetBSD Blog

Apple Magic Mouse driver

NetBSD's Bluetooth hacker #1, Iain Hibbert, wrote on tech-kern: ``I wrote a driver for the Apple Magic Mouse, as the protocol was mostly decoded by a Linux developer, and Somebody was kind enough to send me one. [...]

The mouse itself is a wireless Bluetooth mouse and operates with the USB HID protocol much like other mice, but it doesn't provide a proper descriptor and requires features to be activated and special interpretations of the touch surface reports, so doesn't fit exactly into our HID framework, which configures independent sub-devices to report id's from the descriptor.

The driver interprets the touch reports to allow emulation of a middle mouse button (for mulitple firm touches detected), and horizontal and vertical scroll actions (for touches moving over a certain distance). It works well on NetBSD-current and NetBSD-5 and the mouse is pretty slick. '' See Iain's posting for more details.

May 16, 2010 10:33 PM

May 10, 2010

The Julipedia (Blog)

Trac installation for ATF

During the past few months, I've got into the habit of using a bug tracker to organize my tasks at the work place. People assign tickets to me to get things done and I also create and self-assign tickets to myself to keep them as a reminder of the mini-projects to be accomplished. Sincerely, this approach works very well for me and keeps me focused.&lt;br /&gt;&lt;br /&gt;Since then, I've been wishing to have a similar system set up for ATF. Yeah, we could use the &lt;a href="http://www.netbsd.org/Gnats/"&gt;Gnats&lt;/a&gt; installation provided by NetBSD... but I hate this issue tracking system. It's ancient, ugly, and I do really want a web interface to manage my tickets through.&lt;br /&gt;&lt;br /&gt;So, this weekend, I finally took some time and set up a Trac installation for ATF to provide a decent bug/task tracking system. The whole Apache plus Trac setup was more complex than I imagined, but I do hope that the results will pay off :-)&lt;br /&gt;&lt;br /&gt;Take a look at the &lt;a href="http://www.NetBSD.org/~jmmv/atf/news.html#20100509-trac-available"&gt;official announcement&lt;/a&gt; for more details!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17885055-7270221803608994472?l=blog.julipedia.org' alt='' /&gt;&lt;/div&gt;</content>

by Julio Merino at May 10, 2010 06:48 PM

Ads gone

Almost a year ago, I decided to &lt;a href="http://blog.julipedia.org/2009/06/trying-adsense.html"&gt;give a try to AdSense&lt;/a&gt;. And, so far, the "earnings" have been ~30 EUR which I cannot even cash. Given this and how ugly and disturbing the ads look on the front page, I have disabled them. (I think the ads have gotten much worse over time... but as I do not pay attention to the front page, I didn't see them.) Thanks to Roman Valls for pointing this out!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17885055-3049034875819271527?l=blog.julipedia.org' alt='' /&gt;&lt;/div&gt;</content>

by Julio Merino at May 10, 2010 09:48 AM

May 08, 2010

The Julipedia (Blog)

ATF 0.8 imported into NetBSD

Finished &lt;a href="http://mail-index.netbsd.org/source-changes/2010/05/08/msg009703.html"&gt;importing ATF 0.8 into the NetBSD source tree&lt;/a&gt;. Wow, the CVS import plus merge was much easier than I expected.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Note that, while the NetBSD test suite should continue to work as usual, there are some backwards incompatible changes in the command line interface of test programs. If you are used to run them by hand, expect different results. Please read the &lt;a href="http://www.NetBSD.org/~jmmv/atf/news.html#20100507-atf-0-8-released"&gt;release news&lt;/a&gt; for details.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now let's wait for complaints about broken builds! And enjoy this new release in your NetBSD-current system!&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17885055-5123310572457338623?l=blog.julipedia.org' alt='' /&gt;&lt;/div&gt;</content>

by Julio Merino at May 08, 2010 08:48 AM

May 07, 2010

The Julipedia (Blog)

Announcing ATF 0.8

Looks like today is a release day. I've just pushed &lt;a href="http://www.NetBSD.org/%7Ejmmv/atf/news.html#20100507-atf-0-8-released"&gt;ATF 0.8&lt;/a&gt; out in the wild and will proceed to import it into pkgsrc and NetBSD later. Refer to the release announcement for details. This is an exciting release! You have been warned ;-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17885055-5230262632323813624?l=blog.julipedia.org' alt='' /&gt;&lt;/div&gt;</content>

by Julio Merino at May 07, 2010 03:48 PM

Announcing etcutils 0.1

During past week, I worked on a new package called etcutils. It provides a (reduced) tool-set to programmatically manage files in &lt;tt&gt;/etc&lt;/tt&gt; and is specially designed to allow pkgsrc to update &lt;tt&gt;/etc/shells&lt;/tt&gt; and &lt;tt&gt;/etc/services&lt;/tt&gt; in a more consistent way.&lt;br /&gt;&lt;br /&gt;I'm happy to say that the 0.1 release is now ready! Go to the &lt;a href="http://www.netbsd.org/%7Ejmmv/etcutils/"&gt;etcutils web page&lt;/a&gt; for details. (I know that if you are a Linux user, you probably don't care about this because your distribution most likely already provides something similar... albeit more complex.)&lt;br /&gt;&lt;br /&gt;I'll now proceed to import this new package into pkgsrc as &lt;tt&gt;sysutils/etcutils&lt;/tt&gt;. Later on (most likely not today), the following should happen: rework pkginstall to use the new shells(8) utility to update &lt;tt&gt;/etc/shells&lt;/tt&gt;, add a new feature to pkgsrc to abstract the updates to &lt;tt&gt;/etc/services&lt;/tt&gt;, and swipe through pkgsrc to make all packages touching this file use the new frameworky option. (Hey FAM, that includes you!)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17885055-6570217818735603714?l=blog.julipedia.org' alt='' /&gt;&lt;/div&gt;</content>

by Julio Merino at May 07, 2010 09:48 AM

May 01, 2010

Hubertf's NetBSD Blog

Silencing the boot process

NetBSD-current is able to boot the userland silently with "boot -z" for quite some time now, thanks to Alan Barrett. Those changes were never ported back to the netbsd-5 branch so far, but I'm in the process to change this now. Here's a preview:

Of course there are still many places left in the kernel that don't honor the boot flags (i.e. that use printf(9) instead of aprint_normal(9) and friends), but this will change over time - I hope :-).

May 01, 2010 10:52 AM

April 29, 2010

Hubertf's NetBSD Blog

NetBSD-current build status

Have you ever wondered how stable a -current build is at times? Here is an interesting page to give an overview on the success of NetBSD-current builds from the past few days (and much further back):

From the webpage: ``This web page visualizes the state of the NetBSD-current build by plotting the number of lines in the build log from build.sh as a function of time, and coloring the points red or green depending on whether the build succeeded or failed. Hopefully, this can help give some insight into the frequency and duration of build failures.

The plots were constructed using an automated procedure that builds NetBSD-current periodically (roughly twice a day) using make.sh -m i386 release, looks for any changes in exit status or any substantial changes in the size of the build log, and then pinpoints the times at which the changes occurred using binary search. The graph may not contain every build failure, because the algorithm used can miss cases where the build is broken and then fixed again between two consecutive periodic builds. The converse case, when the build is fixed and then broken again between two consecutive periodic builds, is usually detected because the size of the build log usually changes in this case.

Most of the builds in the graph are cross-builds using a 64-bit Linux host, while some of the older ones are native NetBSD builds.

If your browser supports SVG, you can use the SVG version. ''

Thanks to Andreas Gustafsson for providing this service!

April 29, 2010 12:54 AM

April 24, 2010

The Julipedia (Blog)

Forget about test(1)'s == operator

Some implementations of test(1), in an attempt to be smart, provide non-standard operators such as &lt;tt&gt;==&lt;/tt&gt;. Please forget about those: they make your scripts non-portable and a pain to use in other systems. Why? Because, due to the way the shell works, failures in calls to test(1) will often just result in an error message (which may not be seen due to other output) and the script will happily continue running even if it missed to perform some important operation.&lt;br /&gt;&lt;br /&gt;So... just use the standard equality operators:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;tt&gt;=&lt;/tt&gt; for string equality comparison.&lt;/li&gt;&lt;li&gt;&lt;tt&gt;-eq&lt;/tt&gt; for numeric equality comparison.&lt;/li&gt;&lt;/ul&gt;Note that whenever I refer to test(1), I'm also talking about the &lt;tt&gt;[ ... ]&lt;/tt&gt; construction in conditionals.&lt;br /&gt;&lt;br /&gt;Also, please note that this also affects configure scripts, and the problem in these appears much more commonly than in other scripts!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17885055-6205418080955020541?l=blog.julipedia.org' alt='' /&gt;&lt;/div&gt;</content>

by Julio Merino at April 24, 2010 09:48 PM

April 22, 2010

The Julipedia (Blog)

Always define an else clause for portability #ifdefs

If you use &lt;tt&gt;#ifdef&lt;/tt&gt; conditionals in your code to check for portability features, be sure to always define a catch-all else clause that actually does something, even if this something is to error out.&lt;br /&gt;&lt;br /&gt;Consider the following code snippet, quoted from gamin's &lt;tt&gt;tests/testing.c&lt;/tt&gt; file:&lt;pre&gt;if (arg != NULL) {&lt;br /&gt;#ifdef HAVE_SETENV&lt;br /&gt; setenv("GAM_CLIENT_ID", arg, 1);&lt;br /&gt;#elif HAVE_PUTENV&lt;br /&gt; char *client_id = malloc (strlen (arg) + sizeof "GAM_CLIENT_ID=");&lt;br /&gt; if (client_id)&lt;br /&gt; {&lt;br /&gt; strcpy (client_id, "GAM_CLIENT_ID=");&lt;br /&gt; strcat (client_id, arg);&lt;br /&gt; putenv (client_id);&lt;br /&gt; }&lt;br /&gt;#endif /* HAVE_SETENV */&lt;br /&gt;}&lt;br /&gt;ret = FAMOpen(&amp;amp;(testState.fc));&lt;/pre&gt;The &lt;tt&gt;FAMOpen&lt;/tt&gt; method queries the &lt;tt&gt;GAM_CLIENT_ID&lt;/tt&gt; environment variable to set up the connections parameters to the FAM server. If the variable is not defined, the connection will still work, even though it will use some default internal value. In the test code above, the variable is explicitly set to let the tests use a separate server instance.&lt;br /&gt;&lt;br /&gt;Now, did you notice that we have to conditional branches? One for &lt;tt&gt;setenv&lt;/tt&gt; and one for &lt;tt&gt;putenv&lt;/tt&gt;? It seems reasonable to assume that one or the other must be present on any Unix system. Unfortunately, this is flawed:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;What happens if the code forgets to include &lt;tt&gt;config.h&lt;/tt&gt;?&lt;/li&gt;&lt;li&gt;What happens if the configure script fails to detect &lt;i&gt;both&lt;/i&gt; &lt;tt&gt;setenv&lt;/tt&gt; and &lt;tt&gt;putenv&lt;/tt&gt;? This is not that uncommon, given how some configure scripts are written.&lt;/li&gt;&lt;li&gt;What happens if neither &lt;tt&gt;setenv&lt;/tt&gt; nor &lt;tt&gt;putenv&lt;/tt&gt; are available?&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;The answer to the three questions is: in the above code snippet, the code &lt;tt&gt;builds just fine&lt;/tt&gt; but will misbehave at run time: neither &lt;tt&gt;HAVE_SETENV&lt;/tt&gt; nor &lt;tt&gt;HAVE_PUTENV&lt;/tt&gt; are defined, so the code will not be able to define the required environment variable. However, &lt;tt&gt;FAMOpen&lt;/tt&gt; will later be called and it will not behave as expected because the variable has not been set.&lt;br /&gt;&lt;br /&gt;Note that this code snippet is just an example. I have seen many more instances of this exact same problem with worse consequences than the above. Read: they were not part of the test code, but just part of the regular code path.&lt;br /&gt;&lt;br /&gt;So how do you implement the above in a saner way? You have two alternatives:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Add an &lt;tt&gt;#else&lt;/tt&gt; clause that contains a fallback implementation. In the case above, we could, for example, prefer to use &lt;tt&gt;setenv&lt;/tt&gt; if present because it has a nicer interface, and fall back to &lt;tt&gt;putenv&lt;/tt&gt; if not found.&lt;br /&gt;This has a disadvantage though: if you forget to include &lt;tt&gt;config.h&lt;/tt&gt; or the configure script cannot correctly detect one of the possible implementations (even when present), you will always use the fallback implementation.&lt;/li&gt;&lt;li&gt;Keep each possible implementation correctly protected by a conditional, but add a &lt;tt&gt;#else&lt;/tt&gt; clause that raises an error at &lt;i&gt;build time&lt;/i&gt;. This will make sure that you never forget to define at least one of the portability macros for any reason. This is the preferred approach.&lt;/li&gt;&lt;/ul&gt;Following the second suggestion above, the code would get the following structure: &lt;pre&gt;#if defined(HAVE_SETENV)&lt;br /&gt;setenv(...);&lt;br /&gt;#elif defined(HAVE_PUTENV)&lt;br /&gt;putenv(...);&lt;br /&gt;#else&lt;br /&gt;# error "Don't know how to set environment variables."&lt;br /&gt;#endif&lt;/pre&gt;With this code, we can be sure that the code will not build if none of the possible implementations are selected. We can later proceed to investigate why that happened.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17885055-1519509019468318358?l=blog.julipedia.org' alt='' /&gt;&lt;/div&gt;</content>

by Julio Merino at April 22, 2010 02:48 PM

April 21, 2010

The Julipedia (Blog)

Where does Gnome use file monitoring?

One of &lt;a href="http://blog.julipedia.org/2010/04/new-gio-fam-package.html?showComment=1271802660697#c3047587885904955995"&gt;my readers&lt;/a&gt; of my &lt;a href="http://blog.julipedia.org/2010/04/new-gio-fam-package.html"&gt;post yesterday&lt;/a&gt;, wonders where Gnome uses the file monitoring APIs. Well, the answer is: &lt;span style="font-style: italic;"&gt;everywhere&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Here are some examples:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Nautilus monitors all open folders so that it can update their contents whenever the underlying file store changes. Say you are viewing the Documents folder and you save a new Document from within OpenOffice into that folder. You definitely want Nautilus to show it immediately, without having to manually hit Refresh from the menu.&lt;/li&gt;&lt;li&gt;The trash applet monitors the trash folders and updates its icon from empty to full whenever one of these folders ceases to be non-empty.&lt;/li&gt;&lt;li&gt;The panel monitors the applications directory to notice when new applications get installed. This allows it to update the Applications menu immediately as soon as a new program gets installed into the system.&lt;/li&gt;&lt;li&gt;The GTK file open/save dialogs monitor the directory they are viewing for the same reason as Nautilus. (Actually, I'm unsure about this point. My Linux installation is an old Ubuntu 8.04 LTS that does not have GIO, so I can't verify in recent ones. However, this makes perfect sense and if not implemented, it should be!)&lt;/li&gt;&lt;li&gt;The background switcher control panel monitors the folders containing images to be able to show new installed backgrounds. (I'm not sure about this either. It doesn't happen in my Linux installation, but it also makes sense.)&lt;/li&gt;&lt;li&gt;Media players such as Rhythmbox and Banshee allow you to point them to a folder containing music and have an option to automatically add music to the library as soon as it pops up in such folder.&lt;/li&gt;&lt;li&gt;Potentially, any document editor, picture viewer, etc. monitors the documents opened in them so that these applications can notice external notifications to those files. This is useful to prevent overwriting a file with an out-dated in-memory copy. For example: you are taking some notes with GEdit. On a separate terminal window, you quickly edit the notes file with Vim to add a new note. When you go back to GEdit, you want the editor to tell you that the file has changed out of its control and offer you a choice: e.g. reload or ignore?&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;And many, many more other situations that I'm surely missing...&lt;br /&gt;&lt;br /&gt;As you can see, it is fairly important to get the file monitoring subsystem working flawlessly. Otherwise, all these tiny details don't work and the end user experience is undermined.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17885055-8725416766704267720?l=blog.julipedia.org' alt='' /&gt;&lt;/div&gt;</content>

by Julio Merino at April 21, 2010 08:48 AM

April 20, 2010

The Julipedia (Blog)

New gio-fam package

As briefly outlined in the &lt;a href="http://blog.julipedia.org/2010/04/file-system-monitoring-gnome-and-netbsd.html"&gt;previous post&lt;/a&gt;, new versions of Glib provide GIO, a library that intends to be a low-level file system API on top of the POSIX interface. This library provides an interface to asynchronously wait for file system change notifications including the creation, deletion and modification of files.&lt;br /&gt;&lt;br /&gt;The monitoring functionality in GIO is modular: it is backed by different loadable plugins that implement OS-specific functionality. In particular, GIO uses an inotify module in Linux and a &lt;a href="http://oss.sgi.com/projects/fam/"&gt;FAM&lt;/a&gt; module everywhere else.&lt;br /&gt;&lt;br /&gt;Up until now, the &lt;tt&gt;devel/glib2&lt;/tt&gt; package in pkgsrc provided a build-time option to specify whether to build the GIO FAM plugin or not. Given that this plugin is built as a shared object that is loaded dynamically at run-time, having a build-time option for this is clearly wrong: it gives no choice to those relying on binary packages (e.g. end/new users). Furthermore, it adds a dependency on the ugly-FAM at the very bottom of the huge Gnome dependency chain. (As already stated, FAM is outdated and hard to set up.)&lt;br /&gt;&lt;br /&gt;So, based on this, I've just removed all FAM support from &lt;tt&gt;devel/glib2&lt;/tt&gt; altogether and packaged its loadable module as &lt;tt&gt;sysutils/gio-fam&lt;/tt&gt;.&lt;br /&gt;&lt;br /&gt;Now waiting for a clean rebuild of the Gnome packages to see if the desktop now works on my machine by avoiding FAM/Gamin.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17885055-4070965403269265546?l=blog.julipedia.org' alt='' /&gt;&lt;/div&gt;</content>

by Julio Merino at April 20, 2010 06:48 PM

File system monitoring, Gnome and NetBSD

A few days ago, I decided to start using NetBSD, as well as Gnome on NetBSD once again, mostly because the lack of their use makes my skills feel rusty in many different areas. While NetBSD has surprised me in a good way (I am running it on a Macbook Pro and things like wireless and DRI work), Gnome has not. There are tons of broken things that prevent a smooth user experience.&lt;br /&gt;&lt;br /&gt;One of these broken things is the monitoring of changes in the file system. Actually, this has never worked 100%. But what is this and why does it matter, you ask? Well, file system monitoring is an internal component of the Gnome infrastructure that allows the desktop to receive notifications when files or directories change. This way, if, say, you are viewing the Downloads folder in Nautilus and you start downloading a file from Epiphany into that folder, Nautilus will realize the new file and show it immediately without requiring a manual refresh.&lt;br /&gt;&lt;br /&gt;How to monitor the file system depends on the operating system. There are basically two approaches: polling and asynchronous notifications. Polling is suboptimal because the notifications are usually delayed. Asynchronous notifications are tied to the operating system: Linux provides &lt;a href="http://en.wikipedia.org/wiki/Inotify"&gt;inotify&lt;/a&gt;, NetBSD provides &lt;a href="http://en.wikipedia.org/wiki/Kqueue"&gt;kqueue&lt;/a&gt; and other systems provide their own APIs.&lt;span style="display: block;" id="formatbar_Buttons"&gt;&lt;span class="on down" style="display: block;" id="formatbar_CreateLink" title="Link" onmouseover="ButtonHoverOn(this);" onmouseout="ButtonHoverOff(this);" onmouseup="" onmousedown="CheckFormatting(event);FormatbarButton('richeditorframe', this, 8);ButtonMouseDown(this);"&gt;&lt;img src="http://www.blogger.com/img/blank.gif" alt="Link" class="gl_link" border="0" /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;In the past, Gnome monitored the file system by a combination of &lt;a href="http://oss.sgi.com/projects/fam/"&gt;FAM&lt;/a&gt;, a system-level service that provides an API to file system monitoring, and GNOME VFS, a high-level layer that hides the interaction with FAM. This approach was good in spirit (client/server separation) but didn't work well:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;FAM is abandoned.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Does not support kqueue out of the box.&lt;/li&gt;&lt;li&gt;FAM runs as root.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;FAM is too hard to set up: it requires rpcbind, an addition to &lt;tt&gt;/etc/services&lt;/tt&gt;, a sysctl tweak, and the configuration of a system-level daemon.&lt;/li&gt;&lt;/ul&gt;To solve some of these problems, a drop-in replacement for FAM was started. &lt;a href="http://people.gnome.org/%7Eveillard/gamin/"&gt;Gamin&lt;/a&gt;, as it is known, still does not fix everything:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Gamin is abandoned.&lt;/li&gt;&lt;li&gt;Supports kqueue out of the box, but does not work very well.&lt;/li&gt;&lt;li&gt;Actually, Gamin itself does not work. Running the tests provided by the distfile in a modern Linux system results in several test failures.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;Anyway. Did you notice the &lt;span style="font-style: italic;"&gt;abandoned&lt;/span&gt; pattern above? This is important: in the new world order, Gnome does not use FAM any more.&lt;br /&gt;&lt;br /&gt;The new structure to monitor files is: the low-level glib library provides the gio module, which has some file system monitoring APIs. The GVFS module provides higher level abstractions to file system management, and relies on gio for file system monitoring. There is no more GNOME VFS any more.&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-style: italic;"&gt;key&lt;/span&gt; point is: gio uses inotify directly; no abstraction layers in between. FAM support is still there for platforms without inotify, but as it is not used in Linux any more, it rots. Linux developers will never experience what it is to have a system that needs to use FAM to get this functionality to work.&lt;br /&gt;&lt;br /&gt;At last, let's look at the status of all this in NetBSD:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The FAM package was &lt;a href="http://blog.julipedia.org/2004/10/fam-and-kqueue.html"&gt;patched to support kqueue&lt;/a&gt;. Although this kinda works, it is not perfect. Also, as mentioned above, FAM is, I'd say, the package with the hardest installation procedure of the whole Gnome platform.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The Gamin packages are nicer than the FAM package regarding their configuration. However, when using Gamin instead of FAM, all sorts of bugs appear in Gnome (it actually gets stuck during startup for me). The breakage of the unit tests does not provide any confidence, and the fact that Gamin is abandoned, the idea of fixing it doesn't make me thrive.&lt;/li&gt;&lt;li&gt;The glib2 package &lt;span style="font-style: italic;"&gt;depends&lt;/span&gt; on FAM. This is ugly; really ugly. I had to shout WTF when I saw this, seriously.&lt;/li&gt;&lt;li&gt;Seeing the direction gio/gvfs take, it is obvious that things can only get worse in the future.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;If time permits, I'm planning to work on improving this whole situation. Ideas include:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Splitting the FAM gio module out of the glib2 package. Ideally, this would happen upstream.&lt;/li&gt;&lt;li&gt;Implement a gio backend for kqueue.&lt;/li&gt;&lt;li&gt;Check if the core packages still using gnome-vfs have a more recent version that uses gvfs instead and, if so, update them.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;Can't promise you anything other than, if I get to work on it, I will keep you posted!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17885055-5347499839576127054?l=blog.julipedia.org' alt='' /&gt;&lt;/div&gt;</content>

by Julio Merino at April 20, 2010 02:48 PM

April 13, 2010

Hubertf's NetBSD Blog

Unixes of the world unite!

I've stumbled about this presentation by Unix (co)pioneer Robert Pike, which he gave in 2001. Some hilights:

Read the whole presentation for an overview of the things that Unix got right and wrong. Definitely worth reading!

April 13, 2010 11:42 PM

April 06, 2010

Hubertf's NetBSD Blog

NetBSD and Google Summer of Code - Send in your proposals!

Just a friendly reminder to interested students who want to participate in this year's Google Summer of Code: You have only three days left to send in your proposal! Student application deadline is April 9th, 19:00 UTC.

See our list of suggested SoC projects if you need inspiration (other project suggestions are welcome!), and please have a look at our proposal HowTo for a bunch of questions we want to have answered so that we can properly judge your proposal. Get going!

April 06, 2010 09:31 PM

March 19, 2010

The Julipedia (Blog)

NetBSD in Google Summer of Code 2010

For the 6th year in a row, &lt;a href="http://www.netbsd.org/"&gt;NetBSD&lt;/a&gt; is a mentoring organization for &lt;a href="http://code.google.com/soc/"&gt;Google Summer of Code&lt;/a&gt; 2010!&lt;br /&gt;&lt;br /&gt;If you are a bright student willing to develop full-time for an open source project during this coming summer, consider applying with us! You will have a chance to work with very smart people and, most likely, in the area that you are most passionate about. NetBSD, being an operating system project, has offers for project ideas at all levels: from the kernel to the packaging system, passing by drivers, networking tools, user-space utilities, the system installer, automation tools and more!&lt;br /&gt;&lt;br /&gt;I would like to point you at the 3 project proposals I'm willing to directly mentor:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.netbsd.org/contrib/soc-projects.html#optimize-atf"&gt;Optimize and speed-up ATF&lt;/a&gt;: Make the testing framework blazing fast so that running the NetBSD automated tests does not take ages on slow platforms.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.netbsd.org/contrib/soc-projects.html#reorganize-atf"&gt;Reorganize ATF to improve modularity&lt;/a&gt;: Refactor pieces of the testing framework so that it is easier to redistribute, has cleaner interfaces and is easier to depend on from third-party projects.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.netbsd.org/contrib/soc-projects.html#rewrite-pkg_comp"&gt;Rewrite pkg_comp with portability as a major goal&lt;/a&gt;: Use Python to create a tool to automatically build binary packages from within a sandbox.&lt;/li&gt;&lt;/ul&gt;If you find any of the above projects interesting, or if you have any other project proposal that you think I could mentor, do not hesitate to &lt;a href="mailto:jmmv%20at%20netbsd%20dot%20org"&gt;contact me&lt;/a&gt;. Feel free to send me a draft of &lt;a href="http://www.netbsd.org/contrib/soc-application.html"&gt;your application&lt;/a&gt;, together with a bit of information about you, so that we can discuss your proposal and make sure it gets selected!&lt;br /&gt;&lt;br /&gt;Or, if none of the projects above interests you, please do check out the &lt;a href="http://www.netbsd.org/contrib/soc-projects.html"&gt;full list of NetBSD project proposals&lt;/a&gt;. I'm sure you will find something that suits your interests :-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17885055-1228455004173703548?l=blog.julipedia.org' alt='' /&gt;&lt;/div&gt;</content>

by Julio Merino at March 19, 2010 09:48 AM

March 18, 2010

Hubertf's NetBSD Blog

NetBSD is part of Google's Summer of Code 2010

This year's Google Summer of Code mentoring organizations has been announced, and NetBSD is part of it, again! Possible projects are listed on the projects page, the GSoC wiki page, and esp. on the SoC-projects page.

Prospective students that are interested in working on a project are recommended to have a look at the Project Application / Proposal HowTo!

March 18, 2010 11:07 PM

March 13, 2010

FreeBSD Diary

Monitoring your HDD using SMART and Nagios

Checking your HDD!

March 13, 2010 12:48 AM

March 12, 2010

The Julipedia (Blog)

New version of the monotone-server package in pkgsrc

Wow, it has been a long time... 5 years ago, I created the &lt;a href="http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/devel/monotone-server/?only_with_tag=MAIN"&gt;monotone-server&lt;/a&gt; package in pkgsrc, a package that provided an interactive script to set up a &lt;a href="http://monotone.ca/"&gt;monotone&lt;/a&gt; server from scratch with, what I though, minimal hassle.&lt;br /&gt;&lt;br /&gt;My package did the job just fine, but past year I was blown away by the simplicity of the same package in &lt;a href="http://www.fedoraproject.org/"&gt;Fedora&lt;/a&gt;: their &lt;tt&gt;init.d&lt;/tt&gt; script provides a set of extra commands to initialize the server before starting it up, and that is it. No need to mess with a separate interactive script; no need to create and memorize passphrases that you will never use; and, what's more, all integrated in the only single place that makes sense: in the init.d "service management" script.&lt;br /&gt;&lt;br /&gt;It has been a while since I became jealous of their approach, but I've finally got to it: I've spent the last few days rewriting the monotone-server package in pkgsrc and came up with a similar scheme. And this &lt;a href="http://mail-index.netbsd.org/pkgsrc-changes/2010/03/12/msg038844.html"&gt;new package&lt;/a&gt; just made its way &lt;a href="http://mail-index.netbsd.org/pkgsrc-changes/2010/03/12/msg038844.html"&gt;&lt;/a&gt;to pkgsrc-HEAD! The new package comes with what I think is a detailed manual page that explains how to configure the server from scratch. Take a look and, if you find any mistakes, inconsistencies or improvements to be done, let me know!&lt;br /&gt;&lt;br /&gt;In the meantime, I will log into my home server, rebuild the updated package and put it in production :-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17885055-1599070089952057305?l=blog.julipedia.org' alt='' /&gt;&lt;/div&gt;</content>

by Julio Merino at March 12, 2010 09:48 AM

March 06, 2010

The Julipedia (Blog)

Introducing the ATF nofork branch

Despite my time for free software being virtually zero these days, I have managed to implement a prototype of what ATF would look like if it didn't implement forking and isolation in test programs. This feature has been often requested by users to simplify their life when debugging test cases.&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I shouldn't repeat everything I posted on the atf-devel mailing list regarding this announcement, so please &lt;a href="http://mail-index.netbsd.org/atf-devel/2010/03/05/msg000070.html"&gt;refer to that email for details&lt;/a&gt;. But I must say that the results look promising: the overall code of ATF is much simpler and also faster. (An execution I just tried cuts the run time of the ATF test suite from 1m 41s to 1m 16s.) Expect more simplifications and speed-ups!&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17885055-1501363386005733392?l=blog.julipedia.org' alt='' /&gt;&lt;/div&gt;</content>

by Julio Merino at March 06, 2010 08:48 PM

February 22, 2010

Hubertf's NetBSD Blog

Google Summer of Code 2010 NetBSD swcryptX Project Suggestion (Updated #2)

Please see the update below before applying for this GSoC project!

I've been thinking of a neat-o project for this year's Google Summer of Code:

Overview of operation

The opencrypto(9) framework exists to coordinate hardware acceleration in NetBSD. Applications of the framework can be inside the kernel like the FAST_IPSEC IPsec implementation, or in userland like OpenSSL with the "cryptodev" engine. Crypto drivers can be realized in software or in hardware. Hardware drivers can be used to instruct e.g. the AMD Geode LX's AES block or a HIFN chip to perform cryptographic operations. Upon system startup, the crypto drivers at the opencrypto(9) framework, telling what operations they can perform. When an operation is required later, the framework will look which crypto device is currently not busy, and offload the operation to that device. Upon completion, the result is fed back to the application.

The following image illustrates the components and their interaction.

Limitations

Offloading the cryptographic requests involves some overhead. Data needs to be transferred to the hardware and back. On systems with a slow CPU, this overhead is relatively small compared to the operation speed of the CPU. On faster CPUs, the overhead becomes more of a burden, making the benefit of the crypto hardware negligible.

As examples, while a hifn(4) chip can provide worthwhile speedups on 500MHz and 1GHz CPUs, no performance win is experienced on a 2.4GHz CPU.

Proposal

The communication overhead involves data transfers over a PCI bus, which is of relatively low speed compared to today's modern CPUs. Preventing the data transfer is a worthwhile goal. In coordination with today's modern multi-core CPUs, using one or more CPUs solely for the purpose of crypto acceleration, a measurable improvement of crypto performance is expected. At the same time, no special hardware requirements beyond the CPU exist. This allows turning standard contemporary systems into fast crypto systems easily.

The following image illustrates the idea of interoperation between a CPU core that runs the kernel and application codes and three cores that are dedicated to crypto code.

Implementation Roadmap

This is where it gets fishy. ;) The existing opencrypto(4) framework probably needs to be make MP-aware at the same time, employing proper use of NetBSD's locking framework. (Already done) The existing swcrypto(4) needs to be adjusted for operation on multiple CPUs at the same time. A way to decide how many CPUs are dedicated to run swcrypto(4) instances. CPUs that run swcrypto(4) need to be taken out from the usual NetBSD CPU scheduling so that they are available exclusively for crypto.

Requirements

In no particular order:

Project Applications

Please follow the NetBSD Project Application/Proposal HowTo if you're serious to work on this project.

If you have any questions let me know, public discussion should be led on the tech-crypto@ list.

Update: There was some discussion. In particular, my understanding of the interaction of the various layers as outlined above is not 100% accurate, and userland applications using opencrypto already seem to benefit from multiple kernel threads. In-kernel applications apparently do not, and before providing multiple crypto-servers in kernel (as suggested), work should probably done first to make sure such applications exist. Examples of this are IPsec (and the whole network stack), but also others like cgd (which AFAIU currently does not use opencrypto(9)).

February 22, 2010 10:57 PM

January 24, 2010

The Julipedia (Blog)

set -e and set -x

If you write shell scripts, you definitely need to know about two nice features that can be enabled through the &lt;tt&gt;set&lt;/tt&gt; builtin:&lt;div&gt;&lt;ul&gt;&lt;li&gt;&lt;tt&gt;set -e&lt;/tt&gt;: Enables checking of all commands. If a command exits with an error and the caller does not check such error, the script aborts immediately. Enabling this will make your scripts more robust. But don't wait until your script is "complete" to set the flag as an afterthought, because it will be a nightmare to fix the scrip to work with this feature enabled. Just write &lt;tt&gt;set -e&lt;/tt&gt; as the very first line of your code; well... after the shell bang.&lt;/li&gt;&lt;li&gt;&lt;tt&gt;set -x&lt;/tt&gt;: If you are writing simple scripts that are meant to, well, script the execution of a few tasks (as opposed of being full-flown programs written in shell), set this flag to trace the execution of all commands. This will make the interpreter print each command right before it is executed, so it will aid you in knowing what is happening at any point in time.&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17885055-8947551254574129862?l=blog.julipedia.org' alt='' /&gt;&lt;/div&gt;</content>

by Julio Merino at January 24, 2010 10:48 PM

January 23, 2010

FreeBSD Diary

Problems starting a jail with ezjail

Things change. We must evolve.

January 23, 2010 12:48 AM

January 19, 2010

FreeBSD Diary

Integrating the Tape Library with an existing Bacula installation

Adding a new tape drive isn't always simple

January 19, 2010 12:48 AM

January 18, 2010

FreeBSD Diary

Tape Libraries & Bacula

Tape libraries can be complex to set up

January 18, 2010 12:48 AM

January 11, 2010

The Julipedia (Blog)

Installing NetBSD/macppc on a Mac Mini G4

Yesterday, I spent a while installing NetBSD/macppc 5.0.1 on a Mac Mini G4. The process wasn't easy, as it involved the following steps. I'm omitting many details, as they are "common knowledge" to Mac users (or otherwise can be easily found on the net):&lt;br /&gt;&lt;ul&gt;&lt;li&gt;After booting the installer from the CD image, drop into the shell.&lt;/li&gt;&lt;li&gt;Use &lt;tt&gt;pdisk&lt;/tt&gt; to create an &lt;tt&gt;Apple_HFS&lt;/tt&gt; partition for the boot loader and two &lt;tt&gt;Apple_UNIX_SVR2&lt;/tt&gt; partitions, one for the root file system and another for swap.&lt;/li&gt;&lt;li&gt;Run &lt;tt&gt;sysinst&lt;/tt&gt; and install the system. When asked to repartition the disk, just say &lt;i&gt;Use existing partition sizes&lt;/i&gt;.&lt;/li&gt;&lt;li&gt;Once the system is installed, drop again into the shell before rebooting.&lt;/li&gt;&lt;li&gt;Mount your hard disk into &lt;tt&gt;/mnt&lt;/tt&gt; and chroot into it.&lt;/li&gt;&lt;li&gt;Fetch a copy of pkgsrc.&lt;/li&gt;&lt;li&gt;Install the &lt;tt&gt;sysutils/hfsutils&lt;/tt&gt; package.&lt;/li&gt;&lt;li&gt;Use &lt;tt&gt;hformat&lt;/tt&gt; to create a new HFS file system in the &lt;tt&gt;Apple_HFS&lt;/tt&gt; partition we created.&lt;/li&gt;&lt;li&gt;Mount the installation CD.&lt;/li&gt;&lt;li&gt;Copy, using &lt;tt&gt;hcopy&lt;/tt&gt;, the &lt;tt&gt;ofwboot.xcf&lt;/tt&gt; file from the CD to the boot partition.&lt;/li&gt;&lt;li&gt;Reboot.&lt;/li&gt;&lt;li&gt;Drop into the OpenFirmware setup (Command+Option+P+R).&lt;/li&gt;&lt;li&gt;Set &lt;tt&gt;boot-device&lt;/tt&gt; to &lt;tt&gt;hd:,\ofwboot.xcf&lt;/tt&gt;.&lt;/li&gt;&lt;li&gt;Set &lt;tt&gt;boot-file&lt;/tt&gt; to &lt;tt&gt;netbsd&lt;/tt&gt;.&lt;/li&gt;&lt;li&gt;And here is the tricky thing to get the machine to auto-boot: Set &lt;tt&gt;boot-command&lt;/tt&gt; to &lt;tt&gt;." hello" cr " screen" output boot&lt;/tt&gt;, not &lt;tt&gt;mac-boot&lt;/tt&gt;.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;I found the last command somewhere on the Internet (dunno where now), but, supposedly, a regular &lt;tt&gt;mac-boot&lt;/tt&gt; should have worked. In fact, it works if you call this command from the prompt, but not during automatic boot. (It turns out to be a problem with the version of OpenFirmware I have.)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Just writing down the steps in case I need them later on. Installing Debian stable was much, much easier, but the installer for testing crashes every day with a different error, so I gave up.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;(Oh, by the way, I did the same installation into an old PowerMac G3 and that was really painful. The machine refused to boot from any of the CDs I tried and the prebuilt kernels hang during initialization due to a bogus driver. In the end: netbooting and using custom kernels.)&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17885055-1422463512138756573?l=blog.julipedia.org' alt='' /&gt;&lt;/div&gt;</content>

by Julio Merino at January 11, 2010 11:48 PM

December 21, 2009

FreeBSD Diary

Upgrading PostgreSQL

Upgrading the client, then the server

December 21, 2009 12:48 AM

November 16, 2009

The Julipedia (Blog)

Processing Makefile.am with M4

ATF's Makefile.am, which is a single Makefile for the whole tree, was already at the 1300 lines mark and growing. At this size, it is unmanageable, and a quick look at its contents reveals tons of repeated delicate code.&lt;br /&gt;&lt;br /&gt;Why so much repeated code, you ask, if the whole point of Automake is to simplify Makefiles? Automake does in fact simplify Makefile code when you define targets known by Automake, such as binaries and/or libraries. However, as soon as you start doing fancy things with documentation, building tons of small programs or messing with shell scripts, things get out of control because you are left on your own to define their targets and their necessary build logic.&lt;br /&gt;&lt;br /&gt;Up until now, I had just kept up with the boilerplate code... but now that I'm starting to add pretty complex rules to generate HTML and plain text documentation out of XML files, the complexity must go. And here comes my solution:&lt;br /&gt;&lt;br /&gt;I've just committed an experiment to &lt;a href="http://mtn-host.prjek.net/viewmtn/atf/revision/info/aca66742e00b236d0b6dcb22ae70468736b612bc"&gt;process Makefile.am with M4&lt;/a&gt;. I've been trying to look for prior art behind this idea and couldn't find any, so I'm not sure how well this will work. But, so far, this has cut down 350 lines of Makefile.am code.&lt;br /&gt;&lt;br /&gt;How does this work? First of all, I've written a script to generate the Makefile.am from the Makefile.am.m4 and put it in admin/generate-makefile.sh. All this script does is call M4, but I want to keep this logic in a single place because it has to be used from two call sites as described below.&lt;br /&gt;&lt;br /&gt;Then, I've added an autogen.sh script to the top-level directory that generates Makefile.am (using the previous script) and calls autoreconf -is. I'm against autogen.sh scripts that pretend to be smart instead of just calling autoreconf, but in this case I see no other way around it.&lt;br /&gt;&lt;br /&gt;At last, I've modified Makefile.am to add an extra rule to generate itself based on the M4 version. This, of course, also uses generate-makefile.sh.&lt;br /&gt;&lt;br /&gt;We'll see how this scales, but I'm so far happy with the results.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17885055-5706562320936440325?l=blog.julipedia.org' alt='' /&gt;&lt;/div&gt;</content>

by Julio Merino at November 16, 2009 03:48 PM

Extending sudo credentials

If you use sudo for, e.g. pkgsrc's just-in-time su, you may have often bitten by the problem that some compilations are slow and the build process stops right in the middle to ask you for a root password. If you go away while the system compiles, you'll be frustrated when you come back, as the process may still well be at the very beginning.&lt;br /&gt;&lt;br /&gt;This happens because, unless disabled by the system administrator, your sudo credentials last for 5 minutes. If you hadn't used sudo for those 5 minutes, it will ask you for your password again. A simple workaround for the problem is to automatically renew your credentials, say, every 2 minutes. You can do this by running the following command (from the same console you are using later on!) right before starting a pkgsrc build:&lt;pre&gt;$ ( while :; do sudo -v; sleep 120; done ) &amp;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17885055-190748834219167977?l=blog.julipedia.org' alt='' /&gt;&lt;/div&gt;</content>

by Julio Merino at November 16, 2009 03:48 PM

Best config setting ever

&lt;pre&gt;echo 'set editing-mode vi' &gt;&gt;~/.inputrc&lt;/pre&gt;This will enable vi-editing mode for all commands that use the GNU readline library (e.g. bash, python, bc, etc.), not only the shell. For the shell only (including non-bash shells), add 'set -o vi' to your shrc file.&lt;br /&gt;&lt;br /&gt;I don't know why I didn't do this before given that I'm a pretty hard vi user. Still, for some reason, I kept using emacs-like key bindings for command-line editing. Not any more! However, be careful: if you are used to vim's visual editing mode, you'll keep hitting 'v' in the command line and getting super annoyed.&lt;br /&gt;&lt;br /&gt;Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17885055-1338186479268297089?l=blog.julipedia.org' alt='' /&gt;&lt;/div&gt;</content>

by Julio Merino at November 16, 2009 03:48 PM

1000 revisions for ATF

Mmm! Revision &lt;a href="http://mtn-host.prjek.net/viewmtn/atf/revision/info/7ca234b9aceabcfe9a8a1340baa07d6fdc9e3d33"&gt;7ca234b9aceabcfe9a8a1340baa07d6fdc9e3d33&lt;/a&gt;, committed about an hour ago, marks the 1000th revision in the ATF repository. Thanks for staying with me if you are following the project :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17885055-681908603179050098?l=blog.julipedia.org' alt='' /&gt;&lt;/div&gt;</content>

by Julio Merino at November 16, 2009 03:48 PM

Books by Joel Spolsky

I just finished reading the third book in a row from Joel Spolsky, titled Joel on Software. Before this one, I read More Joel on Software and The Best Software Writing 1, all in a bit over a month. Note: I hadn't read any book cover-to-cover for a loooong while. Very interesting and entertaining books; highly recommended.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Oh, and his writing style is really enjoyable. We, crappy blog writers, can learn a lot from him!&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17885055-9020484380911179497?l=blog.julipedia.org' alt='' /&gt;&lt;/div&gt;</content>

by Julio Merino at November 16, 2009 03:48 PM

Rearchitecting ATF

During the last few weeks, I've been doing some ATF coding and, well... I'm not happy. At all. I keep implementing features but I feel, more and more, that ATF is growing out of control and that it is way too sluggish. It oughtn't be so slow. About 6 minutes to run the whole test suite in a Mac G3 I just got? HA! I bet I can do much, much, much better than that. Come on, we are targeting NetBSD, so we should support all those niche platforms rather well, and speed matters.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The thing is, the current code base grew out of a prototype that didn't have that much of a design. Well, it had a design but, in my opinion, it has turned to be a bad design. I couldn't imagine that we could hit the bottlenecks (speed) and user-interface issues (for example, the huge difficulties that involve debugging a failing test case) that we are hitting. So...&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;IT IS TIME FOR A CHANGE!!!&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I'm currently working on a written specification of what ATF will look like, hopefully, in the not-so-distant future. It will take a while to get there, but with enough effort, we soon will. And life will be better. And no, I'm not talking about a from-scratch rewrite; that'd only hurt the project. I plan to take incremental and safe steps, keeping the code base running all the time, but I will do a major face-lift of everything. (I wish I could say "we" instead of "I" here. But not there yet.)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Why am I writing a specification, you ask? Well, because that forces me (or ANY developer) to think how I want the thing to look like and to decide, exactly, on what the design will be, which technologies will be used, which languages will be involved and in what components, etc. And no, I'm not talking of a class model design; I'm just talking about the main design of the whole picture, which is quite hard by itself. Plus having a spec will allow me to show it to you before I start coding and you will say "oh, wonderful, this new design sucks so much that I'm not going to bother with the new version". Or maybe hell will freeze and you will think, "mmm, this looks interesting, maybe it will solve these issues I'm having as regards speed, ease of debugging and ease of use".&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Anyway, I hope to have a draft "soon" and to hear any of the two possible comments as a result!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Edit (July 29th)&lt;/b&gt;: Alright, I have uploaded an &lt;a href="http://www.netbsd.org/~jmmv/rearchitecting-atf/spec.html"&gt;extremely preliminary copy of the specification&lt;/a&gt; just so that you can see where my current ideas are headed. Expect many more changes to this document, so don't pay too much attention to the tiny details (most of which aren't there anyway yet).&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17885055-4743147252783979430?l=blog.julipedia.org' alt='' /&gt;&lt;/div&gt;</content>

by Julio Merino at November 16, 2009 03:48 PM

The mess of ATF's code

Yes. ATF's code is a "bit" messy, to put it bluntly. I'm quite happy with some of the newest bits but there are some huge parts in it that stink. The main reason for this is that the "ugly" parts were the ones that were written first, and they were basically a prototype; we didn't know all the requirements for the code at that point... and we still don't know them, but we know we can do much better. Even though I'm writing in plural... I'm afraid we = I at the moment :-P&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So, is it time for the big-rewrite-from-scratch? NO! Joel Spolsky wrote about why &lt;a href="http://www.joelonsoftware.com/articles/fog0000000348.html"&gt;this is a bad idea&lt;/a&gt; and I have to agree with him. Yeah, I'm basically the only developer of the code so everything is in my head, and I'd do a rewrite with a fresh mind, but... I'd lose tons of work and, specially, I'd lose tons of code that deals with tricky corner-cases that are hard to remember.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Sure, I want to clean things up but they'll happen incrementally. And preferably concurrently with feature additions. These two things could definitely happen at the same time if only I had infinite spare time...&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Anyway, the major point of this post is to describe what I don't like about the current code base and how I'd like to see it changing:&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;A completely revamped C++ API for test cases. The current one sucks. It is not consistent with the C API. It lacks important functionality. It uses exceptions for test-case status reporting (yuck!). And it's ugly.&lt;/li&gt;&lt;li&gt;Clear separation of "internal/helper" APIs from the test APIs. You'll agree that the "fs" module, which provides path abstraction and other file system management routines, is something that cannot be part of ATF's API. ATF is about testing. Period. Either that fs module should be in a separate library or should be completely hidden from the public. Otherwise, it'll suffer from abuse and, what scares me, will have to become part of ATF's API. And likewise, most &amp;mdash; really &amp;mdash; most of the modules in the current code are internal.&lt;/li&gt;&lt;li&gt;Less dependencies from the C++ API to the C API. Most of the current C++ modules are wrappers of their corresponding C counterparts. This is nice for code reuse but makes the code extremely fragile. In C++, things like RAII can provide really robust code with minimum effort, but intermixing such C++ code with C makes things ugly really quickly. I'd like to find a way to keep the two libraries separate from each other (and thus keep the C++ binding "pure"), but at the same time I don't want to duplicate code... an interesting problem.&lt;/li&gt;&lt;li&gt;Split the tarball into smaller pieces. People writing test cases for C applications don't want to pull in a huge package that depends on C++ and whatnot. And ATF is huge. It takes forever to compile. And this is a serious issue for broad adoption. Note: whether the tools are written in C++ or not is a separate issue, because these are not a dependency for anything!&lt;/li&gt;&lt;li&gt;The shell binding is slow. Really slow compared to the other ones. Optimizations would be nice, but those do not address the root of the problem: it's costly to query information from shell-based tests at run time. I.e. it takes a long time to get the full list of test cases available in a test suite because you have to run every single test program with the -l flag. Keeping a separate file with test-case metadata alongside the binary could resolve this and allow more flexibility at run time.&lt;/li&gt;&lt;li&gt;And some other things.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;Those are the major things I'd like to see addressed soon, but they involve tons of work. Of course, I'd like to be able to work on some features expected by other developers: easier debugging, DOCUMENTATION!...&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So, helpers welcome :-)&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17885055-8981481737885658422?l=blog.julipedia.org' alt='' /&gt;&lt;/div&gt;</content>

by Julio Merino at November 16, 2009 03:48 PM