On 10/20/16, Ian Lance Taylor <
ia...@golang.org> wrote:
>
> I don't know what Plan 9 provides, but on modern Unix systems the way
> to do this is not shmat and friends, but instead for all the
> cooperating processes to mmap a single shared file using MAP_SHARED.
> Note in particular that on GNU/Linux futex works on shared memory.
> More thought would be required on other systems. Also more thought
> would be required to understand how to implement sync.Mutex in a way
> that works across processes.
>
Plan 9 is not terribly important here, but the point you make is: do
we want a specific solution for linux_386 (see
exp/shiny/driver/x11driver/shm_linux_amd64.go) which is the obvious
objective, or do I implement a Posix (say) solution and shoe-horn it
into Nigel's efforts.
At this point, my idea was to mirror the module above as closely as
possible, although I confess I have little idea how the IPC/SHM
facilities work in Linux (my Unix education is closer to NetBSD, so
this is a bit of an adventure) and, somewhat tantalizing, why there
are syscall entries for amd64, but not for 386 in Linux.
On the other hand, it is all very experimental, so the objective may
well be to plug the hole needed by the X11 driver, as simply as
possible.
> The difference between //sys and //sysnb is that //sysnb promises that
> the system call never blocks. It is always safe to use //sys. You
> must not use //sysnb for any operation that may block, which includes
> any operation that may call into a FUSE file system.
>
I got it, thank you for your help, from reading the perl code and
doing some guessing. Now I'm seriously lost in the maze of macro
definitions that implement syscalls in the Linux library. I wish I
could admire the cleverness of it all, but I confess it scares me,
instead. Who will maintain this stuff, twenty years from now?
Lucio.