Writing an Alphanumeric Pager Server for Linux
Now we can fit the pieces of the puzzle together to come up with our server.
The main server will read in configuration and data files (where to find things, the list of protocols it knows about, the available devices, etc.). It then goes into its main loop.
If we support multiple devices, use waitpid and its WNOHANG option (so that the server will merely see if any subprocesses have finished, as opposed to waiting indefinitely—and blocking all other server activities until a subprocess does finish) to determine whether any jobs have finished being delivered; remove them from the queue if they have.
Then, check to see whether a device is available and a new job is ready to be delivered; if both are true, then take the following steps. First, determine the profile and the message from the job. Then, get the next available device and lock it, so our delivery will not receive any interference. After that, filter the message (if appropriate), and finally, start up a subprocess to deliver it.
Erik Max Francis is a UNIX engineer who lives in San Jose, California. His main interests are programming, Linux, physics and mathematics. He's been using Linux at home exclusively since kernel version 1.2.8 and has been reading and contributing avidly to Usenet since 1989. He can be reached via e-mail by firstname.lastname@example.org.
- Nmap—Not Just for Evil!
- Resurrecting the Armadillo
- High-Availability Storage with HA-LVM
- March 2015 Issue of Linux Journal: System Administration
- Real-Time Rogue Wireless Access Point Detection with the Raspberry Pi
- DNSMasq, the Pint-Sized Super Dæmon!
- Localhost DNS Cache
- Days Between Dates: the Counting
- The Usability of GNOME
- Linux for Astronomers