From owner-freebsd-current Thu Nov 18 20: 2:20 1999 Delivered-To: freebsd-current@freebsd.org Received: from apollo.backplane.com (apollo.backplane.com [216.240.41.2]) by hub.freebsd.org (Postfix) with ESMTP id 6AB6F15282 for ; Thu, 18 Nov 1999 20:02:18 -0800 (PST) (envelope-from dillon@apollo.backplane.com) Received: (from dillon@localhost) by apollo.backplane.com (8.9.3/8.9.1) id UAA90075; Thu, 18 Nov 1999 20:02:01 -0800 (PST) (envelope-from dillon) Date: Thu, 18 Nov 1999 20:02:01 -0800 (PST) From: Matthew Dillon Message-Id: <199911190402.UAA90075@apollo.backplane.com> To: Luoqi Chen Cc: bde@zeta.org.au, current@FreeBSD.ORG, peter@netplex.com.au Subject: Re: init runs with console as control terminal? References: <199911190359.WAA06557@lor.watermarkgroup.com> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG : :> no control terminal == no signals == no ^C'ing hung programs during :> startup (for example, when you need to boot a machine without a working :> network and sendmail and other programs stop the boot sequence in its :> tracks trying to do DNS lookups). :> :> -Matt :> Matthew Dillon :> :> :Hmm, good point. So I still need to find a way to start up rc5des, it seems :that rc5des installs a SIGHUP handler and therefore nohup is useless. I wish :there were a noctty... : :-lq Your wish is my command ... I needed the same thing for BEST for many things. I call the program 'notty'. Included below. -Matt Matthew Dillon /* * NOTTY.C * * NOTTY [-012] */ #include #include #include #include #include #include #include #include #include main(ac, av) char *av[]; { char *opts = ""; int ttyfd; if (av[1]) { if (av[1][0] == '-') { opts = av[1]; ++av; } } ttyfd = open("/dev/null", O_RDWR); if (strchr(opts, '0') == NULL && ttyfd != 0) dup2(ttyfd, 0); if (strchr(opts, '1') == NULL && ttyfd != 1) dup2(ttyfd, 1); if (strchr(opts, '2') == NULL && ttyfd != 2) dup2(ttyfd, 2); if (ttyfd > 2) close(ttyfd); { int fd = open("/dev/tty", O_RDWR); if (fd >= 0) { ioctl(fd, TIOCNOTTY, 0); close(fd); } } /* signal(SIGCHLD, SIG_IGN); */ if (fork() == 0) { setpgrp(); exit(execvp(av[1], av + 1)); } exit(0); } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message