laserwriter, MDQS, communication problems
Susan Richter
richter at randvax.UUCP
Thu Feb 6 06:10:33 AEST 1986
I am having a strange problem with my LaserWriter server under MDQS.
The behavior I see is this: whenever the daemon is started up during boot
(in /etc/rc.local), my status- and page-accounting stuff fails because
the "listener" child (which is trying to listen on a dup of stdout,
attached to the device) can't hear anything. When I use the exact same
startup routine but do it myself from a tty, everything works fine.
Now, here is what actually happens (describing the case of starting from boot):
The mdqsdaemon starts and goes through its init procedure, which:
forks a child and the parent suicides, thereby detaching the daemon;
closes all file descriptors greater than 2;
doesn't do anything to fds 0, 1, or 2.
When a request needs to be done, the daemon:
opens the device (in this case, the laserwriter, which is on a tty line
and has permissions 666) *for reading and writing* (this succeeds);
dups that to fd 1;
(I put in an fcntl() call to check the mode of fd 1, and already
at this point it says it's only open for writing! How can this be?)
forks/execs the server, which:
dups fd 1, for listening to the LaserWriter's status reports;
forks a child to do the listening:
child tries to fdopen it for reading, fails, and returns. . .
the printing goes fine, server returns.
Again, when the daemon is killed and restarted by hand, this all works
fine. The only difference I can see is that when it's started from boot,
it runs not attached to a terminal (ps shows "?"), and when I start it
by hand, it shows attached to my tty.
Here's the fragment of rc.local that starts it up, and I use the same
script to start it by hand, using "sh script" while su'd to root:
-------------------------------------------------------------------------
if [ -d /usr/local/lib/mdqs ]; then
rm -f /usr/spool/mdqs/qtmp/*
date >> /usr/spool/mdqs/LOGFILE
/usr/local/lib/mdqs/mdqsdaemon >> /usr/spool/mdqs/LOGFILE 2>&1 &
(cd /usr/local/lib/mdqs; \
netdae -n 4 /usr/local/lib/mdqs/netrecv >> /usr/spool/mdqs/LOGFILE 2>&1) &
/usr/local/clearlw /dev/lw2
echo -n ' mdqs' >/dev/console
fi
-------------------------------------------------------------------------
Any help or suggestions will certainly be appreciated!
- Susan Richter
richter at rand-unix.ARPA
...!decvax!philabs!ttidca!randvax!richter
...!ihnp4!wlbr!trwrb!randvax!richter
>From postnews Wed Feb 5 12:07:17 1986
Subject: laserwriter, MDQS, communication problems
Newsgroups: mod.computers.laser-printers,net.unix-wizards
Distribution: net
I am having yet another problem with my LaserWriter server under MDQS.
The behavior I see is this: whenever the daemon is started up during boot
(in /etc/rc.local), my status- and page-accounting stuff fails because
the "listener" child (which is trying to listen on a dup of stdout,
attached to the device) can't hear anything. When I use the exact same
startup routine but do it myself from a tty, everything works fine.
Now, here is what actually happens (describing the case of starting from boot):
The mdqsdaemon starts and goes through its init procedure, which:
forks a child and the parent suicides, thereby detaching the daemon;
closes all file descriptors greater than 2;
doesn't do anything to fds 0, 1, or 2.
When a request needs to be done, the daemon:
opens the device (in this case, the laserwriter, which is on a tty line
and has permissions 666) *for reading and writing* (this succeeds);
dups that to fd 1;
(I put in an fcntl() call to check the mode of fd 1, and already
at this point it says it's only open for writing! How can this be?)
forks/execs the server, which:
dups fd 1, for listening to the LaserWriter's status reports;
forks a child to do the listening:
child tries to fdopen it for reading, fails, and returns. . .
the printing goes fine, server returns.
Again, when the daemon is killed and restarted by hand, this all works
fine. The only difference I can see is that when it's started from boot,
it runs not attached to a terminal (ps shows "?"), and when I start it
by hand, it shows attached to my tty.
Here's the fragment of rc.local that starts it up, and I use the same
script to start it by hand, using "sh script" while su'd to root:
-------------------------------------------------------------------------
if [ -d /usr/local/lib/mdqs ]; then
rm -f /usr/spool/mdqs/qtmp/*
date >> /usr/spool/mdqs/LOGFILE
/usr/local/lib/mdqs/mdqsdaemon >> /usr/spool/mdqs/LOGFILE 2>&1 &
(cd /usr/local/lib/mdqs; \
netdae -n 4 /usr/local/lib/mdqs/netrecv >> /usr/spool/mdqs/LOGFILE 2>&1) &
/usr/local/clearlw /dev/lw2
echo -n ' mdqs' >/dev/console
fi
-------------------------------------------------------------------------
Any help or suggestions will certainly be appreciated!
- Susan Richter
richter at rand-unix.ARPA
...!decvax!philabs!ttidca!randvax!richter
...!ihnp4!wlbr!trwrb!randvax!richter
--
richter at rand-unix.ARPA
...!decvax!philabs!ttidca!randvax!richter
...!ihnp4!wlbr!trwrb!randvax!richter
More information about the Comp.unix.wizards
mailing list