Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!chinacat!chip From: chip@chinacat.unicom.com (Chip Rosenthal) Newsgroups: comp.unix.sysv386 Subject: Re: TIOCNOTTY under SCO System V/386 Keywords: TIOCNOTTY Message-ID: <1991Jun21.171242.15171@chinacat.unicom.com> Date: 21 Jun 91 17:12:42 GMT References: <54@jeanluc.UUCP> Organization: Unicom Systems Development, Inc. Lines: 45 In article <54@jeanluc.UUCP> stockett@jeanluc.UUCP (Jeffrey M. Stockett) writes: >I'm trying to port over some code from a BSD machine to SCO System V/386, >and I have run into a problem with [TIOCNOTTY] Following code is from Richard Steven's daemon_start() routine. This is all explained in his book `UNIX Network Programming'. It's a good book and Richard is a great guy - I think y'all should buy two or three copies. Sources are on UUNET in (I think) ~/networking/netprog.tar.Z. /* * First child process. * * Disassociate from controlling terminal and process group. * Ensure the process can't reacquire a new controlling terminal. */ #ifdef SIGTSTP /* BSD */ if (setpgrp(0, getpid()) == -1) err_sys("can't change process group"); if ( (fd = open("/dev/tty", O_RDWR)) >= 0) { ioctl(fd, TIOCNOTTY, (char *)NULL); /* lose controlling tty */ close(fd); } #else /* System V */ if (setpgrp() == -1) err_sys("can't change process group"); signal(SIGHUP, SIG_IGN); /* immune from pgrp leader death */ if ( (childpid = fork()) < 0) err_sys("can't fork second child"); else if (childpid > 0) exit(0); /* first child */ /* second child */ #endif -- Chip Rosenthal 512-482-8260 | Closed user interfaces for open systems? Unicom Systems Development | No, thank you. | Boycott Lotus Development Corp.