Changeset 3b47ce7 in rtems


Ignore:
Timestamp:
Sep 15, 2017, 11:14:57 AM (2 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
8230a329
Parents:
8fa75d3
git-author:
Sebastian Huber <sebastian.huber@…> (09/15/17 11:14:57)
git-committer:
Sebastian Huber <sebastian.huber@…> (09/15/17 11:57:38)
Message:

posix: Allow PTHREAD_PROCESS_SHARED for mutexes

Close #3125.

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • cpukit/posix/include/rtems/posix/posixapi.h

    r8fa75d3 r3b47ce7  
    2626#include <rtems/score/threadimpl.h>
    2727#include <rtems/seterr.h>
     28
     29#include <pthread.h>
    2830
    2931/**
     
    126128  return (type *) the_object
    127129
     130/*
     131 * See also The Open Group Base Specifications Issue 7, IEEE Std 1003.1-2008,
     132 * 2016 Edition, subsection 2.9.9, Synchronization Object Copies and
     133 * Alternative Mappings.
     134 *
     135 * http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_09_09
     136 */
     137RTEMS_INLINE_ROUTINE bool _POSIX_Is_valid_pshared( int pshared )
     138{
     139  return pshared == PTHREAD_PROCESS_PRIVATE ||
     140    pshared == PTHREAD_PROCESS_SHARED;
     141}
     142
    128143/** @} */
    129144
  • cpukit/posix/src/mutexinit.c

    r8fa75d3 r3b47ce7  
    2020
    2121#include <rtems/posix/muteximpl.h>
     22#include <rtems/posix/posixapi.h>
    2223#include <rtems/posix/priorityimpl.h>
    2324#include <rtems/score/schedulerimpl.h>
     
    6364    return EINVAL;
    6465
    65   /*
    66    *  We only support process private mutexes.
    67    */
    68   if ( the_attr->process_shared == PTHREAD_PROCESS_SHARED )
    69     return ENOSYS;
    70 
    71   if ( the_attr->process_shared != PTHREAD_PROCESS_PRIVATE )
     66  if ( !_POSIX_Is_valid_pshared( the_attr->process_shared ) ) {
    7267    return EINVAL;
     68  }
    7369
    7470  /*
  • testsuites/psxtests/psx05/init.c

    r8fa75d3 r3b47ce7  
    430430  rtems_test_assert( !status );
    431431
    432   puts( "Init: pthread_mutex_init - ENOSYS (process wide scope)" );
    433   attr.process_shared = PTHREAD_PROCESS_SHARED;
     432  puts( "Init: pthread_mutex_init - process shared scope" );
     433  status = pthread_mutexattr_setpshared( &attr, PTHREAD_PROCESS_SHARED );
     434  rtems_test_assert( status == 0 );
    434435  status = pthread_mutex_init( &Mutex_id, &attr );
    435   rtems_test_assert( status == ENOSYS );
     436  rtems_test_assert( status == 0 );
     437  status = pthread_mutex_destroy( &Mutex_id );
     438  rtems_test_assert( status == 0 );
    436439
    437440  puts( "Init: pthread_mutex_init - EINVAL (invalid scope)" );
  • testsuites/psxtests/psx05/psx05.scn

    r8fa75d3 r3b47ce7  
    3838Init: pthread_mutex_init - EINVAL (bad priority ceiling)
    3939Init: Resetting mutex attributes
    40 Init: pthread_mutex_init - ENOSYS (process wide scope)
     40Init: pthread_mutex_init - process shared scope
    4141Init: pthread_mutex_init - EINVAL (invalid scope)
    4242Init: pthread_mutex_init - EINVAL (invalid type)
Note: See TracChangeset for help on using the changeset viewer.