Blog O' Matty


Why SIGHUP?

This article was posted by Matty on 2006-02-08 18:29:00 -0400 -0400

Earlier this week I sent a SIGHUP signal to a process to get it to reread it’s configuration file. Of all the signals that could have been chosen to perform this action, why SIGHUP? Well – the answer to this question comes on page 267 of Advanced Programming in the UNIX Environment 1st edition:

“This signal [SIGHUP] is commonly used to notify daemon processes (Chapter 13) to reread their configuration files. The reason SIGHUP is chosen for this is because a daemon should not have a controlling terminal and would normally never receive this signal."*

Richard Stevens is my favorite technical writer of all time. He uses tons of well though out examples, and tackles subjects in a logical order (this is my biggest beef with some books). I miss him.

Apache presentation

This article was posted by Matty on 2006-02-07 10:43:00 -0400 -0400

I gave a presentation titled Apache internals and debugging at last night’s Atlanta UNIX users group meeting. The meeting was a blast, and I would like to thank all of the folks who attended (and for putting up with me). When I was putting together the presentation slides, I knew I wouldn’t be able to thoroughly cover all of the topics in 45-minutes (you may have noticed that I zoooooomed through the presentation – this is why). After pondering the number of slides, I decided to leave the presentation as is so people could reference the material when debugging Apache problems. Since my DTrace overview and demos didn’t begin to touch the surface of what DTrace can do, I truly hope everyone pings their Sun sales representative to get get Bryan, Mike or Adam to wander to Atlanta to present at a future AUUG meeting. Hope folks had as much fun as I did!

Watching hook processing order

This article was posted by Matty on 2006-02-06 14:56:00 -0400 -0400

While perusing through the Apache source code, I came across this nifty little nugget of code in config.c:

if (getenv("SHOW_HOOKS")) {
printf("Registering hooks for %sn", m->name);
apr_hook_debug_enabled = 1;
}

The getenv() call will check for an environment variable names SHOW_HOOKS. If the variable is set, Apache will display the hook processing order on stdout:

$ export SHOW_HOOKS=1

$ httpd -X |more

Registering hooks for core.c
Hooked create_connection
Hooked pre_connection
Hooked post_config
Hooked translate_name
Hooked map_to_storage
Hooked open_logs
Hooked child_init
Hooked handler
Hooked type_checker
Hooked fixups
Hooked access_checker
Hooked create_request
Hooked create_req
Hooked pre_mpm
Hooked insert_filter
Registering hooks for prefork.c

This information can be useful when debugging hook placement (e.g., APR_HOOK_FIRST, APR_HOOK_LAST) issues, and is great for understanding the order in which hooks are executed.

Viewing wireless networks with wigle

This article was posted by Matty on 2006-01-28 00:42:00 -0400 -0400

I heard about the wigle and restyredwagon websites sites a while back, and finally had a chance to look through their content tonight. If you haven’t heard of these nifty sites, they both contain geographic maps of 802.11 wireless networks. Since the rustyredwagon website overlays wigle data on google maps, you can click a location and get a wealth of information (e.g., SSID, Mac Address, Vendors, and a keyword indicating if WEP/WPA is utilized) on the 802.11 networks in a region. You can also view satellite photos, which adds a whole new twist to scouting out 802.11 networks ( can we call this war surfing?). These sites are fricking awesome!

jot it up

This article was posted by Matty on 2006-01-28 00:08:00 -0400 -0400

While reading through UNIX powertools tonight, I came across jot. This nifty little utility will print a sequence of numbers, which can be used to iterate through a loop:

for i in `jot 5`; do
    echo $i
done

Using jot in this way is typically faster than other mechanisms (e.g., i=expr $i+1), and is easier to read IMHO. Jot it up yizos!