From: Alex Shinn <xxxxxx@gmail.com>
Date: Monday, September 07, 2020 7:44 PM

I skimmed this briefly for the first time, sorry not to provide feedback earlier.

14 months after starting the project, sempai noticed meeee!!!

I will likely provide a more native implementation of this leveraging (chibi filesystem) at some point.

"more native" as in using various stubs etc. in (chibi filesystem) which I freely copied for my implementation?

My implementation is primarily pedagogical, to have in one place examples of all the POSIX specific logic for someone wanting to create a production implementation for their own Scheme.  Your automagic FFI generator was particularly helpful for that, especially its clarity in specification.

Although I desire an extension of it, see the TODO.txt about errno handling, it would be nice to have additional tokens like "set-errno-to-zero" and "save-errno" which would cause it to set errno immediately before calling the wrapped C function, and save a copy of it immediately after the call, without interference from gc, other green threads, etc.  The saved errno could then be retrieved if needed (on error return, and sometimes this is the only way to detect error or non-error states).

[Note Chibi tracks fd's with a weak hash table internally, which your low-level wrappers are bypassing.]

No doubt.  The fd->*-port procedures have very little to do with POSIX, and everything to do with a Scheme implementation's port implementation.  So as the creator of the implementation you can do in minutes what would take me days, time I couldn't justify.  One reason I punted on their added late in the process buffer-mode arguments.

There may be other monsters lurking in my sample implementation, but it'll accomplish its goals if it's an adequate guide per the above, plus the test suite should be pretty portable, it uses some Chibi functions, but is mostly plain Scheme using (chibi test) and SRFI 170 APIs.

- Harold

On Tue, Sep 8, 2020 at 4:18 AM <xxxxxx@ancell-ent.com> wrote:

Unless it is decided to rename or hide port-real-fd.

Currently in https://github.com/hga/srfi-170/tree/master/srfi/chibi-scheme, John will no doubt soon be pulling it into his "hot potato" upstream repo.

- Harold