On Tue, 30 Sep 2003, Patrick Powell wrote: > > The tcdrain() function does this as well. However, I sure wish there > was a non-blocking version of this.
You can avoid the blocking issue by fork()ing a child process which calls tcdrain(). The parent process then forgets about this child process and terminates normaly while the child process is waiting for tcdrain() to terminate and the child process will then close the printer port and exit. Closing the printer port in the parent process while the child process is running has no effect. Only the last close of the printer port is critical. Don't worry about zombies either, the child process will be orphaned as soon as the parent process is terminated, and the init will then take care of the zombie eventualy. Making a daemon whith the sole purpose to have the printer port open is probably simpler. You then start it from one of the rc scripts, and as long as this daemon is running the printer port will never see the last close and therefore never reset. The following inittab entry may do the trick for the port /dev/ttyxxx. 1:12345:respawn:sleep 200000 < /dev/ttyxxx Villy ----------------------------------------------------------------------------- YOU MUST BE A LIST MEMBER IN ORDER TO POST TO THE LPRNG MAILING LIST The address you post from MUST be your subscription address If you need help, send email to [EMAIL PROTECTED] (or lprng-requests or lprng-digest-requests) with the word 'help' in the body. For the impatient, to subscribe to a list with name LIST, send mail to [EMAIL PROTECTED] with: | example: subscribe LIST <mailaddr> | subscribe lprng-digest [EMAIL PROTECTED] unsubscribe LIST <mailaddr> | unsubscribe lprng [EMAIL PROTECTED] If you have major problems, send email to [EMAIL PROTECTED] with the word LPRNGLIST in the SUBJECT line. -----------------------------------------------------------------------------
