On 23/06/2015 20:09, Marko Rauhamaa wrote:
Eli Zaretskii <e...@gnu.org>:
From: Marko Rauhamaa <ma...@pacujo.net>
Date: Tue, 23 Jun 2015 11:08:23 +0300
Cc: guile-user@gnu.org
Michael Tiedtke <michele.ti...@o2online.de>:
POSIX isn't that important or useful anymore but "full access to
POSIX system calls" it has never been.
What I'd like is a way to communicate open file descriptors between
processes.
That's highly non-portable, and is bound to produce Guile code that
works only on some systems.
I'd like to produce Guile code that works on Linux. As it stands, I
can't.
Sending file descriptors over Unix domain sockets is quite portable,
however. Guile does support AF_UNIX, only it doesn't support control
messages.
Marko
My solution to this is even less portable but it would reduce the amount
primitives:
Just make direct kernel calls from within Guile. It shouldn't be too
difficult to create a byte vector (or SMOB) and fill it with the data
needed according to the SYSCALL with the corresponding system scheme or
byte/word procedures. Then do the SYSCALL. After that SYSCALL you would
need to read out the data from the byte vector when there is an answer.
That way you could create the needed one of a zillion ioctl call in
Scheme yourself without recompiling.
A SYSCALL is not a regular C functions - it has about four stages or
there were four types of them - but if you have it you should be able to
use e.g. inotify without recompiling. On Darwin you would have to
recreate the whole thing again - mach messages and kevent from within
Scheme.
I do generally consider it a good thing to pull things into Scheme and
not into C - and I don't know why but in the place of the C library I
would like to see some modern System Scheme. Where regular Scheme
programs don't even need these strict memory access restrictions or
process isolations which have to be circumvented with sewer pipes or sky
messages to allow for IPC. ;-) Just pass the reference if you can ...