On Wed, Feb 11, 2026 at 11:26 PM Ori Bernstein <[email protected]> wrote:
> On Wed, 11 Feb 2026 20:22:03 -0500 Dan Cross <[email protected]> wrote:
> > On Wed, Feb 11, 2026 at 1:44 PM Ori Bernstein <[email protected]> wrote:
> > > On Wed, 11 Feb 2026 09:22:06 -0500 Dan Cross <[email protected]> wrote:
> > > > On Tue, Feb 10, 2026 at 10:34 PM Ori Bernstein <[email protected]> 
> > > > wrote:
> > > > > On Tue, 10 Feb 2026 05:13:47 -0500
> > > > > "Alyssa M via 9fans" <[email protected]> wrote:
> > > > >
> > > > > > On Monday, February 09, 2026, at 3:24 PM, ron minnich wrote:
> > > > > > > as for mmap, there's already a defacto mmap happening for 
> > > > > > > executables. They are not read into memory. In fact, the first 
> > > > > > > instruction you run in a binary results in a page fault.
> > > > > > I thinking one could bring the same transparent/defacto memory 
> > > > > > mapping to read(2) and write(2), so the API need not change at all.
> > > > >
> > > > > That gets... interesting, from an FS semantics point of view.
> > > > > What does this code print? Does it change with buffer sizes?
> > > > >
> > > > >         fd = open("x", ORDWR);
> > > > >         pwrite(fd, "foo", 4, 0);
> > > > >         read(fd, buf, 4);
> > > > >         pwrite(fd, "bar", 4, 0);
> > > > >         print("%s\n", buf);
> > > >
> > > > It depends.  Is `buf` some buffer on your stack or something similar
> > > > (a global, static buffer, or heap-malloc'ed perhaps)?  If so,
> > > > presumably it still prints "foo", since the `read` would have copied
> > > > the data out of any shared region and into process-private memory. Or,
> > > > is it a pointer to the start of some region that you mapped to "x"?
> > > > In that case, the whole program is suspect as it seems to operate well
> > > > outside of the assumptions of C, but on Plan 9, I'd kind of expect it
> > > > to print "bar".
> > >
> > > In this example, no trickery; single threaded code, nothing fancy.
> >
> > Ok. Perhaps implicitly you also mean that there's no `mmap` involved?
>
> The message I was responding to said:
>
>         "I thinking one could bring the same transparent/defacto
>         memory mapping to read(2) and write(2), so the API need
>         not change at all."
>
> So, yes, I was talking about a hypothetical modification
> to read/write.

Ah, sorry; I missed that part of the context.  In that case, yes, I
agree, and your example is apt.

        - Dan C.

------------------------------------------
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/Te8d7c6e48b5c075b-M4d996616564e9c612d59909a
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

Reply via email to