NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: lib/53273: sem_init() with pshared=1 does not actually work

The following reply was made to PR lib/53273; it has been noted by GNATS.

From: David Holland <>
Subject: Re: lib/53273: sem_init() with pshared=1 does not actually work
Date: Fri, 28 Sep 2018 19:45:40 +0000

 On Thu, May 10, 2018 at 02:45:00AM +0000, wrote:
  > if sem_t is created by sem_init(*, 1, *), the sem_t has to be sharable
  > between processes, even if the processes don't share virtual memory space.
  > but our implemention doesn't satisfy this requirement.
  > >Fix:
  > change the definition of sem_t from an opaque pointer to an actual struct
  > just like other UNIXes.
 I'm not clear on how that will help - is the idea that you're supposed
 to be able to write the bits of the struct through a pipe to another
 process and have it work on the other end? That seems very unlikely in
 general; also if it were necessary the code wanting it almost
 certainly wouldn't compile with our implementation.
 The man page for sem_init is not clear about this. Can someone
 explain? (And while we're at it, the man page for sem_open does not
 explain how multiple opens of the same semaphore are supposed to
 interact with sem_close, which it should.)
 My understanding has always been that if you want to use the same
 posix ipc object in multiple processes that you need to name it and
 look it up by name in each (with sem_open)...
 David A. Holland

Home | Main Index | Thread Index | Old Index