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 32292 invoked from network); 29 Jan 2023 20:27:02 -0000 Received: from minnie.tuhs.org (50.116.15.146) by inbox.vuxu.org with ESMTPUTF8; 29 Jan 2023 20:27:02 -0000 Received: from minnie.tuhs.org (localhost [IPv6:::1]) by minnie.tuhs.org (Postfix) with ESMTP id 4334142596; Mon, 30 Jan 2023 06:26:57 +1000 (AEST) Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52]) by minnie.tuhs.org (Postfix) with ESMTPS id C093C42595 for ; Mon, 30 Jan 2023 06:26:49 +1000 (AEST) Received: by mail-ed1-f52.google.com with SMTP id u21so9173818edv.3 for ; Sun, 29 Jan 2023 12:26:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=nvb0CmH8qOeJiRJ1H1c807OK90mDbgerVdiQ0TaK0bg=; b=XjGC0bvYw1DUJJQ3EkKYNZdsq7erx5Dw/58ut9erFPEi6hQAxmkIYFZ44OqXm6gCo0 Ko9tvJSJAsaMoETliMLM5XMp1yw42xTcrNqojoxzttUz7+9lbMIMJrWdIsuNmYP3kgmT qOHXE3wsMyNztOx8bqOE1mqnlkGk2Kk45Rpe4Tu28t0QYV2AkdFBp2t+nTzIPuUcKfth j+tDJq0P5pHPtgwq79adUgIB+DkewxepQz9nMVb1eP0sY6OpM44HBtFVJCvzmvzHMdFF uWXhQcnJQMa8sof+ekd6pP+Sc/+94A3+41AksJ4wxDQxq6ZfEVCKsLdqBriIIjRJ31c4 4M9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=nvb0CmH8qOeJiRJ1H1c807OK90mDbgerVdiQ0TaK0bg=; b=Ldi9zIAHhuRlredwiYdd8Aq0MkRYPpB5y3lW3oiN8UtVSxis816zYLIZxp2Cg02cQF gkH6brKd8iUBLWpEhbIuRYv90PW6rCwUB4YyW4fMlyw9/Gdxg3ciXi/7mFdzQ4vrXBme cs1G85C8QFY6BwT2qEqktDaHTNronOvmzc686AIX01kOKcQiJS1p3OjCQtMaN1P0gtkR kMM4dC2zSDmt3UKhhEzvkE4xqhQN1aPTDMpB43u7+/TC11Jn/UxvXcYUrWxP0XUakt8g tviFwk1/QS6wXhfIj7k75CMof3tptz9MEjceqCR2QCb79dm4M5cT3g6z2M8cVgX3zTx+ q9iA== X-Gm-Message-State: AO0yUKWtFhbET94eCLoWaZJzI8vCywkM7jzpw05mxAfLmr+pPwzBrDpr ndL/1Cc7Aq5wVeHzpx7P/vpYhTq1prPLIIXl50jJPYL0cK40xQ== X-Google-Smtp-Source: AK7set82q87209j+rJSnK0FPRUDMDOgL88zOPcRXuZt+ThSthPo/a45itPfD0Q+1LYOn7P/ggJwlTfFus1SiU1GaBkU= X-Received: by 2002:a05:6402:f24:b0:4a2:28f6:984b with SMTP id i36-20020a0564020f2400b004a228f6984bmr1393148eda.29.1675023948249; Sun, 29 Jan 2023 12:25:48 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Warner Losh Date: Sun, 29 Jan 2023 13:25:37 -0700 Message-ID: To: Ron Natalie Content-Type: multipart/alternative; boundary="0000000000006d117405f36ce734" Message-ID-Hash: 4UV5U6OURHWVPSR2GJJVIEJ77SMJAM34 X-Message-ID-Hash: 4UV5U6OURHWVPSR2GJJVIEJ77SMJAM34 X-MailFrom: wlosh@bsdimp.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 CC: The Eunuchs Hysterical Society X-Mailman-Version: 3.3.6b1 Precedence: list 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: --0000000000006d117405f36ce734 Content-Type: text/plain; charset="UTF-8" On Sun, Jan 29, 2023, 12:21 PM Ron Natalie wrote: > > > > "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 input and output (file descriptors 0 and 1). > > Unfortunately, the source code says otherwise. None of shells V6, PWB, > V7 do anything like is mentioned above. They assume 0 and 1 (and 2) are > already open. > The only fd redirection they do is when you do pipes or redirection on the > command line. > This was in reference to the pdp-7 unix implementation. I didn't check the pdp7 version though. So what you said is true about the later versions for sure, starting with v5. Where this is done is, as I posted earlier, in /etc/init. Init 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). In V7, init added a second dup for file > descriptor 2. > Yes. I quite enjoyed that. My surprise was Dennis' paper didn't mention the innovation since it was otherwise quote detailed. Warner > --0000000000006d117405f36ce734 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Sun, Jan 29, 2023, 12:21 PM Ron Natalie <ron@ronnatalie.com> wrote:
=C2=A0
"The main loop of t= he shell went as follows:
1) The shell closed all its open files,= then opened the terminal special file for standard input and output (file = descriptors 0 and 1).

Unfortun= ately, 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 a= lready open.
The only fd redirection they do is when= you do pipes or redirection on the command line.
<= /div>

This was in refere= nce to the pdp-7 unix implementation. I didn't check the pdp7 version t= hough. So what you said is true about the later versions for sure, starting= with v5.

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


Yes. I quite enjoyed that.
=

My surprise was Dennis' p= aper didn't mention the innovation since it was otherwise quote detaile= d.

Warner=C2=A0
--0000000000006d117405f36ce734--