Help with printing on SunOS 4.1

chou%csd.hku.hk at cunyvm.cuny.edu chou%csd.hku.hk at cunyvm.cuny.edu
Mon Jan 7 06:59:59 AEST 1991


Our site has a Sun 3/280S and it's been upgraded from SunOS 3.2 to 4.1. We
have 3 LaserWriters (2 IINTX, 1 IINT). All of them are connected to normal
terminal ports. After the upgrade, these terminal ports hung imtermittenly
after printing a few pages randomly (as far as we've noticed). Once it
hung and if "lprm" was used to remove the job, the data and control files
in the spool were cleared alright but then it left an idle "lpd" process
around. When we killed the lpd either with "lpc" or manually, the process
became a zombie and wouldn't die with the following status:

F UID   PID  PPID CP PRI NI  SZ  RSS WCHAN    STAT TT  TIME COMMAND
8401   0 20198 16152  0   3  0  72    0 usrpt    I    ?   0:00 <exiting>

We've tried restarting the printers with "lpc", the newly forked "lpd"
became idled after writing its PID to the lock file in the spool
directory. We have to hook the serial port to a terminal and send a
control-D or break to free up the port manually.

Here's a printcap entry for one of these printer:

lw|Laserwriter II NTX:\
        :lp=/dev/lw:sd=/usr/spool/lwd:\
        :fs#0322:fc#055:pl#66:sh:rw:\
        :if=/usr/local/lib/lw/lwf:\
        :af=/usr/adm/lwacct:\
        :br#19200:lf=/usr/adm/lwd-errs:

The LaserWriters are all configured with parity none and 25-pin serial
port.

The input filter basically just prepends some local Postscript header
files and uses a very simple protocol with the printer to get the
pagecount. Below is an excerpt of the code:

/*
 *  ask LaserWriter the total number of pages printed
 */
pagecount()
{
        char    s[100];
        FILE    *fp, *fopen();
        int     p;

        if ((fp = fopen("/dev/lw","r")) == NULL) {
                fprintf(stderr,"unable to open %s", LW);
                exit(2);
        }
        alarm(300);     /* cancel the job after 300 seconds if no response */
        printf("\n\n");
        while (fgetc(fp) != '');
        printf("statusdict begin pagecount = (\\n) print flush end\n");
        fgets(s,100,fp);
        alarm(0);       /* cancel alarm */
        p = atoi(s);
        fclose(fp);
        return p;
}

the filter did trap SIGINT and call pagecount().

The dev entry for the printer is:

crw-rw----  2 root     daemon    10,   4 Jan  6 14:44 /dev/lw
crw-rw----  2 root     daemon    10,   4 Jan  6 14:44 /dev/tty04

BTW, all our terminal ports are connected through the Systech MTI-1600
interface.  This problem is driving me nuts and I would very much
appreciate any advice/solution.

Thanks in advance
chou at csd.hku.hk



More information about the Comp.sys.sun mailing list