Archive for May, 2006


Wednesday, May 24th, 2006

This is great. I’ve complained about vacuous GUI help before, but I was just faced with the worst example I’ve ever seen.  I almost laughed out loud when I saw it.  A file chooser comes up in this tool, and glued onto the left hand side of the file chooser is this fine specimen of useful information:

Open Local Toolbox

The folders and toolboxes in the current folder are listed, folders first; toolboxes have a .tbx suffix.

1. Change folders, if necessary.

If the toolbox file is not in the current folder, select the appropriate folder from the “Look in” pulldown menu or type in the folder path in the “Filename” field and press Return.
To move up one folder, click the “Open parent folder” button to the right of the pulldown menu.

To move to your home folder, click the “Go to home folder” button.

2. Select the toolbox file you wish to open from the list or type the name in the Filename field and press Return.

The name of the file is displayed in the Filename field and its description in the Description field.

3. Click Open.

If you were opening a local toolbox from the Console menu, the selected toolbox displays in the Console. Depending on [Preferences] settings, the selected toolbox is displayed in the Console or the Login dialog is displayed above the Console.

If you were specifying your home toolbox in the Preferences dialog, the Preferences dialog is displayed, with the selected toolbox inserted in the Location field.

Of course, the tool is completely incapable of doing anything until you point it at a “toolbox”, and the help says nothing about what toolboxes might be preinstalled on your system, or how you might create a toolbox, or how you might find a toolbox on a server.  You just have to know that part.  But in case you knew all that and didn’t know how to use a file chooser…  In that case, you’re covered.

vfork and posix_spawn

Wednesday, May 17th, 2006

I’m not sure why this paper got called “Minimizing Memory Usage for Creating Application Subprocesses”, it should have been called “MT-safe vfork and posix_spawn“.  When UNIX was developed, processes were single-threaded, and this had some strong influences on a few of its basic mechanisms.  vfork() is one of those mechanisms.  If you’ve ever been bit by a thread deadlock inside the some goofy runtime linker routines, or if you’re interested in UNIX guts like fork and exec, read Greg’s paper for more information.

Getting started with dtrace

Friday, May 12th, 2006

Vijay forwarded me an email from Eugene and here’s what I wrote:

Eugene wrote:
I have a code and I'd like to figure out where the user code is
when brk is being called.  Can this be done with truss?  If it's
done with dtrace I need some serious handholding.  Canned
scripts (or whatever) would be nice since I need to resolve this
in a hurry.

Here is what I recommend:

1. download/untar the DTrace toolkit

2. run this command to see the stacks of all places that call brk

./DTraceToolkit-0.96/Bin/dtruss -s -t brk /bin/ls

Unless you give yourself dtrace permissions in /etc/user_attr, you will need to be root to run dtrace. The toolkit has a bunch of scripts in it that do wonderful things. And all without knowing anything about dtrace.

I went ahead and fiddled with dtrace for a bit, and here’s what I came up with:

% dtrace -n 'pid$target::sbrk:entry { @num[ustack()] = count()}' -c "find /usr -name 'xyzzy'"

dtrace: description 'pid$target::sbrk:entry ' matched 1 probe
dtrace: pid 17201 terminated by SIGINT



The number after each stack shows the number of times that stack trace was encountered.

Oh yeah. Did I tell you how much I hate the wysiwyg editor I’m using in Roller? Of course, once I get the content in the little box, it’s too much trouble to change editors. I took me almost as long to get the preformatted text right as to write the email, figure out the script and write the rest of this blog.

Silly me. I forgot about using Xinha! It’s in my firefox, but I forgot all about it.  I’m using it to add this last paragraph, and it’s working fine.