Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!rpi!uupsi!sunic!news.funet.fi!funic!santra!fuug!demos!dvv From: dvv@hq.demos.su (Dmitry V. Volodin) Newsgroups: comp.unix.xenix.sco Subject: Re: How do you use ungetty? Message-ID: <1990Sep3.165541.10480@hq.demos.su> Date: 3 Sep 90 16:55:41 GMT References: <5540@minyos.xx.rmit.oz> Reply-To: dvv@hq.demos.su (Dmitry V. Volodin) Organization: DEMOS, Moscow, USSR Lines: 64 In article <5540@minyos.xx.rmit.oz> s892024@minyos.xx.rmit.oz (Richard Muirden [G.A.]) writes: >Hi, this is rather desperate! > >I need to diable getty running on /dev/tty1A while making a call out >with a specialised dialer (ie: not uucp/cu) which is done automatically >every morning. thus I want to rerun getty when the call has finished >to reenable calls on that line. > >I believe that ungetty is what I need but there is **nothing** in the >docs about it. I am running SCO Xenix/386 2.3.2 > >Any help wanted/needed and apprieciated!! :-) > 1) You should create /usr/spool/uucp/LCK..tty??? (LOWERCASE tty e.g. tty1a)! 2) You should do a trick with open/ioctl on the line (a piece of code from /usr/lib/uucp/dialHA24.c ): --------- CUT --------- /* ........ */ /* * Must open with O_NDELAY set or the open may hang. */ if ((fd = open(acu, O_RDWR | O_NDELAY)) < 0) { fprintf(stderr, "dial: Can't open device: %s\n", acu); exit(RC_FAIL | RCE_OPEN | retcode); } /* * set line for no echo and correct speed. * We will issue commands to the Hayes 2400 at the highest possible * baud rate to encourage connection at the highest baud rate. * If hanging up, issue commands at 2400 to enable auto answer * at 2400. */ signal(SIGINT, abort); errflag = ioctl(fd, TCGETA, &term); term.c_cflag &= ~(CBAUD | HUPCL); term.c_cflag |= CLOCAL | (hflag ? (B2400|HUPCL) : highbaud); term.c_lflag &= ~ECHO; term.c_cc[VMIN] = '\1'; term.c_cc[VTIME] = '\0'; errflag = ioctl(fd, TCSETA, &term); if (errflag) { char buf[16]; DEBUG(1, "dial: ioctl error on %s", acu); DEBUG(1, " errno=%d\n", errno); cleanup(RC_FAIL | RCE_IOCTL | retcode); } /* * Reopen line with clocal so we can talk without carrier present */ c = fd; /*!!!!*/if ((fd = open(acu, O_RDWR)) < 0) { fprintf(stderr, "dial: Can't open device local: %s\n", acu); exit(RC_FAIL | RCE_OPEN | retcode); } close(c); --------- CUT --------- Note the line marked /*!!!!*/. getty wakes up from waiting CD in this particular moment and, finding /usr/spool/uucp/LCK..tty???, goes sleep until this lock file is gone. Dima or