From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HTML_MESSAGE,MAILING_LIST_MULTI autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 24154 invoked from network); 29 Jan 2023 19:20:56 -0000 Received: from minnie.tuhs.org (50.116.15.146) by inbox.vuxu.org with ESMTPUTF8; 29 Jan 2023 19:20:56 -0000 Received: from minnie.tuhs.org (localhost [IPv6:::1]) by minnie.tuhs.org (Postfix) with ESMTP id DB774424C3; Mon, 30 Jan 2023 05:20:49 +1000 (AEST) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by minnie.tuhs.org (Postfix) with ESMTPS id 7340F424BE for ; Mon, 30 Jan 2023 05:20:45 +1000 (AEST) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 936F75C0DC9 for ; Sun, 29 Jan 2023 14:20:44 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Sun, 29 Jan 2023 14:20:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ronnatalie.com; h=cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:reply-to:sender :subject:subject:to:to; s=fm2; t=1675020044; x=1675106444; bh=MV MXkVSqCBR1hcpAvkwZO4kf39NulcNNVKG+dL5Ds0w=; b=WyaQ9iboGAp6lZxsGX DNZjmgiLdBKiydSqaWSZr2GRncFJbZ7Pi+zJt8YtpNCXo8ZxamKeYIyLMiYE3144 IEOmn+EXmwVxvHIKi57A0Lgo/upxziUaYUmFLuHRqmXKyxduV3aolFN66TG8fzs3 n+p3P05x5npez2cb+AKvvwKYIYHus/Oa+2V7v42VNQWeUvez50mZ43Aun6nev2wb LyQADVdQ6cz+rDgsvNQDoxQwD7nhu+HOSdL0NBHzN5BZ8dRZ7MiX6xFViNjffLCk eg6fjycSDjQ4E9oLBln5fLIT/mMXPCdUdvo8llZrlkPzxmJdvI6IoYRrfFTioyLY BEBw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1675020044; x=1675106444; bh=MVMXkVSqCBR1h cpAvkwZO4kf39NulcNNVKG+dL5Ds0w=; b=Zzmotfe9TwMmnDRQ869CeIBBT70GC bkRQUfEqy5uyxXLZW3R6OKok4w+hWH1A3ncRYMVUGy46+MLPHixEuDzaXNhEsTrV n40Usurmgl7FyVPpQE9CXK7kAljTSTJxh+i3htPWuHeN8Nnwo1mfoJ0KSLcWhT8a 6s5At+g/7+oGsi4+OLlqh6GsTxDOp1hWoU+Nvo9auYSjivFP0E+xhr7GutWzh41f mvCgZnmQMlWQ+nXORonCvPaG5of3irkFPKMVjkAuiX7944bhxfRbFJxOMMlNvPFK ld60B32cFqSZx7rAVCReBuuToWqdg4Dd/zFx6daqPQ6MY9RtcJpiyzXlQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudeftddguddviecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkfgjfhhrfgggtgesrg dtreertderjeenucfhrhhomhepfdftohhnucfprghtrghlihgvfdcuoehrohhnsehrohhn nhgrthgrlhhivgdrtghomheqnecuggftrfgrthhtvghrnhepleduteelhfekheeljefhhf ejgfekteffjeelvdehhfdvffegjeefiefhieekkeffnecuvehluhhsthgvrhfuihiivgep tdenucfrrghrrghmpehmrghilhhfrhhomheprhhonhesrhhonhhnrghtrghlihgvrdgtoh hm X-ME-Proxy: Feedback-ID: iaba146ad:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Sun, 29 Jan 2023 14:20:44 -0500 (EST) From: "Ron Natalie" To: "The Eunuchs Hysterical Society" Date: Sun, 29 Jan 2023 19:20:43 +0000 Message-Id: In-Reply-To: References: User-Agent: eM_Client/9.2.1222.0 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="------=_MBF06C5BB6-E4C8-4B2B-B6FF-0D249AEF49C1" Message-ID-Hash: BECDLZIEWI2ILALUSC5CE2VK24ZMYWPQ X-Message-ID-Hash: BECDLZIEWI2ILALUSC5CE2VK24ZMYWPQ X-MailFrom: ron@ronnatalie.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-tuhs.tuhs.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.6b1 Precedence: list Reply-To: Ron Natalie Subject: [TUHS] Re: FD 2 List-Id: The Unix Heritage Society mailing list Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --------=_MBF06C5BB6-E4C8-4B2B-B6FF-0D249AEF49C1 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable >"The main loop of the shell went as follows: >1) The shell closed all its open files, then opened the terminal=20 >special file for standard input and output (file descriptors 0 and 1). > Unfortunately, the source code says otherwise. None of shells V6, PWB,=20 V7 do anything like is mentioned above. They assume 0 and 1 (and 2)=20 are already open. The only fd redirection they do is when you do pipes or redirection on=20 the command line. Where this is done is, as I posted earlier, in /etc/init. Init opens=20 the tty device and dups it to 1 and then invokes either the shell (if=20 we're in single user mode) or getty for interactive mode. This was done in V6 and PWB (1). In V7, init added a second dup for=20 file descriptor 2. > --------=_MBF06C5BB6-E4C8-4B2B-B6FF-0D249AEF49C1 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
=
=C2=A0
"The main loop of the shell went as follows:
1) The shell closed = all its open files, then opened the terminal special file for standard inp= ut and output (file descriptors 0 and 1).

Unfortunately, the source code says otherwise. =C2=A0 None of = shells V6, PWB, V7 do anything like is mentioned above. =C2=A0 They assume = 0 and 1 (and 2) are already open.
The on= ly fd redirection they do is when you do pipes or redirection on the comman= d line.

Where this is done is, as I posted earlier, in /etc/init. =C2=A0= =C2=A0Init opens the tty device and dups it to 1 and then invokes either the= shell (if we're in single user mode) or getty for interactive mode.
This was done in V6 and PWB (1). =C2=A0 In V7, i= nit added a second dup for file descriptor 2.


=0A
<= /div>=0A
=0A --------=_MBF06C5BB6-E4C8-4B2B-B6FF-0D249AEF49C1--