Version: 1.1

Posted: 2005-10-27

Build Requirements: Mac OS X 10.4, Xcode 2.1, gcc 4.0

Runtime Requirements: Mac OS X 10.4 or greater

View Source Code:

Download Sample (“SampleD.zip”, 27.1K)
Download Sample (“SampleD.dmg”, 87.2K)



Description

SampleD consists of two programs designed to demonstrate the use of the Apple System Logger (ASL) API as well as the basic construction and behavior of a launchd daemon.

"SampleD" is a basic launchd daemon that, when instantiated by launchd, will listen on a socket indefinitely. Launchd takes care of registering the socket before the daemon is even launched, so all this code needs to do is accept any incoming connections and then write a message to them. This code also demonstrates how to use Apple System Logger APIs to construct and issue well formatted logging information to the syslogd server.

"Report" is a program that demonstrates the use of ASL to query the syslogd server for log messages created by the SampleD daemon.

Document Revision History

Date Notes
2005-10-27Updated to produce a universal binary. No code changes were required. Separately, updated comments and code flow to improve readability and consistency.
2005-06-06Demonstrates use of launchd and Apple System Logger.

Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.