Subject: Re: DeskWriter daemon - suggestions?
To: None <macbsd-development@NetBSD.ORG>
From: Tim Barthel <>
List: macbsd-development
Date: 07/03/1995 11:34:23
I like Allen's suggestions about the daemon. I would be willing to help. I have
actually written serveral daemons. I own a Deskwriter ( pre-Appletalk) and I'm
dying to print from unix. Unfortunately, other than what is in my manual, I
don't have any specs on the printer. To summarize a quick off the cuff design

1) The daemon creates a server socket for the status. Each time a user process
connects to this socket we add it to an update list.

2) We open an fd on the tty to read the status from the printer. When we get a
new status, we check our update clients and broadcast the status to them. We
also maintian the last status internally. If we have no clients, we either
throw away the updates or log one every minute or something.

3) We provide another server socket for print requests. Each time we get a new
connection we add it to an ordered request list. Now we process the requests as
they arrive. Once we have a request to process, we loop writing some number of
bytes to the printer and the checking our read fd's.

4) We do a select with the update server socket, the request server socket, and
the fd from 2 as read fd's. When new info arrives on either, we process it
according to 1, 2, & 3.

What do you think? I'm not sure why you would want other processes accessing
the printer directly. In practice, all the printing I have ever done
professionally went through some kind of spooler.

Tim B.

      ===      | Timothy C. Barthel               email:
       #       | Programmer Analyst II
 ===   #   === | Production Systems Integrity, MS/8088 
  #    #    #  | International Billing Services           voice: 916 939-5832
  #    #    #  | 5220 Robert J. Mathews Parkway 
   #   #   #   | El Dorado Hills, CA  95762-5712            fax: 916 939-5531
    #######    |=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
       #       | 
  PSI  # CORPS | "The PSI Corps is your friend."
      ===      |