9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Charles Forsyth <charles.forsyth@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] on cp /fd/1 /fd/0
Date: Tue, 12 May 2015 17:15:45 +0100	[thread overview]
Message-ID: <CAOw7k5i9RHTCS_teRt4_soz-ujQjxm-9j=mZTg89dcGj5rYmng@mail.gmail.com> (raw)
In-Reply-To: <CAB08-qprY8hqe4QV7fbhhc2o+jVyAJXyBQUmdb2WZtddf1GZJw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1032 bytes --]

On 12 May 2015 at 15:17, Daniel Bastos <dbastos@toledo.com> wrote:

> What is the relationship between file descriptor 1 and /fd/1? When a
> program runs, 1 is already open for writing. But apparently it's open only
> for writing. A read on it yields inappropriate use of fd. The same seems to
> happen /fd/1. Can I say they'll both always present the same behavior?
>

open /fd/1 and you get a new file descriptor number that refers to the same
open file as file descriptor 1, and with the same open mode
(the new open can add OCEXEC, which will apply to both). /fd/1ctl  shows
what you get.

I'm not able to change permissions on /fd/1. Why not?
>

Because if those changed permissions worked, that would in principle allow
you to force write access to  a file you'd opened with read.

The "inappropriate use" message is possibly a bad choice. It's normally
returned for attempting to write
to a file descriptor open for read (or conversely). The usual "permission
denied" message would be better for open.

[-- Attachment #2: Type: text/html, Size: 1726 bytes --]

  reply	other threads:[~2015-05-12 16:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-12 11:56 Daniel Bastos
2015-05-12 12:24 ` Iruatã Souza
2015-05-12 12:39   ` lucio
2015-05-12 13:20     ` erik quanstrom
2015-05-12 14:17   ` Daniel Bastos
2015-05-12 16:15     ` Charles Forsyth [this message]
2015-05-12 17:10       ` Daniel Bastos
2015-05-12 18:54         ` Charles Forsyth
2015-05-12 15:52 ` Charles Forsyth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAOw7k5i9RHTCS_teRt4_soz-ujQjxm-9j=mZTg89dcGj5rYmng@mail.gmail.com' \
    --to=charles.forsyth@gmail.com \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).