[comp.unix.wizards] DTR failure on DZ-11 ports

johnz@uoregon.UUCP (John Bruce Zuckerman) (01/29/88)

The university of Oregon Computer Science Dept. is experiencing the
following difficulty with its 4.3 BSD systems and we are soliciting
advice from others who may have a solution or explanation.

We are running several VAX 11/750's with attached DZ-11 serial
interfaces.  On very infrequent occasions, the DTR signal fails to be
raised on one or more of the DZ-11 ports.  This prevents users from
logging in on the affected ports.

The pattern of failure appears to be unpredictable.  Sometimes only a
single port is affected at a time, and apparently any of the ports of
our system may become the failing port.  At other times, more than one
port is affected.

We can treat the problem symptomatically by running a program which
forces the raising of the DTR signal on the affected port, however,
this is of only transitory benefit.

If you have experienced similar problems with your DZ-11 device(s), or
know of a permanent fix to the problem, please respond by mail.

John Zuckerman			UUCP:  ..{hp-pcd,tektronix}!uoregon!johnz
Systems Staff			CSnet: johnz@cs.uoregon.edu
University of Oregon, CS Dept.

wolfgang@mgm.mit.edu (Wolfgang Rupprecht) (01/30/88)

In article <1507@uoregon.UUCP> johnz@uoregon.UUCP (John Bruce Zuckerman) writes:
>We are running several VAX 11/750's with attached DZ-11 serial
>interfaces.  On very infrequent occasions, the DTR signal fails to be
>raised on one or more of the DZ-11 ports.  This prevents users from
>logging in on the affected ports.

I have seen this too. In my case it was always due to a process
running in the background with that port as the controling tty. I
guess that the tty never really got closed and getty couldn't run and
raise the DTR line.

I now run background jobs (that I want to start and forget) with no
controlling tty and no open tty devices. This has solved the stuck
port problem for me. Appended to the end of this message is a hack
program bgdo.c that runs an arbitrary unix command in the *far*
background with no controlling tty, and as a child of init.

--
Wolfgang Rupprecht	ARPA:  wolfgang@mgm.mit.edu (IP 18.82.0.114)
Freelance Consultant	UUCP:  mit-eddie!mgm.mit.edu!wolfgang
Boston, Ma.		VOICE: Hey_Wolfgang!_(617)_267-4365

/******************************************************************************
*									      *
*	File:     bgdo.c						      *
*	Author:   Wolfgang Rupprecht					      *
*	Created:  Wed Jan 27 10:19:07 EST 1988				      *
*	Contents: run a program in the FAR background.			      *
*		  the process gets orpahned, and adopted by init	      *
*		  and the controlling tty gets disowned.		      *
*									      *
*	Copyright (c) 1988 Wolfgang Rupprecht.				      *
*	Free use of this program is permitted, subject to the		      *
*	conditions that this header and copyright notice remain		      *
*	intact, and that this source file is freely available.		      *
*									      *
*	$Log$								      *
******************************************************************************/

#include <stdio.h>
#include <sgtty.h>
#include <sys/file.h>
#include <strings.h>

char           *progname;
void 		gripe(), fatal();

main(argc, argv)
	int             argc;
	char          **argv;
{
	char            buf[128], 
		       *cp;
	int             status;

	if (argc < 2)		/* no args, done */
		exit(0);

	cp = rindex (argv[0], '/'); /* find basename of this command */
	progname = cp ? (cp+1) : argv[0];

	cp = rindex (argv[1], '/'); /* find basename of program to be run */
	cp = cp ? (cp+1) : argv[1];

	(void) sprintf(buf, "%s.log", cp); /* tell'em where to find their
					      output */
	fprintf(stderr, "Sending output to %s\n", buf);
	_cleanup();		/* close ALL files */

	(void) open("/dev/tty", O_RDONLY, 0);	/* release controlling tty */
	(void) ioctl(0, TIOCNOTTY, (char *) 0);
	(void) close(0);

	(void) fopen("/dev/null", "r");	/* open new stdin */
	(void) fopen(buf, "w");	/* open new stdout */
	(void) dup(1);		/* dup it to new stderr */
	(void) fdopen(2, "w");	/* and open it proper */

	if ((status = fork()) > 0)	/* parent */
		exit(0);
	if (status < 0)		/* fork failed */
		fatal("first fork");
	if ((status = fork()) > 0)	/* parent */
		exit(0);
	if (status < 0)		/* fork failed */
		fatal("second fork");
	if (setpgrp(0, 1) < 0)
		gripe("setpgrp");	/* fatal ?? */
	execvp(argv[1], &argv[1]); /* finally, exec the requested command */
	fatal(argv[1]);		/* what, we're still here? There is an
				   error... gripe and quit. */
}

void
gripe(cp)
	char           *cp;
{
	char            buf[128];

	(void) sprintf(buf, "%s: %s", progname, cp);
	perror(buf);
}

void
fatal(cp)
	char           *cp;
{
	gripe(cp);
	exit(-1);
}
Wolfgang Rupprecht	ARPA:  wolfgang@mgm.mit.edu (IP 18.82.0.114)
Freelance Consultant	UUCP:  mit-eddie!mgm.mit.edu!wolfgang
Boston, Ma.		VOICE: Hey_Wolfgang!_(617)_267-4365