From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2414 invoked from network); 4 May 2000 10:55:44 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 4 May 2000 10:55:44 -0000 Received: (qmail 1355 invoked by alias); 4 May 2000 10:55:19 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 11146 Received: (qmail 1336 invoked from network); 4 May 2000 10:55:18 -0000 X-Envelope-Sender-Is: Andrej.Borsenkow@mow.siemens.ru (at relayer goliath.siemens.de) From: "Andrej Borsenkow" To: "Sven Wischnowsky" , Subject: RE: PATCH: Re: zpty and controlling tty (and other fd's) Date: Thu, 4 May 2000 14:55:13 +0400 Message-ID: <000701bfb5b7$39753b10$21c9ca95@mow.siemens.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 In-Reply-To: <200005040944.LAA30645@beta.informatik.hu-berlin.de> Importance: Normal > > On True64 Unix O_NOCTTY is implicit and cannot be unset. How weird. > Hmm ... if I correctly recall, first tty opened by process becomes controlling tty. It means, that if child has closed all of it's file descriptors and reopens tty for stdin (duplicating it for stdout, stderr) - it gets it as controlling tty. It should be fairly portable. And closing all descriptors is probably needed anyway because ... > > > > Oh, yes, and why nslookup has fd's 10 and 11 open at all? > > Missing close()s? (The parent shell's stdio descriptors.) > ... there is more that remains from parent: bor@itsrm2% lsof -c nslookup COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME nslookup 15216 bor cwd VDIR 4,5 3072 125 /home/bor nslookup 15216 bor txt VREG 4,3 69961 46376 /usr/sbin/nslookup nslookup 15216 bor txt VREG 4,3 715161 23840 /usr/lib/libc.so.1 nslookup 15216 bor txt VREG 4,3 320397 23882 /usr/lib/libresolv.so nslookup 15216 bor txt VREG 4,3 192333 23859 /usr/lib/libsocket.so nslookup 15216 bor txt VREG 4,3 592617 26181 /usr/lib/libnsl.so nslookup 15216 bor 0u VCHR 112,10 0t66 4204 STR:/dev/pts/10->pts nslookup 15216 bor 1u VCHR 112,10 0t66 4204 STR:/dev/pts/10->pts nslookup 15216 bor 2u VCHR 112,10 0t66 4204 STR:/dev/pts/10->pts nslookup 15216 bor 3u VCHR 111,10 0t69 STR:/dev/ptmx->ptm nslookup 15216 bor 13r VREG 4,5 1303776 24152 /home/bor/.zsh.d/std-3.1.7-pre-2.zwc Note fd's 3 and 13. 3 is master side of pty (child does not need it, does it?) And 13 is left over from wordcode file mapping. Mapping itself goes away after exec (at least here - I expect, it should be true for all Unices) - but we have to close fd anyway. -andrej