On Mon, Feb 24 2020 10:42:22 +0100, Martin Pieuchot wrote:
> > Yes, that's what I'm trying to do. Yes, I've seen the current
> > implementation -- that's why I started this thread, in an attempt to
> > make them supported. :)
> > 
> > See the followup patch -- sharing the semaphore between processes does
> > work with it.
> 
> Well ignoring the `pshared' argument is questionable.

It does feel strange, but a fully userspace implementation of semaphores
(ie. using only mmap MAP_SHARED files for communication with other
thread/processes) doesn't really have a meaningful distinction whether
sharing happens between threads or processes. The other semaphore
implementations I glanced at all had some kind of 'kernel semaphore'.

I suppose a userspace implementation like this could store the pid of
the process allowed to access the semaphore in struct __sem if
pshared=0, and check that on every access, but I'm honestly not sure
what value it brings for a userspace library to essentially prevent
access to userspace memory if the application went through the effort to
share that memory between processes anyway.

-- 
Lauri Tirkkonen | lotheac @ IRCnet

Reply via email to