[PATCH] posix: Ignore pshared for semaphores

Joel Sherrill joel at rtems.org
Mon Sep 11 13:39:43 UTC 2017


On Fri, Sep 8, 2017 at 1:51 PM, Sebastian Huber <
sebastian.huber at embedded-brains.de> wrote:

> Ok,  but why do you think that this is an error?  We can share the
> synchronization objects among processes.
>

We don't have processes. How do you propose to share between
processes when RTEMS is fundamentally a single process system.

If you have found a way to change this, then there are other places
to adjust.

--joel


>
> ----- Joel Sherrill <joel at rtems.org> schrieb:
> > I have no idea how that is much clearer except that pthreads have defined
> > macros for scope and thus an invalid value is an error.
> >
> > But POSIX isn't good at addressing error cases which existed based on the
> > profiles defined in PSE52-54. And those were not updated for POSIX 2008
> or
> > 2013
> >
> > On Sep 8, 2017 10:16 AM, "Sebastian Huber" <
> > sebastian.huber at embedded-brains.de> wrote:
> >
> > >
> > > ----- Joel Sherrill <joel at rtems.org> schrieb:
> > > > On Fri, Sep 8, 2017 at 8:33 AM, Sebastian Huber <
> > > > sebastian.huber at embedded-brains.de> wrote:
> > > >
> > > > > Since we have only one process, sharing between processes is
> trivial.
> > > > >
> > > > > Close #3124.
> > > > > ---
> > > > >  cpukit/posix/include/rtems/posix/semaphore.h     |  1 -
> > > > >  cpukit/posix/include/rtems/posix/semaphoreimpl.h |  1 -
> > > > >  cpukit/posix/src/semaphorecreatesupp.c           |  7 -------
> > > > >  cpukit/posix/src/seminit.c                       |  1 -
> > > > >  cpukit/posix/src/semopen.c                       |  1 -
> > > > >  testsuites/psxtests/psxsem01/init.c              | 14
> +++++++++-----
> > > > >  6 files changed, 9 insertions(+), 16 deletions(-)
> > > > >
> > > > > diff --git a/cpukit/posix/include/rtems/posix/semaphore.h
> > > > > b/cpukit/posix/include/rtems/posix/semaphore.h
> > > > > index 45de4a93b9..6598397052 100644
> > > > > --- a/cpukit/posix/include/rtems/posix/semaphore.h
> > > > > +++ b/cpukit/posix/include/rtems/posix/semaphore.h
> > > > > @@ -43,7 +43,6 @@ extern "C" {
> > > > >  typedef struct {
> > > > >     Objects_Control         Object;
> > > > >     CORE_semaphore_Control  Semaphore;
> > > > > -   int                     process_shared;
> > > > >     bool                    named;
> > > > >     bool                    linked;
> > > > >     uint32_t                open_count;
> > > > > diff --git a/cpukit/posix/include/rtems/posix/semaphoreimpl.h
> > > > > b/cpukit/posix/include/rtems/posix/semaphoreimpl.h
> > > > > index 2bafbe9b97..43440298ec 100644
> > > > > --- a/cpukit/posix/include/rtems/posix/semaphoreimpl.h
> > > > > +++ b/cpukit/posix/include/rtems/posix/semaphoreimpl.h
> > > > > @@ -78,7 +78,6 @@ RTEMS_INLINE_ROUTINE POSIX_Semaphore_Control
> > > > > *_POSIX_Semaphore_Get(
> > > > >  int _POSIX_Semaphore_Create_support(
> > > > >    const char                *name,
> > > > >    size_t                     name_len,
> > > > > -  int                        pshared,
> > > > >    unsigned int               value,
> > > > >    POSIX_Semaphore_Control  **the_sem
> > > > >  );
> > > > > diff --git a/cpukit/posix/src/semaphorecreatesupp.c
> > > b/cpukit/posix/src/
> > > > > semaphorecreatesupp.c
> > > > > index d66e1942c9..4a33336230 100644
> > > > > --- a/cpukit/posix/src/semaphorecreatesupp.c
> > > > > +++ b/cpukit/posix/src/semaphorecreatesupp.c
> > > > > @@ -42,7 +42,6 @@
> > > > >  int _POSIX_Semaphore_Create_support(
> > > > >    const char                *name_arg,
> > > > >    size_t                     name_len,
> > > > > -  int                        pshared,
> > > > >    unsigned int               value,
> > > > >    POSIX_Semaphore_Control  **the_sem
> > > > >  )
> > > > > @@ -50,10 +49,6 @@ int _POSIX_Semaphore_Create_support(
> > > > >    POSIX_Semaphore_Control *the_semaphore;
> > > > >    char                    *name;
> > > > >
> > > > > -  /* Sharing semaphores among processes is not currently
> supported */
> > > > > -  if (pshared != 0)
> > > > > -    rtems_set_errno_and_return_minus_one( ENOSYS );
> > > > >
> > > >
> > > > Why are you deleting this error check? I can see not storing the
> value or
> > > > passing
> > > > it to create support. But I think it still should be validated. We
> only
> > > > support
> > > > requests for process private. Anything else is an error.
> > >
> > > Why is this an error? With only one process its easy to support sharing
> > > between processes. The text in the semaphore documentation is a bit
> vague.
> > > This description is a bit more clear:
> > >
> > > http://pubs.opengroup.org/onlinepubs/9699919799/
> > > functions/pthread_mutexattr_getpshared.html
> > >
> > > --
> > > Sebastian Huber, embedded brains GmbH
> > >
> > > Address : Dornierstr. 4, D-82178 Puchheim, Germany
> > > Phone   : +49 89 189 47 41-16
> > > Fax     : +49 89 189 47 41-09
> > > E-Mail  : sebastian.huber at embedded-brains.de
> > > PGP     : Public key available on request.
> > >
> > > Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des
> EHUG.
> > >
>
> --
> Sebastian Huber, embedded brains GmbH
>
> Address : Dornierstr. 4, D-82178 Puchheim, Germany
> Phone   : +49 89 189 47 41-16
> Fax     : +49 89 189 47 41-09
> E-Mail  : sebastian.huber at embedded-brains.de
> PGP     : Public key available on request.
>
> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20170911/eec4ddea/attachment-0002.html>


More information about the devel mailing list