Changeset de59c065 in rtems


Ignore:
Timestamp:
Sep 27, 2017, 1:08:33 PM (20 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
900fda45
Parents:
5222488
git-author:
Sebastian Huber <sebastian.huber@…> (09/27/17 13:08:33)
git-committer:
Sebastian Huber <sebastian.huber@…> (10/05/17 12:29:02)
Message:

posix: Implement self-contained POSIX mutex

POSIX mutexes are now available in all configurations and no longer
depend on --enable-posix.

Update #2514.
Update #3112.

Files:
1 added
3 deleted
124 edited

Legend:

Unmodified
Added
Removed
  • c/src/ada-tests/mptests/mp01/config_base.h

    r5222488 rde59c065  
    2323#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2424#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    25 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    2625
    2726#include <rtems/confdefs.h>
  • c/src/ada-tests/mptests/mp03/config_base.h

    r5222488 rde59c065  
    2323#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2424#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    25 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    2625
    2726#include <rtems/confdefs.h>
  • c/src/ada-tests/mptests/mp04/config_base.h

    r5222488 rde59c065  
    2323#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2424#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    25 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    2625
    2726#include <rtems/confdefs.h>
  • c/src/ada-tests/mptests/mp05/config_base.h

    r5222488 rde59c065  
    2323#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2424#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    25 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    2625
    2726#include <rtems/confdefs.h>
  • c/src/ada-tests/mptests/mp06/config_base.h

    r5222488 rde59c065  
    2323#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2424#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    25 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    2625
    2726#include <rtems/confdefs.h>
  • c/src/ada-tests/mptests/mp07/config_base.h

    r5222488 rde59c065  
    2323#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2424#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    25 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    2625
    2726#include <rtems/confdefs.h>
  • c/src/ada-tests/mptests/mp08/config_base.h

    r5222488 rde59c065  
    2323#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2424#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    25 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    2625
    2726#include <rtems/confdefs.h>
  • c/src/ada-tests/mptests/mp09/config_base.h

    r5222488 rde59c065  
    2323#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2424#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    25 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    2625
    2726#include <rtems/confdefs.h>
  • c/src/ada-tests/mptests/mp10/config_base.h

    r5222488 rde59c065  
    2323#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2424#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    25 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    2625
    2726#include <rtems/confdefs.h>
  • c/src/ada-tests/mptests/mp11/config_base.h

    r5222488 rde59c065  
    2323#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2424#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    25 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    2625
    2726#include <rtems/confdefs.h>
  • c/src/ada-tests/mptests/mp12/config_base.h

    r5222488 rde59c065  
    2323#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2424#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    25 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    2625
    2726#include <rtems/confdefs.h>
  • c/src/ada-tests/mptests/mp13/config_base.h

    r5222488 rde59c065  
    2323#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2424#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    25 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    2625
    2726#include <rtems/confdefs.h>
  • c/src/ada-tests/mptests/mp14/config_base.h

    r5222488 rde59c065  
    2323#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2424#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    25 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    2625
    2726#include <rtems/confdefs.h>
  • c/src/ada-tests/samples/base_mp/config.h

    r5222488 rde59c065  
    2525#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2626#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    27 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    2827
    2928/*
  • c/src/ada-tests/samples/base_sp/config.h

    r5222488 rde59c065  
    2323#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2424#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    25 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    2625
    2726#define CONFIGURE_MAXIMUM_TASKS            2
  • c/src/ada-tests/samples/hello/config.h

    r5222488 rde59c065  
    2424#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2525#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    26 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    2726
    2827#define CONFIGURE_MAXIMUM_TASKS              1
  • c/src/ada-tests/samples/nsecs/config.h

    r5222488 rde59c065  
    2323#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2424#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    25 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    2625
    2726#define CONFIGURE_MAXIMUM_TASKS              1
  • c/src/ada-tests/samples/ticker/config.h

    r5222488 rde59c065  
    2323#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2424#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    25 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    2625
    2726#define CONFIGURE_MAXIMUM_TASKS             4
  • c/src/ada-tests/sptests/sp01/config.h

    r5222488 rde59c065  
    2323#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2424#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    25 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    2625
    2726#define CONFIGURE_MAXIMUM_TASKS             4
  • c/src/ada-tests/sptests/sp02/config.h

    r5222488 rde59c065  
    2323#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2424#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    25 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    2625
    2726#define CONFIGURE_MAXIMUM_TASKS             4
  • c/src/ada-tests/sptests/sp03/config.h

    r5222488 rde59c065  
    2323#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2424#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    25 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    2625
    2726#define CONFIGURE_MAXIMUM_TASKS             3
  • c/src/ada-tests/sptests/sp04/config.h

    r5222488 rde59c065  
    2626#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2727#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    28 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    2928
    3029#define CONFIGURE_MAXIMUM_TASKS             4
  • c/src/ada-tests/sptests/sp05/config.h

    r5222488 rde59c065  
    2525#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2626#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    27 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    2827
    2928#define CONFIGURE_MAXIMUM_TASKS             4
  • c/src/ada-tests/sptests/sp06/config.h

    r5222488 rde59c065  
    2525#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2626#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    27 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    2827
    2928#define CONFIGURE_MAXIMUM_TASKS             4
  • c/src/ada-tests/sptests/sp07/config.h

    r5222488 rde59c065  
    2626#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2727#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    28 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    2928
    3029#define CONFIGURE_MAXIMUM_TASKS             5
  • c/src/ada-tests/sptests/sp08/config.h

    r5222488 rde59c065  
    2525#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2626#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    27 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    2827
    2928#define CONFIGURE_MAXIMUM_TASKS             2
  • c/src/ada-tests/sptests/sp09/config.h

    r5222488 rde59c065  
    3333#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    3434#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    35 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    3635
    3736#include <rtems/confdefs.h>
  • c/src/ada-tests/sptests/sp11/config.h

    r5222488 rde59c065  
    2727#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2828#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    29 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    3029
    3130#include <rtems/confdefs.h>
  • c/src/ada-tests/sptests/sp12/config.h

    r5222488 rde59c065  
    2727#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2828#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    29 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    3029
    3130#include <rtems/confdefs.h>
  • c/src/ada-tests/sptests/sp13/config.h

    r5222488 rde59c065  
    2727#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2828#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    29 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    3029
    3130#include <rtems/confdefs.h>
  • c/src/ada-tests/sptests/sp14/config.h

    r5222488 rde59c065  
    2727#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2828#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    29 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    3029
    3130#include <rtems/confdefs.h>
  • c/src/ada-tests/sptests/sp15/config.h

    r5222488 rde59c065  
    2727#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2828#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    29 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    3029
    3130#include <rtems/confdefs.h>
  • c/src/ada-tests/sptests/sp16/config.h

    r5222488 rde59c065  
    2727#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2828#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    29 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    3029
    3130#include <rtems/confdefs.h>
  • c/src/ada-tests/sptests/sp17/config.h

    r5222488 rde59c065  
    2727#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2828#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    29 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    3029
    3130#include <rtems/confdefs.h>
  • c/src/ada-tests/sptests/sp19/config.h

    r5222488 rde59c065  
    2323#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2424#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    25 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    2625
    2726#define CONFIGURE_MAXIMUM_TASKS             7
  • c/src/ada-tests/sptests/sp20/config.h

    r5222488 rde59c065  
    2626#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2727#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    28 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    2928
    3029#include <rtems/confdefs.h>
  • c/src/ada-tests/sptests/sp22/config.h

    r5222488 rde59c065  
    2626#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2727#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    28 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    2928
    3029#include <rtems/confdefs.h>
  • c/src/ada-tests/sptests/sp23/config.h

    r5222488 rde59c065  
    2626#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2727#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    28 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    2928
    3029#include <rtems/confdefs.h>
  • c/src/ada-tests/sptests/sp24/config.h

    r5222488 rde59c065  
    2626#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2727#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    28 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    2928
    3029#include <rtems/confdefs.h>
  • c/src/ada-tests/sptests/sp25/config.h

    r5222488 rde59c065  
    2626#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2727#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    28 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    2928
    3029#include <rtems/confdefs.h>
  • c/src/ada-tests/sptests/spname01/config.h

    r5222488 rde59c065  
    2424#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2525#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    26 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    2726
    2827#define CONFIGURE_MAXIMUM_TASKS              1
  • c/src/ada-tests/tmtests/tm01/config.h

    r5222488 rde59c065  
    2727#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2828#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    29 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    3029
    3130#include <rtems/confdefs.h>
  • c/src/ada-tests/tmtests/tm02/config.h

    r5222488 rde59c065  
    2828#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2929#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    30 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    3130
    3231#include <rtems/confdefs.h>
  • c/src/ada-tests/tmtests/tm03/config.h

    r5222488 rde59c065  
    2828#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2929#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    30 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    3130
    3231#include <rtems/confdefs.h>
  • c/src/ada-tests/tmtests/tm04/config.h

    r5222488 rde59c065  
    2727#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2828#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    29 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    3029
    3130#include <rtems/confdefs.h>
  • c/src/ada-tests/tmtests/tm05/config.h

    r5222488 rde59c065  
    2828#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2929#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    30 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    3130
    3231#include <rtems/confdefs.h>
  • c/src/ada-tests/tmtests/tm06/config.h

    r5222488 rde59c065  
    2828#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2929#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    30 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    3130
    3231#include <rtems/confdefs.h>
  • c/src/ada-tests/tmtests/tm07/config.h

    r5222488 rde59c065  
    2828#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2929#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    30 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    3130
    3231#include <rtems/confdefs.h>
  • c/src/ada-tests/tmtests/tm08/config.h

    r5222488 rde59c065  
    2828#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2929#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    30 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    3130
    3231#include <rtems/confdefs.h>
  • c/src/ada-tests/tmtests/tm09/config.h

    r5222488 rde59c065  
    2727#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2828#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    29 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    3029
    3130#include <rtems/confdefs.h>
  • c/src/ada-tests/tmtests/tm10/config.h

    r5222488 rde59c065  
    2727#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2828#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    29 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    3029
    3130#include <rtems/confdefs.h>
  • c/src/ada-tests/tmtests/tm11/config.h

    r5222488 rde59c065  
    2727#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2828#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    29 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    3029
    3130#include <rtems/confdefs.h>
  • c/src/ada-tests/tmtests/tm12/config.h

    r5222488 rde59c065  
    2727#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2828#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    29 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    3029
    3130#include <rtems/confdefs.h>
  • c/src/ada-tests/tmtests/tm13/config.h

    r5222488 rde59c065  
    2727#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2828#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    29 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    3029
    3130#include <rtems/confdefs.h>
  • c/src/ada-tests/tmtests/tm14/config.h

    r5222488 rde59c065  
    2727#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2828#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    29 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    3029
    3130#include <rtems/confdefs.h>
  • c/src/ada-tests/tmtests/tm15/config.h

    r5222488 rde59c065  
    2727#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2828#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    29 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    3029
    3130#include <rtems/confdefs.h>
  • c/src/ada-tests/tmtests/tm16/config.h

    r5222488 rde59c065  
    2727#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2828#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    29 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    3029
    3130#include <rtems/confdefs.h>
  • c/src/ada-tests/tmtests/tm17/config.h

    r5222488 rde59c065  
    2727#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2828#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    29 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    3029
    3130#include <rtems/confdefs.h>
  • c/src/ada-tests/tmtests/tm18/config.h

    r5222488 rde59c065  
    2727#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2828#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    29 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    3029
    3130#include <rtems/confdefs.h>
  • c/src/ada-tests/tmtests/tm19/config.h

    r5222488 rde59c065  
    2727#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2828#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    29 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    3029
    3130#include <rtems/confdefs.h>
  • c/src/ada-tests/tmtests/tm20/config.h

    r5222488 rde59c065  
    2828#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2929#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    30 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    3130
    3231#include <rtems/confdefs.h>
  • c/src/ada-tests/tmtests/tm21/config.h

    r5222488 rde59c065  
    3333#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    3434#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    35 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    3635
    3736#include <rtems/confdefs.h>
  • c/src/ada-tests/tmtests/tm22/config.h

    r5222488 rde59c065  
    2727#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2828#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    29 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    3029
    3130#include <rtems/confdefs.h>
  • c/src/ada-tests/tmtests/tm23/config.h

    r5222488 rde59c065  
    2727#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2828#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    29 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    3029
    3130#include <rtems/confdefs.h>
  • c/src/ada-tests/tmtests/tm24/config.h

    r5222488 rde59c065  
    2626#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2727#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    28 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    2928
    3029#include <rtems/confdefs.h>
  • c/src/ada-tests/tmtests/tm25/config.h

    r5222488 rde59c065  
    2727#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2828#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    29 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    3029
    3130#include <rtems/confdefs.h>
  • c/src/ada-tests/tmtests/tm28/config.h

    r5222488 rde59c065  
    2727#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2828#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    29 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    3029
    3130#include <rtems/confdefs.h>
  • c/src/ada-tests/tmtests/tm29/config.h

    r5222488 rde59c065  
    2727#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2828#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    29 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    3029
    3130#include <rtems/confdefs.h>
  • c/src/ada-tests/tmtests/tmck/config.h

    r5222488 rde59c065  
    2727#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2828#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    29 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    3029
    3130#include <rtems/confdefs.h>
  • c/src/ada-tests/tmtests/tmoverhd/config.h

    r5222488 rde59c065  
    2727#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
    2828#define CONFIGURE_MAXIMUM_POSIX_KEYS                 10
    29 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              20
    3029
    3130#include <rtems/confdefs.h>
  • cpukit/libblock/src/bdbuf.c

    r5222488 rde59c065  
    15151515  size_t              b;
    15161516  rtems_status_code   sc;
     1517  bool                locked;
    15171518
    15181519  if (rtems_bdbuf_tracer)
     
    15471548  sc = rtems_bdbuf_lock_create (rtems_build_name ('B', 'D', 'C', 'l'),
    15481549                                &bdbuf_cache.lock);
    1549   if (sc != RTEMS_SUCCESSFUL)
     1550  locked = (sc == RTEMS_SUCCESSFUL);
     1551  if (!locked)
    15501552    goto error;
    15511553
     
    17301732  rtems_bdbuf_lock_delete (&bdbuf_cache.sync_lock);
    17311733
    1732   if (bdbuf_cache.lock != 0)
     1734  if (locked)
    17331735  {
    17341736    rtems_bdbuf_unlock_cache ();
  • cpukit/libcsupport/include/rtems/libcsupport.h

    r5222488 rde59c065  
    113113typedef struct {
    114114  uint32_t active_message_queues;
    115   uint32_t active_mutexes;
    116115  uint32_t active_semaphores;
    117116  uint32_t active_threads;
  • cpukit/libcsupport/src/resource_snapshot.c

    r5222488 rde59c065  
    6969    ,
    7070    { OBJECTS_POSIX_API, OBJECTS_POSIX_MESSAGE_QUEUES },
    71     { OBJECTS_POSIX_API, OBJECTS_POSIX_MUTEXES },
    7271    { OBJECTS_POSIX_API, OBJECTS_POSIX_SEMAPHORES },
    7372    { OBJECTS_POSIX_API, OBJECTS_POSIX_THREADS },
  • cpukit/posix/Makefile.am

    r5222488 rde59c065  
    2222include_rtems_posix_HEADERS += include/rtems/posix/keyimpl.h
    2323include_rtems_posix_HEADERS += include/rtems/posix/config.h
     24include_rtems_posix_HEADERS += include/rtems/posix/muteximpl.h
    2425include_rtems_posix_HEADERS += include/rtems/posix/posixapi.h
    2526include_rtems_posix_HEADERS += include/rtems/posix/priorityimpl.h
     
    3940include_rtems_posix_HEADERS += include/rtems/posix/mqueue.h
    4041include_rtems_posix_HEADERS += include/rtems/posix/mqueueimpl.h
    41 include_rtems_posix_HEADERS += include/rtems/posix/mutex.h
    42 include_rtems_posix_HEADERS += include/rtems/posix/muteximpl.h
    4342include_rtems_posix_HEADERS += include/rtems/posix/psignal.h
    4443include_rtems_posix_HEADERS += include/rtems/posix/psignalimpl.h
     
    8079    src/condinit.c src/condsignal.c src/condsignalsupp.c \
    8180    src/condtimedwait.c src/condwait.c src/condwaitsupp.c
     81
     82## MUTEX_C_FILES
     83libposix_a_SOURCES += src/mutexattrdestroy.c src/mutexattrgetprioceiling.c \
     84    src/mutexattrgetprotocol.c src/mutexattrgetpshared.c \
     85    src/mutexattrgettype.c src/mutexattrinit.c src/mutexattrsetprioceiling.c \
     86    src/mutexattrsetprotocol.c src/mutexattrsetpshared.c \
     87    src/mutexattrsettype.c src/mutexdestroy.c \
     88    src/mutexgetprioceiling.c src/mutexinit.c src/mutexlock.c \
     89    src/mutexlocksupp.c src/mutexsetprioceiling.c src/mutextimedlock.c \
     90    src/mutextrylock.c src/mutexunlock.c
    8291
    8392if HAS_PTHREADS
     
    113122    src/mqueuetimedsend.c \
    114123    src/mqueueunlink.c
    115 
    116 ## MUTEX_C_FILES
    117 libposix_a_SOURCES += src/mutexattrdestroy.c src/mutexattrgetprioceiling.c \
    118     src/mutexattrgetprotocol.c src/mutexattrgetpshared.c \
    119     src/mutexattrgettype.c src/mutexattrinit.c src/mutexattrsetprioceiling.c \
    120     src/mutexattrsetprotocol.c src/mutexattrsetpshared.c \
    121     src/mutexattrsettype.c src/mutex.c src/mutexdestroy.c src/mutexget.c \
    122     src/mutexgetprioceiling.c src/mutexinit.c src/mutexlock.c \
    123     src/mutexlocksupp.c src/mutexsetprioceiling.c src/mutextimedlock.c \
    124     src/mutextrylock.c src/mutexunlock.c
    125124
    126125## PTHREAD_C_FILES
  • cpukit/posix/include/rtems/posix/config.h

    r5222488 rde59c065  
    6565  /**
    6666   * This field contains the maximum number of POSIX API
    67    * mutexes which are configured for this application.
    68    */
    69   uint32_t                            maximum_mutexes;
    70 
    71   /**
    72    * This field contains the maximum number of POSIX API
    7367   * timers which are configured for this application.
    7468   */
  • cpukit/posix/include/rtems/posix/muteximpl.h

    r5222488 rde59c065  
    1919#define _RTEMS_POSIX_MUTEXIMPL_H
    2020
    21 #include <rtems/posix/mutex.h>
    22 #include <rtems/score/coremuteximpl.h>
    23 
    2421#include <errno.h>
    2522#include <pthread.h>
     23
     24#include <rtems/score/percpu.h>
     25#include <rtems/score/muteximpl.h>
     26#include <rtems/score/threadimpl.h>
    2627
    2728#ifdef __cplusplus
     
    2930#endif
    3031
     32typedef struct {
     33  unsigned long flags;
     34  Mutex_recursive_Control Recursive;
     35  Priority_Node Priority_ceiling;
     36  const Scheduler_Control *scheduler;
     37} POSIX_Mutex_Control;
     38
     39#define POSIX_MUTEX_PROTOCOL_MASK 0x3UL
     40
     41#define POSIX_MUTEX_RECURSIVE 0x4UL
     42
     43#define POSIX_MUTEX_FLAGS_MASK 0x7UL
     44
     45#define POSIX_MUTEX_MAGIC 0x961c13b8UL
     46
    3147#define POSIX_MUTEX_NO_PROTOCOL_TQ_OPERATIONS &_Thread_queue_Operations_FIFO
     48
     49#define POSIX_MUTEX_PRIORITY_INHERIT_TQ_OPERATIONS \
     50  &_Thread_queue_Operations_priority_inherit
     51
     52#define POSIX_MUTEX_PRIORITY_CEILING_TQ_OPERATIONS \
     53  &_Thread_queue_Operations_priority
    3254
    3355/**
     
    4365
    4466/**
    45  *  The following defines the information control block used to manage
    46  *  this class of objects.
    47  */
    48 extern Objects_Information _POSIX_Mutex_Information;
    49 
    50 /**
    5167 *  The default mutex attributes structure.
    5268 */
    5369extern const pthread_mutexattr_t _POSIX_Mutex_Default_attributes;
    5470
    55 RTEMS_INLINE_ROUTINE void _POSIX_Mutex_Acquire_critical(
    56   POSIX_Mutex_Control  *the_mutex,
    57   Thread_queue_Context *queue_context
    58 )
    59 {
    60   _CORE_mutex_Acquire_critical(
    61     &the_mutex->Mutex.Recursive.Mutex,
     71RTEMS_INLINE_ROUTINE Thread_Control *_POSIX_Mutex_Acquire(
     72  POSIX_Mutex_Control  *the_mutex,
     73  Thread_queue_Context *queue_context
     74)
     75{
     76  ISR_Level       level;
     77  Thread_Control *executing;
     78
     79  _Thread_queue_Context_initialize( queue_context );
     80  _Thread_queue_Context_ISR_disable( queue_context, level );
     81  _Thread_queue_Context_set_ISR_level( queue_context, level );
     82  executing = _Thread_Executing;
     83  _Thread_queue_Queue_acquire_critical(
     84    &the_mutex->Recursive.Mutex.Queue.Queue,
     85    &executing->Potpourri_stats,
     86    &queue_context->Lock_context.Lock_context
     87  );
     88
     89  return executing;
     90}
     91
     92RTEMS_INLINE_ROUTINE void _POSIX_Mutex_Release(
     93  POSIX_Mutex_Control  *the_mutex,
     94  Thread_queue_Context *queue_context
     95)
     96{
     97  _Thread_queue_Queue_release(
     98    &the_mutex->Recursive.Mutex.Queue.Queue,
     99    &queue_context->Lock_context.Lock_context
     100  );
     101}
     102
     103RTEMS_INLINE_ROUTINE POSIX_Mutex_Protocol _POSIX_Mutex_Get_protocol(
     104  unsigned long flags
     105)
     106{
     107  return flags & POSIX_MUTEX_PROTOCOL_MASK;
     108}
     109
     110RTEMS_INLINE_ROUTINE bool _POSIX_Mutex_Is_recursive(
     111  unsigned long flags
     112)
     113{
     114  return ( flags & POSIX_MUTEX_RECURSIVE ) != 0;
     115}
     116
     117RTEMS_INLINE_ROUTINE Thread_Control *_POSIX_Mutex_Get_owner(
     118  const POSIX_Mutex_Control *the_mutex
     119)
     120{
     121  return the_mutex->Recursive.Mutex.Queue.Queue.owner;
     122}
     123
     124RTEMS_INLINE_ROUTINE bool _POSIX_Mutex_Is_locked(
     125  const POSIX_Mutex_Control *the_mutex
     126)
     127{
     128  return _POSIX_Mutex_Get_owner( the_mutex ) != NULL;
     129}
     130
     131Status_Control _POSIX_Mutex_Seize_slow(
     132  POSIX_Mutex_Control           *the_mutex,
     133  const Thread_queue_Operations *operations,
     134  Thread_Control                *executing,
     135  bool                           wait,
     136  Thread_queue_Context          *queue_context
     137);
     138
     139RTEMS_INLINE_ROUTINE void _POSIX_Mutex_Set_owner(
     140  POSIX_Mutex_Control *the_mutex,
     141  Thread_Control      *owner
     142)
     143{
     144  the_mutex->Recursive.Mutex.Queue.Queue.owner = owner;
     145}
     146
     147RTEMS_INLINE_ROUTINE bool _POSIX_Mutex_Is_owner(
     148  const POSIX_Mutex_Control *the_mutex,
     149  const Thread_Control      *the_thread
     150)
     151{
     152  return _POSIX_Mutex_Get_owner( the_mutex ) == the_thread;
     153}
     154
     155static Status_Control _POSIX_Mutex_Lock_nested(
     156  POSIX_Mutex_Control *the_mutex,
     157  unsigned long        flags
     158)
     159{
     160
     161  if ( _POSIX_Mutex_Is_recursive( flags ) ) {
     162    ++the_mutex->Recursive.nest_level;
     163    return STATUS_SUCCESSFUL;
     164  } else {
     165    return STATUS_NESTING_NOT_ALLOWED;
     166  }
     167}
     168
     169RTEMS_INLINE_ROUTINE Status_Control _POSIX_Mutex_Seize(
     170  POSIX_Mutex_Control           *the_mutex,
     171  unsigned long                  flags,
     172  const Thread_queue_Operations *operations,
     173  Thread_Control                *executing,
     174  bool                           wait,
     175  Thread_queue_Context          *queue_context
     176)
     177{
     178  Thread_Control *owner;
     179
     180  owner = _POSIX_Mutex_Get_owner( the_mutex );
     181
     182  if ( owner == NULL ) {
     183    _POSIX_Mutex_Set_owner( the_mutex, executing );
     184    _Thread_Resource_count_increment( executing );
     185    _POSIX_Mutex_Release( the_mutex, queue_context );
     186    return STATUS_SUCCESSFUL;
     187  }
     188
     189  if ( owner == executing ) {
     190    Status_Control status;
     191
     192    status = _POSIX_Mutex_Lock_nested( the_mutex, flags );
     193    _POSIX_Mutex_Release( the_mutex, queue_context );
     194    return status;
     195  }
     196
     197  return _POSIX_Mutex_Seize_slow(
     198    the_mutex,
     199    operations,
     200    executing,
     201    wait,
    62202    queue_context
    63203  );
    64204}
    65205
    66 RTEMS_INLINE_ROUTINE void _POSIX_Mutex_Release(
    67   POSIX_Mutex_Control  *the_mutex,
    68   Thread_queue_Context *queue_context
    69 )
    70 {
    71   _CORE_mutex_Release(
    72     &the_mutex->Mutex.Recursive.Mutex,
     206RTEMS_INLINE_ROUTINE Status_Control _POSIX_Mutex_Surrender(
     207  POSIX_Mutex_Control           *the_mutex,
     208  const Thread_queue_Operations *operations,
     209  Thread_Control                *executing,
     210  Thread_queue_Context          *queue_context
     211)
     212{
     213  unsigned int        nest_level;
     214  Thread_queue_Heads *heads;
     215
     216  if ( !_POSIX_Mutex_Is_owner( the_mutex, executing ) ) {
     217    _POSIX_Mutex_Release( the_mutex, queue_context );
     218    return STATUS_NOT_OWNER;
     219  }
     220
     221  nest_level = the_mutex->Recursive.nest_level;
     222
     223  if ( nest_level > 0 ) {
     224    the_mutex->Recursive.nest_level = nest_level - 1;
     225    _POSIX_Mutex_Release( the_mutex, queue_context );
     226    return STATUS_SUCCESSFUL;
     227  }
     228
     229  _Thread_Resource_count_decrement( executing );
     230  _POSIX_Mutex_Set_owner( the_mutex, NULL );
     231
     232  heads = the_mutex->Recursive.Mutex.Queue.Queue.heads;
     233
     234  if ( heads == NULL ) {
     235    _POSIX_Mutex_Release( the_mutex, queue_context );
     236    return STATUS_SUCCESSFUL;
     237  }
     238
     239  _Thread_queue_Surrender(
     240    &the_mutex->Recursive.Mutex.Queue.Queue,
     241    heads,
     242    executing,
     243    queue_context,
     244    operations
     245  );
     246  return STATUS_SUCCESSFUL;
     247}
     248
     249RTEMS_INLINE_ROUTINE const Scheduler_Control *_POSIX_Mutex_Get_scheduler(
     250  const POSIX_Mutex_Control *the_mutex
     251)
     252{
     253#if defined(RTEMS_SMP)
     254  return the_mutex->scheduler;
     255#else
     256  return &_Scheduler_Table[ 0 ];
     257#endif
     258}
     259
     260RTEMS_INLINE_ROUTINE void _POSIX_Mutex_Set_priority(
     261  POSIX_Mutex_Control  *the_mutex,
     262  Priority_Control      priority_ceiling,
     263  Thread_queue_Context *queue_context
     264)
     265{
     266  Thread_Control *owner;
     267
     268  owner = _POSIX_Mutex_Get_owner( the_mutex );
     269
     270  if ( owner != NULL ) {
     271    _Thread_Wait_acquire( owner, queue_context );
     272    _Thread_Priority_change(
     273      owner,
     274      &the_mutex->Priority_ceiling,
     275      priority_ceiling,
     276      false,
     277      queue_context
     278    );
     279    _Thread_Wait_release( owner, queue_context );
     280  } else {
     281    the_mutex->Priority_ceiling.priority = priority_ceiling;
     282  }
     283}
     284
     285RTEMS_INLINE_ROUTINE Priority_Control _POSIX_Mutex_Get_priority(
     286  const POSIX_Mutex_Control *the_mutex
     287)
     288{
     289  return the_mutex->Priority_ceiling.priority;
     290}
     291
     292RTEMS_INLINE_ROUTINE Status_Control _POSIX_Mutex_Ceiling_set_owner(
     293  POSIX_Mutex_Control  *the_mutex,
     294  Thread_Control       *owner,
     295  Thread_queue_Context *queue_context
     296)
     297{
     298  ISR_lock_Context  lock_context;
     299  Scheduler_Node   *scheduler_node;
     300  Per_CPU_Control  *cpu_self;
     301
     302  _Thread_Wait_acquire_default_critical( owner, &lock_context );
     303
     304  scheduler_node = _Thread_Scheduler_get_home_node( owner );
     305
     306  if (
     307    _Priority_Get_priority( &scheduler_node->Wait.Priority )
     308      < the_mutex->Priority_ceiling.priority
     309  ) {
     310    _Thread_Wait_release_default_critical( owner, &lock_context );
     311    _POSIX_Mutex_Release( the_mutex, queue_context );
     312    return STATUS_MUTEX_CEILING_VIOLATED;
     313  }
     314
     315  _POSIX_Mutex_Set_owner( the_mutex, owner );
     316  _Thread_Resource_count_increment( owner );
     317  _Thread_Priority_add(
     318    owner,
     319    &the_mutex->Priority_ceiling,
    73320    queue_context
    74321  );
    75 }
    76 
    77 /**
    78  *  @brief POSIX Mutex Allocate
    79  *
    80  *  This function allocates a mutexes control block from
    81  *  the inactive chain of free mutexes control blocks.
    82  */
    83 RTEMS_INLINE_ROUTINE POSIX_Mutex_Control *_POSIX_Mutex_Allocate( void )
    84 {
    85   return (POSIX_Mutex_Control *) _Objects_Allocate( &_POSIX_Mutex_Information );
    86 }
    87 
    88 /**
    89  *  @brief POSIX Mutex Free
    90  *
    91  *  This routine frees a mutexes control block to the
    92  *  inactive chain of free mutexes control blocks.
    93  */
    94 RTEMS_INLINE_ROUTINE void _POSIX_Mutex_Free(
    95   POSIX_Mutex_Control *the_mutex
    96 )
    97 {
    98   _Objects_Free( &_POSIX_Mutex_Information, &the_mutex->Object );
    99 }
    100 
     322  _Thread_Wait_release_default_critical( owner, &lock_context );
     323
     324  cpu_self = _Thread_Dispatch_disable_critical(
     325    &queue_context->Lock_context.Lock_context
     326  );
     327  _POSIX_Mutex_Release( the_mutex, queue_context );
     328  _Thread_Priority_update( queue_context );
     329  _Thread_Dispatch_enable( cpu_self );
     330  return STATUS_SUCCESSFUL;
     331}
     332
     333RTEMS_INLINE_ROUTINE Status_Control _POSIX_Mutex_Ceiling_seize(
     334  POSIX_Mutex_Control  *the_mutex,
     335  unsigned long         flags,
     336  Thread_Control       *executing,
     337  bool                  wait,
     338  Thread_queue_Context *queue_context
     339)
     340{
     341  Thread_Control *owner;
     342
     343  owner = _POSIX_Mutex_Get_owner( the_mutex );
     344
     345  if ( owner == NULL ) {
     346#if defined(RTEMS_SMP)
     347    if (
     348      _Thread_Scheduler_get_home( executing )
     349        != _POSIX_Mutex_Get_scheduler( the_mutex )
     350    ) {
     351      _POSIX_Mutex_Release( the_mutex, queue_context );
     352      return STATUS_NOT_DEFINED;
     353    }
     354#endif
     355
     356    _Thread_queue_Context_clear_priority_updates( queue_context );
     357    return _POSIX_Mutex_Ceiling_set_owner(
     358      the_mutex,
     359      executing,
     360      queue_context
     361    );
     362  }
     363
     364  if ( owner == executing ) {
     365    Status_Control status;
     366
     367    status = _POSIX_Mutex_Lock_nested( the_mutex, flags );
     368    _POSIX_Mutex_Release( the_mutex, queue_context );
     369    return status;
     370  }
     371
     372  return _POSIX_Mutex_Seize_slow(
     373    the_mutex,
     374    POSIX_MUTEX_PRIORITY_CEILING_TQ_OPERATIONS,
     375    executing,
     376    wait,
     377    queue_context
     378  );
     379}
     380
     381RTEMS_INLINE_ROUTINE Status_Control _POSIX_Mutex_Ceiling_surrender(
     382  POSIX_Mutex_Control  *the_mutex,
     383  Thread_Control       *executing,
     384  Thread_queue_Context *queue_context
     385)
     386{
     387  unsigned int        nest_level;
     388  ISR_lock_Context    lock_context;
     389  Per_CPU_Control    *cpu_self;
     390  Thread_queue_Heads *heads;
     391
     392  if ( !_POSIX_Mutex_Is_owner( the_mutex, executing ) ) {
     393    _POSIX_Mutex_Release( the_mutex, queue_context );
     394    return STATUS_NOT_OWNER;
     395  }
     396
     397  nest_level = the_mutex->Recursive.nest_level;
     398
     399  if ( nest_level > 0 ) {
     400    the_mutex->Recursive.nest_level = nest_level - 1;
     401    _POSIX_Mutex_Release( the_mutex, queue_context );
     402    return STATUS_SUCCESSFUL;
     403  }
     404
     405  _Thread_Resource_count_decrement( executing );
     406
     407  _Thread_queue_Context_clear_priority_updates( queue_context );
     408  _Thread_Wait_acquire_default_critical( executing, &lock_context );
     409  _Thread_Priority_remove(
     410    executing,
     411    &the_mutex->Priority_ceiling,
     412    queue_context
     413  );
     414  _Thread_Wait_release_default_critical( executing, &lock_context );
     415
     416  cpu_self = _Thread_Dispatch_disable_critical(
     417    &queue_context->Lock_context.Lock_context
     418  );
     419
     420  heads = the_mutex->Recursive.Mutex.Queue.Queue.heads;
     421
     422  if ( heads != NULL ) {
     423    const Thread_queue_Operations *operations;
     424    Thread_Control                *new_owner;
     425
     426    operations = POSIX_MUTEX_PRIORITY_CEILING_TQ_OPERATIONS;
     427    new_owner = ( *operations->first )( heads );
     428    _POSIX_Mutex_Set_owner( the_mutex, new_owner );
     429    _Thread_Resource_count_increment( new_owner );
     430    _Thread_Priority_add(
     431      new_owner,
     432      &the_mutex->Priority_ceiling,
     433      queue_context
     434    );
     435    _Thread_queue_Extract_critical(
     436      &the_mutex->Recursive.Mutex.Queue.Queue,
     437      operations,
     438      new_owner,
     439      queue_context
     440    );
     441  } else {
     442    _POSIX_Mutex_Set_owner( the_mutex, NULL );
     443    _POSIX_Mutex_Release( the_mutex, queue_context );
     444  }
     445
     446  _Thread_Priority_update( queue_context );
     447  _Thread_Dispatch_enable( cpu_self );
     448  return STATUS_SUCCESSFUL;
     449}
    101450
    102451/**
     
    112461);
    113462
    114 /**
    115  *  @brief POSIX Mutex Get (Interrupt Disable)
    116  *
    117  *  A support routine which translates the mutex id into a local pointer.
    118  *  As a side-effect, it may create the mutex.
    119  *
    120  *  @note: This version of the method uses an interrupt critical section.
    121  */
    122 POSIX_Mutex_Control *_POSIX_Mutex_Get(
    123   pthread_mutex_t      *mutex,
    124   Thread_queue_Context *queue_context
    125 );
    126 
    127 RTEMS_INLINE_ROUTINE POSIX_Mutex_Control *_POSIX_Mutex_Get_no_protection(
    128   const pthread_mutex_t *mutex
    129 )
    130 {
    131   return (POSIX_Mutex_Control *) _Objects_Get_no_protection(
    132     (Objects_Id) *mutex,
    133     &_POSIX_Mutex_Information
    134   );
    135 }
     463static inline POSIX_Mutex_Control *_POSIX_Mutex_Get(
     464  pthread_mutex_t *mutex
     465)
     466{
     467  return (POSIX_Mutex_Control *) mutex;
     468}
     469
     470bool _POSIX_Mutex_Auto_initialization( POSIX_Mutex_Control *the_mutex );
     471
     472#define POSIX_MUTEX_VALIDATE_OBJECT( the_mutex, flags ) \
     473  do { \
     474    if ( ( the_mutex ) == NULL ) { \
     475      return EINVAL; \
     476    } \
     477    flags = ( the_mutex )->flags; \
     478    if ( \
     479      ( ( (uintptr_t) ( the_mutex ) ^ POSIX_MUTEX_MAGIC ) \
     480          & ~POSIX_MUTEX_FLAGS_MASK ) \
     481        != ( flags & ~POSIX_MUTEX_FLAGS_MASK ) \
     482    ) { \
     483      if ( !_POSIX_Mutex_Auto_initialization( the_mutex ) ) { \
     484        return EINVAL; \
     485      } \
     486    } \
     487  } while ( 0 )
    136488
    137489#ifdef __cplusplus
  • cpukit/posix/preinstall.am

    r5222488 rde59c065  
    4747        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/config.h
    4848PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/config.h
     49
     50$(PROJECT_INCLUDE)/rtems/posix/muteximpl.h: include/rtems/posix/muteximpl.h $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp)
     51        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/muteximpl.h
     52PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/muteximpl.h
    4953
    5054$(PROJECT_INCLUDE)/rtems/posix/posixapi.h: include/rtems/posix/posixapi.h $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp)
     
    97101PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/mqueueimpl.h
    98102
    99 $(PROJECT_INCLUDE)/rtems/posix/mutex.h: include/rtems/posix/mutex.h $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp)
    100         $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/mutex.h
    101 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/mutex.h
    102 
    103 $(PROJECT_INCLUDE)/rtems/posix/muteximpl.h: include/rtems/posix/muteximpl.h $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp)
    104         $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/muteximpl.h
    105 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/muteximpl.h
    106 
    107103$(PROJECT_INCLUDE)/rtems/posix/psignal.h: include/rtems/posix/psignal.h $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp)
    108104        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/psignal.h
  • cpukit/posix/src/mutexdestroy.c

    r5222488 rde59c065  
    3030{
    3131  POSIX_Mutex_Control  *the_mutex;
     32  unsigned long         flags;
    3233  Thread_queue_Context  queue_context;
    3334  int                   eno;
    3435
    35   _Objects_Allocator_lock();
     36  the_mutex = _POSIX_Mutex_Get( mutex );
     37  POSIX_MUTEX_VALIDATE_OBJECT( the_mutex, flags );
    3638
    37   the_mutex = _POSIX_Mutex_Get( mutex, &queue_context );
     39  _POSIX_Mutex_Acquire( the_mutex, &queue_context );
    3840
    39   if ( the_mutex != NULL ) {
    40     _POSIX_Mutex_Acquire_critical( the_mutex, &queue_context );
    41 
    42     /*
    43      * XXX: There is an error for the mutex being locked
    44      *  or being in use by a condition variable.
    45      */
    46 
    47     if (
    48       !_CORE_mutex_Is_locked( &the_mutex->Mutex.Recursive.Mutex )
    49     ) {
    50       _Objects_Close( &_POSIX_Mutex_Information, &the_mutex->Object );
    51       _POSIX_Mutex_Release( the_mutex, &queue_context );
    52       _CORE_mutex_Destroy( &the_mutex->Mutex.Recursive.Mutex );
    53       _POSIX_Mutex_Free( the_mutex );
    54       eno = 0;
    55     } else {
    56       _POSIX_Mutex_Release( the_mutex, &queue_context );
    57       eno = EBUSY;
    58     }
     41  if ( _POSIX_Mutex_Get_owner( the_mutex ) == NULL ) {
     42    the_mutex->flags = ~the_mutex->flags;
     43    eno = 0;
    5944  } else {
    60     eno = EINVAL;
     45    eno = EBUSY;
    6146  }
    6247
    63   _Objects_Allocator_unlock();
     48  _POSIX_Mutex_Release( the_mutex, &queue_context );
    6449  return eno;
    6550}
  • cpukit/posix/src/mutexgetprioceiling.c

    r5222488 rde59c065  
    3232{
    3333  POSIX_Mutex_Control  *the_mutex;
     34  unsigned long         flags;
    3435  Thread_queue_Context  queue_context;
    3536
     
    3839  }
    3940
    40   the_mutex = _POSIX_Mutex_Get( mutex, &queue_context );
     41  the_mutex = _POSIX_Mutex_Get( mutex );
     42  POSIX_MUTEX_VALIDATE_OBJECT( the_mutex, flags );
    4143
    42   if ( the_mutex == NULL ) {
    43     return EINVAL;
    44   }
     44  _POSIX_Mutex_Acquire( the_mutex, &queue_context );
    4545
    46   _POSIX_Mutex_Acquire_critical( the_mutex, &queue_context );
    47 
    48   if ( the_mutex->protocol == POSIX_MUTEX_PRIORITY_CEILING ) {
     46  if ( _POSIX_Mutex_Get_protocol( flags ) == POSIX_MUTEX_PRIORITY_CEILING ) {
    4947    *prioceiling = _POSIX_Priority_From_core(
    50       _CORE_ceiling_mutex_Get_scheduler( &the_mutex->Mutex ),
    51       _CORE_ceiling_mutex_Get_priority( &the_mutex->Mutex )
     48      _POSIX_Mutex_Get_scheduler( the_mutex ),
     49      _POSIX_Mutex_Get_priority( the_mutex )
    5250    );
    5351  } else {
     
    5654
    5755  _POSIX_Mutex_Release( the_mutex, &queue_context );
    58 
    5956  return 0;
    6057}
  • cpukit/posix/src/mutexinit.c

    r5222488 rde59c065  
    2424#include <rtems/score/schedulerimpl.h>
    2525
     26RTEMS_STATIC_ASSERT(
     27  offsetof( POSIX_Mutex_Control, flags )
     28    == offsetof( pthread_mutex_t, _flags ),
     29  POSIX_MUTEX_CONTROL_FLAGS
     30);
     31
     32RTEMS_STATIC_ASSERT(
     33  offsetof( POSIX_Mutex_Control, Recursive )
     34    == offsetof( pthread_mutex_t, _Recursive ),
     35  POSIX_MUTEX_CONTROL_RECURSIVE
     36);
     37
     38RTEMS_STATIC_ASSERT(
     39  offsetof( POSIX_Mutex_Control, Priority_ceiling )
     40    == offsetof( pthread_mutex_t, _Priority_ceiling ),
     41  POSIX_MUTEX_CONTROL_SCHEDULER
     42);
     43
     44RTEMS_STATIC_ASSERT(
     45  offsetof( POSIX_Mutex_Control, scheduler )
     46    == offsetof( pthread_mutex_t, _scheduler ),
     47  POSIX_MUTEX_CONTROL_SCHEDULER
     48);
     49
     50RTEMS_STATIC_ASSERT(
     51  sizeof( POSIX_Mutex_Control ) == sizeof( pthread_mutex_t ),
     52  POSIX_MUTEX_CONTROL_SIZE
     53);
     54
     55const pthread_mutexattr_t _POSIX_Mutex_Default_attributes = {
     56#if defined(_UNIX98_THREAD_MUTEX_ATTRIBUTES)
     57  .type           = PTHREAD_MUTEX_DEFAULT,
     58#endif
     59  .is_initialized = true,
     60  .process_shared = PTHREAD_PROCESS_PRIVATE,
     61  .prio_ceiling   = INT_MAX,
     62  .protocol       = PTHREAD_PRIO_NONE,
     63  .recursive      = false
     64};
     65
    2666/**
    2767 * 11.3.2 Initializing and Destroying a Mutex, P1003.1c/Draft 10, p. 87
     
    3979  const pthread_mutexattr_t *the_attr;
    4080  POSIX_Mutex_Protocol       protocol;
     81  unsigned long              flags;
     82  Priority_Control           priority;
    4183  const Scheduler_Control   *scheduler;
    4284
     
    102144#endif
    103145
    104   the_mutex = _POSIX_Mutex_Allocate();
     146  the_mutex = _POSIX_Mutex_Get( mutex );
    105147
    106   if ( !the_mutex ) {
    107     _Objects_Allocator_unlock();
    108     return EAGAIN;
     148  flags = (uintptr_t) the_mutex ^ POSIX_MUTEX_MAGIC;
     149  flags &= ~POSIX_MUTEX_FLAGS_MASK;
     150  flags |= protocol;
     151
     152  if ( the_attr->type == PTHREAD_MUTEX_RECURSIVE ) {
     153    flags |= POSIX_MUTEX_RECURSIVE;
    109154  }
    110155
    111   the_mutex->protocol = protocol;
    112   the_mutex->is_recursive = ( the_attr->type == PTHREAD_MUTEX_RECURSIVE );
     156  the_mutex->flags = flags;
    113157
    114158  if ( protocol == POSIX_MUTEX_PRIORITY_CEILING ) {
    115     int               prio_ceiling;
    116     bool              valid;
    117     Priority_Control  priority;
     159    int  prio_ceiling;
     160    bool valid;
    118161
    119162    scheduler = _Thread_Scheduler_get_home( _Thread_Get_executing() );
     
    126169    priority = _POSIX_Priority_To_core( scheduler, prio_ceiling, &valid );
    127170    if ( !valid ) {
    128       _POSIX_Mutex_Free(the_mutex);
    129       _Objects_Allocator_unlock();
    130171      return EINVAL;
    131172    }
    132     _CORE_ceiling_mutex_Initialize( &the_mutex->Mutex, scheduler, priority );
    133173  } else {
    134     _Assert(
    135       the_mutex->protocol == POSIX_MUTEX_NO_PROTOCOL
    136         || the_mutex->protocol == POSIX_MUTEX_PRIORITY_INHERIT
    137     );
    138     _CORE_recursive_mutex_Initialize( &the_mutex->Mutex.Recursive );
     174    priority = 0;
     175    scheduler = NULL;
    139176  }
    140177
    141   _Objects_Open_u32( &_POSIX_Mutex_Information, &the_mutex->Object, 0 );
    142 
    143   *mutex = the_mutex->Object.id;
    144 
    145   _Objects_Allocator_unlock();
     178  _Thread_queue_Queue_initialize(
     179    &the_mutex->Recursive.Mutex.Queue.Queue,
     180    NULL
     181  );
     182  the_mutex->Recursive.nest_level = 0;
     183  _Priority_Node_initialize( &the_mutex->Priority_ceiling, priority );
     184  the_mutex->scheduler = scheduler;
    146185  return 0;
    147186}
  • cpukit/posix/src/mutexlocksupp.c

    r5222488 rde59c065  
    2222#include <rtems/posix/posixapi.h>
    2323
    24 THREAD_QUEUE_OBJECT_ASSERT(
    25   POSIX_Mutex_Control,
    26   Mutex.Recursive.Mutex.Wait_queue
    27 );
    28 
    29 static Status_Control _POSIX_Mutex_Lock_nested(
    30   CORE_recursive_mutex_Control *the_recursive_mutex
     24Status_Control _POSIX_Mutex_Seize_slow(
     25  POSIX_Mutex_Control           *the_mutex,
     26  const Thread_queue_Operations *operations,
     27  Thread_Control                *executing,
     28  bool                           wait,
     29  Thread_queue_Context          *queue_context
    3130)
    3231{
    33   POSIX_Mutex_Control *the_mutex;
    34 
    35   the_mutex = RTEMS_CONTAINER_OF(
    36     the_recursive_mutex,
    37     POSIX_Mutex_Control,
    38     Mutex.Recursive
    39   );
    40 
    41   if ( the_mutex->is_recursive ) {
    42     return _CORE_recursive_mutex_Seize_nested( the_recursive_mutex );
     32  if ( wait ) {
     33    _Thread_queue_Context_set_thread_state(
     34      queue_context,
     35      STATES_WAITING_FOR_MUTEX
     36    );
     37    _Thread_queue_Context_set_do_nothing_enqueue_callout( queue_context );
     38    _Thread_queue_Context_set_deadlock_callout(
     39      queue_context,
     40      _Thread_queue_Deadlock_status
     41    );
     42    _Thread_queue_Enqueue(
     43      &the_mutex->Recursive.Mutex.Queue.Queue,
     44      operations,
     45      executing,
     46      queue_context
     47    );
     48    return _Thread_Wait_get_status( executing );
    4349  } else {
    44     return STATUS_NESTING_NOT_ALLOWED;
     50    _POSIX_Mutex_Release( the_mutex, queue_context );
     51    return STATUS_UNAVAILABLE;
    4552  }
    4653}
     
    5360{
    5461  POSIX_Mutex_Control  *the_mutex;
     62  unsigned long         flags;
    5563  Thread_queue_Context  queue_context;
    5664  Thread_Control       *executing;
    5765  Status_Control        status;
    5866
    59   the_mutex = _POSIX_Mutex_Get( mutex, &queue_context );
     67  the_mutex = _POSIX_Mutex_Get( mutex );
     68  POSIX_MUTEX_VALIDATE_OBJECT( the_mutex, flags );
    6069
    61   if ( the_mutex == NULL ) {
    62     return EINVAL;
    63   }
    64 
    65   executing = _Thread_Executing;
     70  executing = _POSIX_Mutex_Acquire( the_mutex, &queue_context );
    6671  _Thread_queue_Context_set_relative_timeout( &queue_context, timeout );
    6772
    68   switch ( the_mutex->protocol ) {
     73  switch ( _POSIX_Mutex_Get_protocol( flags ) ) {
    6974    case POSIX_MUTEX_PRIORITY_CEILING:
    70       status = _CORE_ceiling_mutex_Seize(
    71         &the_mutex->Mutex,
     75      status = _POSIX_Mutex_Ceiling_seize(
     76        the_mutex,
     77        flags,
    7278        executing,
    7379        wait,
    74         _POSIX_Mutex_Lock_nested,
    7580        &queue_context
    7681      );
    7782      break;
    7883    case POSIX_MUTEX_NO_PROTOCOL:
    79       status = _CORE_recursive_mutex_Seize(
    80         &the_mutex->Mutex.Recursive,
     84      status = _POSIX_Mutex_Seize(
     85        the_mutex,
     86        flags,
    8187        POSIX_MUTEX_NO_PROTOCOL_TQ_OPERATIONS,
    8288        executing,
    8389        wait,
    84         _POSIX_Mutex_Lock_nested,
    8590        &queue_context
    8691      );
    8792      break;
    8893    default:
    89       _Assert( the_mutex->protocol == POSIX_MUTEX_PRIORITY_INHERIT );
    90       status = _CORE_recursive_mutex_Seize(
    91         &the_mutex->Mutex.Recursive,
    92         CORE_MUTEX_TQ_PRIORITY_INHERIT_OPERATIONS,
     94      _Assert(
     95        _POSIX_Mutex_Get_protocol( flags ) == POSIX_MUTEX_PRIORITY_INHERIT
     96      );
     97      status = _POSIX_Mutex_Seize(
     98        the_mutex,
     99        flags,
     100        POSIX_MUTEX_PRIORITY_INHERIT_TQ_OPERATIONS,
    93101        executing,
    94102        wait,
    95         _POSIX_Mutex_Lock_nested,
    96103        &queue_context
    97104      );
  • cpukit/posix/src/mutexsetprioceiling.c

    r5222488 rde59c065  
    5050  }
    5151
    52   the_mutex = _POSIX_Mutex_Get_no_protection( mutex );
    53   _Assert( the_mutex != NULL );
     52  the_mutex = _POSIX_Mutex_Get( mutex );
    5453
    55   if ( the_mutex->protocol == POSIX_MUTEX_PRIORITY_CEILING ) {
     54  if (
     55    _POSIX_Mutex_Get_protocol( the_mutex->flags )
     56      == POSIX_MUTEX_PRIORITY_CEILING
     57  ) {
    5658    const Scheduler_Control *scheduler;
    5759    bool                     valid;
     
    5961    Priority_Control         old_priority;
    6062
    61     scheduler = _CORE_ceiling_mutex_Get_scheduler( &the_mutex->Mutex );
    62     old_priority = _CORE_ceiling_mutex_Get_priority( &the_mutex->Mutex );
     63    scheduler = _POSIX_Mutex_Get_scheduler( the_mutex );
     64    old_priority = _POSIX_Mutex_Get_priority( the_mutex );
    6365    *old_ceiling = _POSIX_Priority_From_core( scheduler, old_priority );
    6466
     
    7072      _Thread_queue_Context_initialize( &queue_context );
    7173      _Thread_queue_Context_clear_priority_updates( &queue_context );
    72       _CORE_ceiling_mutex_Set_priority(
    73         &the_mutex->Mutex,
     74      _POSIX_Mutex_Set_priority(
     75        the_mutex,
    7476        new_priority,
    7577        &queue_context
  • cpukit/posix/src/mutexunlock.c

    r5222488 rde59c065  
    2222#include <rtems/posix/posixapi.h>
    2323
     24#include <string.h>
     25
     26bool _POSIX_Mutex_Auto_initialization( POSIX_Mutex_Control *the_mutex )
     27{
     28  unsigned long zero;
     29  unsigned long flags;
     30
     31  /* We cannot use memset() and memcmp() due to structure internal padding */
     32  zero = 0;
     33  zero |= the_mutex->flags;
     34#if defined(RTEMS_SMP)
     35  zero |= _Atomic_Load_uint(
     36    &the_mutex->Recursive.Mutex.Queue.Queue.Lock.next_ticket,
     37    ATOMIC_ORDER_RELAXED
     38  );
     39  zero |= _Atomic_Load_uint(
     40    &the_mutex->Recursive.Mutex.Queue.Queue.Lock.now_serving,
     41    ATOMIC_ORDER_RELAXED
     42  );
     43#else
     44  zero |= the_mutex->Recursive.Mutex.Queue.reserved[ 0 ];
     45  zero |= the_mutex->Recursive.Mutex.Queue.reserved[ 1 ];
     46#endif
     47  zero |= (unsigned long) the_mutex->Recursive.Mutex.Queue.Queue.heads;
     48  zero |= (unsigned long) the_mutex->Recursive.Mutex.Queue.Queue.owner;
     49  zero |= (unsigned long) the_mutex->Recursive.Mutex.Queue.Queue.name;
     50  zero |= the_mutex->Recursive.nest_level;
     51  zero |= (unsigned long) the_mutex->Priority_ceiling.Node.RBTree.Node.rbe_left;
     52  zero |= (unsigned long) the_mutex->Priority_ceiling.Node.RBTree.Node.rbe_right;
     53  zero |= (unsigned long) the_mutex->Priority_ceiling.Node.RBTree.Node.rbe_parent;
     54  zero |= (unsigned long) the_mutex->Priority_ceiling.Node.RBTree.Node.rbe_color;
     55  zero |= (unsigned long) the_mutex->Priority_ceiling.priority;
     56  zero |= (unsigned long) (the_mutex->Priority_ceiling.priority >> 32);
     57  zero |= (unsigned long) the_mutex->scheduler;
     58
     59  if ( zero != 0 ) {
     60    return false;
     61  }
     62
     63  flags = (uintptr_t) the_mutex ^ POSIX_MUTEX_MAGIC;
     64  flags &= ~POSIX_MUTEX_FLAGS_MASK;
     65  the_mutex->flags = flags;
     66  return true;
     67}
     68
    2469/*
    2570 *  11.3.3 Locking and Unlocking a Mutex, P1003.1c/Draft 10, p. 93
     
    3378{
    3479  POSIX_Mutex_Control  *the_mutex;
     80  unsigned long         flags;
    3581  Thread_queue_Context  queue_context;
    3682  Thread_Control       *executing;
    3783  Status_Control        status;
    3884
    39   the_mutex = _POSIX_Mutex_Get( mutex, &queue_context );
     85  the_mutex = _POSIX_Mutex_Get( mutex );
     86  POSIX_MUTEX_VALIDATE_OBJECT( the_mutex, flags );
    4087
    41   if ( the_mutex == NULL ) {
    42     return EINVAL;
    43   }
     88  executing = _POSIX_Mutex_Acquire( the_mutex, &queue_context );
    4489
    45   executing = _Thread_Executing;
    46 
    47   switch ( the_mutex->protocol ) {
     90  switch ( _POSIX_Mutex_Get_protocol( flags ) ) {
    4891    case POSIX_MUTEX_PRIORITY_CEILING:
    49       status = _CORE_ceiling_mutex_Surrender(
    50         &the_mutex->Mutex,
     92      status = _POSIX_Mutex_Ceiling_surrender(
     93        the_mutex,
    5194        executing,
    5295        &queue_context
     
    5497      break;
    5598    case POSIX_MUTEX_NO_PROTOCOL:
    56       status = _CORE_recursive_mutex_Surrender(
    57         &the_mutex->Mutex.Recursive,
     99      status = _POSIX_Mutex_Surrender(
     100        the_mutex,
    58101        POSIX_MUTEX_NO_PROTOCOL_TQ_OPERATIONS,
    59102        executing,
     
    62105      break;
    63106    default:
    64       _Assert( the_mutex->protocol == POSIX_MUTEX_PRIORITY_INHERIT );
    65       status = _CORE_recursive_mutex_Surrender(
    66         &the_mutex->Mutex.Recursive,
    67         CORE_MUTEX_TQ_PRIORITY_INHERIT_OPERATIONS,
     107      _Assert(
     108        _POSIX_Mutex_Get_protocol( flags ) == POSIX_MUTEX_PRIORITY_INHERIT
     109      );
     110      status = _POSIX_Mutex_Surrender(
     111        the_mutex,
     112        POSIX_MUTEX_PRIORITY_INHERIT_TQ_OPERATIONS,
    68113        executing,
    69114        &queue_context
  • cpukit/rtems/src/rtemsobjectgetapiclassname.c

    r5222488 rde59c065  
    5050  { "Interrupt",               OBJECTS_POSIX_INTERRUPTS, 0},
    5151  { "Message Queue",           OBJECTS_POSIX_MESSAGE_QUEUES, 0},
    52   { "Mutex",                   OBJECTS_POSIX_MUTEXES, 0},
    5352  { "Semaphore",               OBJECTS_POSIX_SEMAPHORES, 0},
    5453  { "Timer",                   OBJECTS_POSIX_TIMERS, 0},
  • cpukit/sapi/include/confdefs.h

    r5222488 rde59c065  
    18351835     */
    18361836    #define _CONFIGURE_LIBBLOCK_SEMAPHORES 1
    1837 
    1838     /*
    1839      * POSIX Mutexes:
    1840      *  o bdbuf lock
    1841      *  o bdbuf sync lock
    1842      */
    1843     #define _CONFIGURE_LIBBLOCK_POSIX_MUTEXES 2
    18441837  #else
    18451838    /*
     
    18531846     */
    18541847    #define _CONFIGURE_LIBBLOCK_SEMAPHORES 6
    1855 
    1856     #define _CONFIGURE_LIBBLOCK_POSIX_MUTEXES 0
    18571848  #endif
    18581849
     
    18691860  /** This specifies the number of Classic API semaphores needed by libblock. */
    18701861  #define _CONFIGURE_LIBBLOCK_SEMAPHORES 0
    1871   /** This specifies the number of POSIX Mutexes needed by libblock. */
    1872   #define _CONFIGURE_LIBBLOCK_POSIX_MUTEXES 0
    18731862#endif /* CONFIGURE_APPLICATION_NEEDS_LIBBLOCK */
    18741863/**@}*/
     
    20402029    #if !defined(CONFIGURE_MAXIMUM_POSIX_THREADS)
    20412030      #define CONFIGURE_MAXIMUM_POSIX_THREADS \
    2042         rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
    2043     #endif
    2044     #if !defined(CONFIGURE_MAXIMUM_POSIX_MUTEXES)
    2045       #define CONFIGURE_MAXIMUM_POSIX_MUTEXES \
    20462031        rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE)
    20472032    #endif
     
    24242409  #include <mqueue.h>
    24252410  #include <rtems/posix/mqueue.h>
    2426   #include <rtems/posix/mutex.h>
    24272411  #include <rtems/posix/psignal.h>
    24282412  #include <rtems/posix/pthread.h>
     
    24482432    #define CONFIGURE_MAXIMUM_POSIX_THREADS 0
    24492433  #endif
    2450 
    2451   /**
    2452    * This configuration parameter specifies the maximum number of
    2453    * POSIX API mutexes.
    2454    */
    2455   #ifndef CONFIGURE_MAXIMUM_POSIX_MUTEXES
    2456     #define CONFIGURE_MAXIMUM_POSIX_MUTEXES 0
    2457   #endif
    2458 
    2459   /*
    2460    * This macro is calculated to specify the memory required for
    2461    * POSIX API mutexes.
    2462    */
    2463   #define _CONFIGURE_MEMORY_FOR_POSIX_MUTEXES(_mutexes) \
    2464     _Configure_Object_RAM(_mutexes, sizeof(POSIX_Mutex_Control) )
    24652434
    24662435  /**
     
    26252594/**@{*/
    26262595#ifdef CONFIGURE_GNAT_RTEMS
    2627 
    2628   /**
    2629    * The GNAT run-time needs something less than (10) POSIX mutexes.
    2630    * We may be able to get by with less but why bother.
    2631    */
    2632   #define _CONFIGURE_GNAT_MUTEXES 10
    2633 
    26342596  /**
    26352597   * This is the maximum number of Ada tasks which can be concurrently
     
    26472609    #define CONFIGURE_MAXIMUM_FAKE_ADA_TASKS 0
    26482610  #endif
    2649 
    26502611#else
    26512612  /** This defines he number of POSIX mutexes GNAT needs. */
    2652   #define _CONFIGURE_GNAT_MUTEXES          0
    26532613  /** This defines he number of Ada tasks needed by the application. */
    26542614  #define CONFIGURE_MAXIMUM_ADA_TASKS      0
     
    26752635    #define CONFIGURE_MAXIMUM_POSIX_THREADS 1
    26762636  #endif
    2677   #ifndef CONFIGURE_MAXIMUM_POSIX_MUTEXES
    2678     #define CONFIGURE_MAXIMUM_POSIX_MUTEXES 1
    2679   #endif
    2680 
    2681   #define _CONFIGURE_GO_INIT_MUTEXES 77
    26822637
    26832638  #ifndef CONFIGURE_MAXIMUM_GOROUTINES
     
    26902645
    26912646#else
    2692   /*
    2693    * This specifies the number of mutexes required by the Go run-time
    2694    * for its own use.
    2695    */
    2696   #define _CONFIGURE_GO_INIT_MUTEXES             0
    2697 
    26982647  /** This specifies the maximum number of Go co-routines. */
    26992648  #define CONFIGURE_MAXIMUM_GOROUTINES          0
     
    27212670
    27222671#ifdef RTEMS_POSIX_API
    2723   /**
    2724    * This macro provides summation of the POSIX Mutexes.
    2725    */
    2726   #define _CONFIGURE_POSIX_MUTEXES \
    2727     (CONFIGURE_MAXIMUM_POSIX_MUTEXES + \
    2728       _CONFIGURE_LIBBLOCK_POSIX_MUTEXES + \
    2729       _CONFIGURE_GNAT_MUTEXES + \
    2730       CONFIGURE_MAXIMUM_ADA_TASKS + \
    2731       CONFIGURE_MAXIMUM_FAKE_ADA_TASKS + \
    2732       _CONFIGURE_GO_INIT_MUTEXES + \
    2733       CONFIGURE_MAXIMUM_GO_CHANNELS)
    2734 
    27352672  /*
    27362673   * This macro is calculated to specify the memory required for
     
    27382675   */
    27392676  #define _CONFIGURE_MEMORY_FOR_POSIX \
    2740     (_CONFIGURE_MEMORY_FOR_POSIX_MUTEXES(_CONFIGURE_POSIX_MUTEXES) + \
    2741       _CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS( \
     2677    (_CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS( \
    27422678        CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS) + \
    27432679      _CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES( \
     
    31903126    posix_api_configuration_table Configuration_POSIX_API = {
    31913127      _CONFIGURE_POSIX_THREADS,
    3192       _CONFIGURE_POSIX_MUTEXES,
    31933128      CONFIGURE_MAXIMUM_POSIX_TIMERS,
    31943129      CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS,
     
    34033338#ifdef RTEMS_POSIX_API
    34043339    /* POSIX API Pieces */
    3405     uint32_t POSIX_MUTEXES;
    34063340    uint32_t POSIX_TIMERS;
    34073341    uint32_t POSIX_QUEUED_SIGNALS;
     
    34523386#ifdef RTEMS_POSIX_API
    34533387    /* POSIX API Pieces */
    3454     _CONFIGURE_MEMORY_FOR_POSIX_MUTEXES( _CONFIGURE_POSIX_MUTEXES ),
    34553388    _CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS(
    34563389      CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS ),
     
    35223455#if !defined(RTEMS_POSIX_API)
    35233456  #if ((CONFIGURE_MAXIMUM_POSIX_THREADS != 0) || \
    3524        (CONFIGURE_MAXIMUM_POSIX_MUTEXES != 0) || \
    35253457       (CONFIGURE_MAXIMUM_POSIX_TIMERS != 0) || \
    35263458       (CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS != 0) || \
  • cpukit/sapi/src/posixapi.c

    r5222488 rde59c065  
    2323#include <rtems/posix/barrierimpl.h>
    2424#include <rtems/posix/condimpl.h>
     25#include <rtems/posix/muteximpl.h>
    2526#include <rtems/posix/rwlockimpl.h>
    2627#include <rtems/posix/semaphoreimpl.h>
     
    108109  POSIX_CONDITION_VARIABLES_MAGIC_4
    109110);
     111RTEMS_STATIC_ASSERT(
     112  POSIX_MUTEX_MAGIC != HEAP_BEGIN_PROTECTOR_0,
     113  POSIX_MUTEX_MAGIC_0
     114);
     115RTEMS_STATIC_ASSERT(
     116  POSIX_MUTEX_MAGIC != HEAP_BEGIN_PROTECTOR_1,
     117  POSIX_MUTEX_MAGIC_1
     118);
     119RTEMS_STATIC_ASSERT(
     120  POSIX_MUTEX_MAGIC != HEAP_END_PROTECTOR_0,
     121  POSIX_MUTEX_MAGIC_2
     122);
     123RTEMS_STATIC_ASSERT(
     124  POSIX_MUTEX_MAGIC != HEAP_END_PROTECTOR_1,
     125  POSIX_MUTEX_MAGIC_3
     126);
     127RTEMS_STATIC_ASSERT(
     128  POSIX_MUTEX_MAGIC != HEAP_FREE_PATTERN,
     129  POSIX_MUTEX_MAGIC_4
     130);
    110131#endif
    111132
     
    123144);
    124145RTEMS_STATIC_ASSERT(
     146  POSIX_SEMAPHORE_MAGIC != POSIX_MUTEX_MAGIC,
     147  POSIX_SEMAPHORE_MAGIC_8
     148);
     149RTEMS_STATIC_ASSERT(
    125150  POSIX_BARRIER_MAGIC != POSIX_RWLOCK_MAGIC,
    126151  POSIX_BARRIER_MAGIC_5
     
    131156);
    132157RTEMS_STATIC_ASSERT(
     158  POSIX_BARRIER_MAGIC != POSIX_MUTEX_MAGIC,
     159  POSIX_BARRIER_MAGIC_7
     160);
     161RTEMS_STATIC_ASSERT(
    133162  POSIX_RWLOCK_MAGIC != POSIX_CONDITION_VARIABLES_MAGIC,
    134163  POSIX_RWLOCK_MAGIC_5
     164);
     165RTEMS_STATIC_ASSERT(
     166  POSIX_RWLOCK_MAGIC != POSIX_MUTEX_MAGIC,
     167  POSIX_RWLOCK_MAGIC_6
     168);
     169RTEMS_STATIC_ASSERT(
     170  POSIX_CONDITION_VARIABLES_MAGIC != POSIX_MUTEX_MAGIC,
     171  POSIX_CONDITION_VARIABLES_MAGIC_5
    135172);
    136173
  • cpukit/score/Makefile.am

    r5222488 rde59c065  
    5555include_rtems_score_HEADERS += include/rtems/score/mrsp.h
    5656include_rtems_score_HEADERS += include/rtems/score/mrspimpl.h
     57include_rtems_score_HEADERS += include/rtems/score/muteximpl.h
    5758include_rtems_score_HEADERS += include/rtems/score/object.h
    5859include_rtems_score_HEADERS += include/rtems/score/objectimpl.h
  • cpukit/score/include/rtems/score/objectimpl.h

    r5222488 rde59c065  
    8888  OBJECTS_POSIX_INTERRUPTS          = 3,
    8989  OBJECTS_POSIX_MESSAGE_QUEUES      = 5,
    90   OBJECTS_POSIX_MUTEXES             = 6,
    9190  OBJECTS_POSIX_SEMAPHORES          = 7,
    9291  OBJECTS_POSIX_TIMERS              = 9,
  • cpukit/score/include/rtems/sysinit.h

    r5222488 rde59c065  
    4848#define RTEMS_SYSINIT_POSIX_SIGNALS              000360
    4949#define RTEMS_SYSINIT_POSIX_THREADS              000361
    50 #define RTEMS_SYSINIT_POSIX_MUTEX                000363
    5150#define RTEMS_SYSINIT_POSIX_MESSAGE_QUEUE        000364
    5251#define RTEMS_SYSINIT_POSIX_SEMAPHORE            000365
  • cpukit/score/preinstall.am

    r5222488 rde59c065  
    184184        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/mrspimpl.h
    185185PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/mrspimpl.h
     186
     187$(PROJECT_INCLUDE)/rtems/score/muteximpl.h: include/rtems/score/muteximpl.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
     188        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/muteximpl.h
     189PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/muteximpl.h
    186190
    187191$(PROJECT_INCLUDE)/rtems/score/object.h: include/rtems/score/object.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
  • cpukit/score/src/mutex.c

    r5222488 rde59c065  
    2121
    2222#include <rtems/score/assert.h>
     23#include <rtems/score/muteximpl.h>
    2324#include <rtems/score/threadimpl.h>
    24 #include <rtems/score/threadqimpl.h>
    2525#include <rtems/score/todimpl.h>
    2626
    2727#define MUTEX_TQ_OPERATIONS &_Thread_queue_Operations_priority_inherit
    28 
    29 typedef struct {
    30   Thread_queue_Syslock_queue Queue;
    31 } Mutex_Control;
    3228
    3329RTEMS_STATIC_ASSERT(
     
    4137  MUTEX_CONTROL_SIZE
    4238);
    43 
    44 typedef struct {
    45   Mutex_Control Mutex;
    46   unsigned int nest_level;
    47 } Mutex_recursive_Control;
    4839
    4940RTEMS_STATIC_ASSERT(
  • testsuites/psxtests/psx05/init.c

    r5222488 rde59c065  
    240240}
    241241
     242static void test_mutex_pshared_init(void)
     243{
     244  pthread_mutex_t mutex;
     245  pthread_mutexattr_t attr;
     246  int eno;
     247
     248  eno = pthread_mutexattr_init(&attr);
     249  rtems_test_assert(eno == 0);
     250
     251  eno = pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_PRIVATE);
     252  rtems_test_assert(eno == 0);
     253
     254  eno = pthread_mutex_init(&mutex, &attr);
     255  rtems_test_assert(eno == 0);
     256
     257  eno = pthread_mutex_destroy(&mutex);
     258  rtems_test_assert(eno == 0);
     259
     260  eno = pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED);
     261  rtems_test_assert(eno == 0);
     262
     263  eno = pthread_mutex_init(&mutex, &attr);
     264  rtems_test_assert(eno == 0);
     265
     266  eno = pthread_mutex_destroy(&mutex);
     267  rtems_test_assert(eno == 0);
     268
     269  attr.process_shared = -1;
     270
     271  eno = pthread_mutex_init(&mutex, &attr);
     272  rtems_test_assert(eno == EINVAL);
     273
     274  eno = pthread_mutexattr_destroy(&attr);
     275  rtems_test_assert(eno == 0);
     276}
     277
     278static void test_mutex_null( void )
     279{
     280  struct timespec to;
     281  int eno;
     282
     283  eno = pthread_mutex_destroy( NULL );
     284  rtems_test_assert( eno == EINVAL );
     285
     286  eno = pthread_mutex_init( NULL, NULL );
     287  rtems_test_assert( eno == EINVAL );
     288
     289  eno = pthread_mutex_lock( NULL );
     290  rtems_test_assert( eno == EINVAL );
     291
     292  to.tv_sec = 1;
     293  to.tv_nsec = 1;
     294  eno = pthread_mutex_timedlock( NULL, &to );
     295  rtems_test_assert( eno == EINVAL );
     296
     297  eno = pthread_mutex_trylock( NULL );
     298  rtems_test_assert( eno == EINVAL );
     299
     300  eno = pthread_mutex_unlock( NULL );
     301  rtems_test_assert( eno == EINVAL );
     302}
     303
     304static void test_mutex_not_initialized( void )
     305{
     306  pthread_mutex_t mutex;
     307  struct timespec to;
     308  int eno;
     309
     310  memset( &mutex, 0xff, sizeof( mutex ) );
     311
     312  eno = pthread_mutex_destroy( &mutex );
     313  rtems_test_assert( eno == EINVAL );
     314
     315  eno = pthread_mutex_lock( &mutex );
     316  rtems_test_assert( eno == EINVAL );
     317
     318  to.tv_sec = 1;
     319  to.tv_nsec = 1;
     320  eno = pthread_mutex_timedlock( &mutex, &to );
     321  rtems_test_assert( eno == EINVAL );
     322
     323  eno = pthread_mutex_trylock( &mutex );
     324  rtems_test_assert( eno == EINVAL );
     325
     326  eno = pthread_mutex_unlock( &mutex );
     327  rtems_test_assert( eno == EINVAL );
     328}
     329
     330static void test_mutex_invalid_copy( void )
     331{
     332  pthread_mutex_t mutex;
     333  pthread_mutex_t mutex2;
     334  struct timespec to;
     335  int eno;
     336
     337  eno = pthread_mutex_init( &mutex, NULL );
     338  rtems_test_assert( eno == 0 );
     339
     340  memcpy( &mutex2, &mutex, sizeof( mutex2 ) );
     341
     342  eno = pthread_mutex_destroy( &mutex2 );
     343  rtems_test_assert( eno == EINVAL );
     344
     345  eno = pthread_mutex_lock( &mutex2 );
     346  rtems_test_assert( eno == EINVAL );
     347
     348  to.tv_sec = 1;
     349  to.tv_nsec = 1;
     350  eno = pthread_mutex_timedlock( &mutex2, &to );
     351  rtems_test_assert( eno == EINVAL );
     352
     353  eno = pthread_mutex_trylock( &mutex2 );
     354  rtems_test_assert( eno == EINVAL );
     355
     356  eno = pthread_mutex_unlock( &mutex2 );
     357  rtems_test_assert( eno == EINVAL );
     358
     359  eno = pthread_mutex_destroy( &mutex );
     360  rtems_test_assert( eno == 0 );
     361}
     362
     363static void test_mutex_auto_initialization( void )
     364{
     365  struct timespec to;
     366  int eno;
     367
     368  {
     369    pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
     370
     371    eno = pthread_mutex_destroy( &mutex );
     372    rtems_test_assert( eno == 0 );
     373
     374    eno = pthread_mutex_destroy( &mutex );
     375    rtems_test_assert( eno == EINVAL );
     376  }
     377
     378  {
     379    pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
     380
     381    eno = pthread_mutex_lock( &mutex );
     382    rtems_test_assert( eno == 0 );
     383  }
     384
     385  {
     386    pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
     387
     388    to.tv_sec = 1;
     389    to.tv_nsec = 1;
     390    eno = pthread_mutex_timedlock( &mutex, &to );
     391    rtems_test_assert( eno == 0 );
     392  }
     393
     394  {
     395    pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
     396
     397    eno = pthread_mutex_trylock( &mutex );
     398    rtems_test_assert( eno == 0 );
     399  }
     400
     401  {
     402    pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
     403
     404    eno = pthread_mutex_unlock( &mutex );
     405    rtems_test_assert( eno == EPERM );
     406  }
     407}
     408
    242409void *POSIX_Init(
    243410  void *argument
     
    256423  int                  priority;
    257424
    258   rtems_test_assert( MUTEX_BAD_ID != PTHREAD_MUTEX_INITIALIZER );
    259   Mutex_bad_id = MUTEX_BAD_ID;
     425  Mutex_bad_id = NULL;
    260426
    261427  TEST_BEGIN();
    262428
     429  test_mutex_pshared_init();
     430  test_mutex_null();
     431  test_mutex_not_initialized();
     432  test_mutex_invalid_copy();
     433  test_mutex_auto_initialization();
    263434  test_get_priority();
    264435  test_set_priority();
     
    505676
    506677  puts( "Init: pthread_mutex_trylock - EINVAL (illegal ID)" );
    507   status = pthread_mutex_trylock( &Mutex_bad_id );
     678  status = pthread_mutex_trylock( Mutex_bad_id );
    508679  if ( status != EINVAL )
    509680    printf( "status = %d\n", status );
     
    547718
    548719  puts( "Init: pthread_mutex_unlock - EINVAL (invalid id)" );
    549   status = pthread_mutex_unlock( &Mutex_bad_id );
     720  status = pthread_mutex_unlock( Mutex_bad_id );
    550721  if ( status != EINVAL )
    551722    printf( "status = %d\n", status );
     
    594765  rtems_test_assert( !status );
    595766
    596   puts( "Init: pthread_mutex_init - EAGAIN (too many)" );
     767  puts( "Init: pthread_mutex_init - SUCCESSFUL" );
    597768  status = pthread_mutex_init( &Mutex3_id, &attr );
    598   rtems_test_assert( status == EAGAIN );
     769  rtems_test_assert( !status );
    599770
    600771  puts( "Init: pthread_mutexattr_destroy - SUCCESSFUL" );
     
    603774
    604775  puts( "Init: pthread_mutex_destroy - SUCCESSFUL" );
     776  status = pthread_mutex_destroy( &Mutex3_id );
     777  rtems_test_assert( !status );
     778
     779  puts( "Init: pthread_mutex_destroy - SUCCESSFUL" );
    605780  status = pthread_mutex_destroy( &Mutex2_id );
    606781  rtems_test_assert( !status );
    607782
    608783  puts( "Init: pthread_mutex_destroy - EINVAL (invalid id)" );
    609   status = pthread_mutex_destroy( &Mutex_bad_id );
     784  status = pthread_mutex_destroy( Mutex_bad_id );
    610785  rtems_test_assert( status == EINVAL );
    611786
     
    714889
    715890  puts( "Init: pthread_mutex_getprioceiling - EINVAL (invalid id)" );
    716   status = pthread_mutex_getprioceiling( &Mutex_bad_id, &ceiling );
     891  status = pthread_mutex_getprioceiling( Mutex_bad_id, &ceiling );
    717892  rtems_test_assert( status == EINVAL );
    718893
     
    726901
    727902  puts( "Init: pthread_mutex_setprioceiling - EINVAL (invalid id)" );
    728   status = pthread_mutex_setprioceiling( &Mutex_bad_id, 200, &old_ceiling );
     903  status = pthread_mutex_setprioceiling( Mutex_bad_id, 200, &old_ceiling );
    729904  rtems_test_assert( status == EINVAL );
    730905
  • testsuites/psxtests/psx05/psx05.scn

    r5222488 rde59c065  
    44Init: pthread_mutexattr_init - SUCCESSFUL
    55Init: mutex protocol is (0) -- PTHREAD_PRIO_NONE
    6 Init: mutex priority ceiling is 254
     6Init: mutex priority ceiling is 2147483647
    77Init: mutex process shared is (0) -- PTHREAD_PROCESS_PRIVATE
    88Init: pthread_mutexattr_destroy - SUCCESSFUL
     
    6868
    6969Init: pthread_mutex_init - SUCCESSFUL
    70 Init: pthread_mutex_init - EAGAIN (too many)
     70Init: pthread_mutex_init - SUCCESSFUL
    7171Init: pthread_mutexattr_destroy - SUCCESSFUL
     72Init: pthread_mutex_destroy - SUCCESSFUL
    7273Init: pthread_mutex_destroy - SUCCESSFUL
    7374Init: pthread_mutex_destroy - EINVAL (invalid id)
     
    114115Task 3: mutex acquired
    115116Task 3: unlock Mutex 2
    116 Task 3: pthread_getschedparam priority = 199
    117 Task 3: exit
    118117Init: pthread_mutex_getprioceiling- ceiling = 200
    119118Init: pthread_setschedparam - set Init priority to highest
  • testsuites/psxtests/psx05/system.h

    r5222488 rde59c065  
    4040
    4141#define CONFIGURE_MAXIMUM_POSIX_THREADS  4
    42 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES  2
    4342
    4443#define CONFIGURE_POSIX_INIT_THREAD_TABLE
     
    6362TEST_EXTERN pthread_mutex_t  Mutex2_id;
    6463TEST_EXTERN pthread_mutex_t  Mutex3_id;
    65 TEST_EXTERN pthread_mutex_t  Mutex_bad_id;
     64TEST_EXTERN pthread_mutex_t *Mutex_bad_id;
    6665
    6766/* end of include file */
  • testsuites/psxtests/psx09/system.h

    r5222488 rde59c065  
    3737#define CONFIGURE_MAXIMUM_POSIX_THREADS   2
    3838#define CONFIGURE_MAXIMUM_POSIX_KEYS     10
    39 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES  10
    4039
    4140#define CONFIGURE_POSIX_INIT_THREAD_TABLE
  • testsuites/psxtests/psx10/system.h

    r5222488 rde59c065  
    4242
    4343#define CONFIGURE_MAXIMUM_POSIX_THREADS              4
    44 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES              2
    4544
    4645#define CONFIGURE_POSIX_INIT_THREAD_TABLE
  • testsuites/psxtests/psxaio01/system.h

    r5222488 rde59c065  
    2929
    3030#define CONFIGURE_MAXIMUM_POSIX_THREADS        10
    31 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES        10
    3231#define CONFIGURE_MAXIMUM_POSIX_KEYS           10
    3332
  • testsuites/psxtests/psxaio02/system.h

    r5222488 rde59c065  
    2929
    3030#define CONFIGURE_MAXIMUM_POSIX_THREADS        10
    31 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES        10
    3231#define CONFIGURE_MAXIMUM_POSIX_KEYS           10
    3332
  • testsuites/psxtests/psxaio03/system.h

    r5222488 rde59c065  
    3030
    3131#define CONFIGURE_MAXIMUM_POSIX_THREADS        30
    32 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES        30
    3332#define CONFIGURE_MAXIMUM_POSIX_KEYS           30
    3433
  • testsuites/psxtests/psxautoinit01/init.c

    r5222488 rde59c065  
    2626{
    2727  int             sc;
    28   pthread_mutex_t mutex1;
    29   pthread_mutex_t mutex2;
     28  pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER;
     29  pthread_mutex_t mutex2 = PTHREAD_MUTEX_INITIALIZER;
    3030  int             prioceiling;
    3131
     
    3333
    3434  /* path using mutex get with interrupts disabled */
    35   mutex1 = PTHREAD_MUTEX_INITIALIZER;
    36   mutex2 = PTHREAD_MUTEX_INITIALIZER;
    3735  puts( "Init - pthread_mutex_lock - auto initialize - OK" );
    3836  sc = pthread_mutex_lock( &mutex1 );
    3937  fatal_posix_service_status( sc, 0, "mutex lock OK" );
    40 
    41   puts( "Init - pthread_mutex_lock - auto initialize - EINVAL" );
    42   sc = pthread_mutex_lock( &mutex2 );
    43   fatal_posix_service_status( sc, EINVAL, "mutex lock EINVAL" );
    4438
    4539  puts( "Init - pthread_mutex_unlock - OK" );
     
    5246
    5347  /* path using mutex get with dispatching disabled */
    54   mutex1 = PTHREAD_MUTEX_INITIALIZER;
    55   mutex2 = PTHREAD_MUTEX_INITIALIZER;
    5648  puts( "Init - pthread_mutex_getprioceiling - auto initialize - OK" );
    5749  prioceiling = 1;
    58   sc = pthread_mutex_getprioceiling( &mutex1, &prioceiling );
     50  sc = pthread_mutex_getprioceiling( &mutex2, &prioceiling );
    5951  fatal_posix_service_status( sc, 0, "mutex getprioceiling OK" );
    6052  rtems_test_assert( prioceiling == 0 );
    6153
    62   puts( "Init - pthread_mutex_getprioceiling - auto initialize - EINVAL" );
    63   prioceiling = 1;
    64   sc = pthread_mutex_getprioceiling( &mutex2, &prioceiling );
    65   fatal_posix_service_status( sc, EINVAL, "mutex getprioceiling EINVAL" );
    66   rtems_test_assert( prioceiling == 1 );
    67 
    6854  puts( "Init - pthread_mutex_destroy - OK" );
    69   sc = pthread_mutex_destroy( &mutex1 );
     55  sc = pthread_mutex_destroy( &mutex2 );
    7056  fatal_posix_service_status( sc, 0, "mutex destroy OK" );
    7157
     
    8268
    8369#define CONFIGURE_MAXIMUM_POSIX_THREADS 1
    84 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES 1
    8570
    8671#define CONFIGURE_POSIX_INIT_THREAD_TABLE
  • testsuites/psxtests/psxautoinit01/psxautoinit01.scn

    r5222488 rde59c065  
    1 *** POSIX TEST -- AUTOMATIC INITIALIZAITON 01 ***
     1*** BEGIN OF TEST PSXAUTOINIT 1 ***
    22Init - pthread_mutex_lock - auto initialize - OK
    3 Init - pthread_mutex_lock - auto initialize - EINVAL
    43Init - pthread_mutex_unlock - OK
    54Init - pthread_mutex_destroy - OK
    65Init - pthread_mutex_getprioceiling - auto initialize - OK
    7 Init - pthread_mutex_getprioceiling - auto initialize - EINVAL
    86Init - pthread_mutex_destroy - OK
    9 *** END OF POSIX TEST AUTOMATIC INITIALIZATION 01 ***
    10 
     7*** END OF TEST PSXAUTOINIT 1 ***
  • testsuites/psxtests/psxautoinit02/init.c

    r5222488 rde59c065  
    102102
    103103#define CONFIGURE_MAXIMUM_POSIX_THREADS 1
    104 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES 1
    105104
    106105#define CONFIGURE_POSIX_INIT_THREAD_TABLE
  • testsuites/psxtests/psxcleanup/system.h

    r5222488 rde59c065  
    4545#define CONFIGURE_MAXIMUM_POSIX_TIMERS              4
    4646#define CONFIGURE_MAXIMUM_TIMERS                    4
    47 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES             2
    4847
    4948
  • testsuites/psxtests/psxcond01/init.c

    r5222488 rde59c065  
    9696
    9797#define CONFIGURE_MAXIMUM_POSIX_THREADS 2
    98 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES 2
    9998
    10099#define CONFIGURE_POSIX_INIT_THREAD_TABLE
  • testsuites/psxtests/psxconfig01/init.c

    r5222488 rde59c065  
    6262
    6363#define POSIX_MQ_COUNT 5
    64 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES 19
    6564#define CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS 7
    6665#define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES 41
     
    448447#endif
    449448
    450 #ifdef CONFIGURE_MAXIMUM_POSIX_MUTEXES
    451   for (i = 0; i < CONFIGURE_MAXIMUM_POSIX_MUTEXES; ++i) {
    452     pthread_mutex_t mutex;
    453     eno = pthread_mutex_init(&mutex, NULL);
    454     rtems_test_assert(eno == 0);
    455   }
    456   rtems_resource_snapshot_take(&snapshot);
    457   rtems_test_assert(
    458     snapshot.posix_api.active_mutexes == CONFIGURE_MAXIMUM_POSIX_MUTEXES
    459   );
    460 #endif
    461 
    462449#ifdef CONFIGURE_MAXIMUM_POSIX_SEMAPHORES
    463450  for (i = 0; i < CONFIGURE_MAXIMUM_POSIX_SEMAPHORES; ++i) {
  • testsuites/psxtests/psxkey07/init.c

    r5222488 rde59c065  
    197197
    198198#define CONFIGURE_MAXIMUM_TASKS          rtems_resource_unlimited(10)
    199 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES  2
    200199#define CONFIGURE_MAXIMUM_POSIX_KEYS     1
    201200#define CONFIGURE_UNIFIED_WORK_AREAS
  • testsuites/psxtests/psxsignal06/init.c

    r5222488 rde59c065  
    127127
    128128#define CONFIGURE_MAXIMUM_POSIX_THREADS             2
    129 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES             1
    130129
    131130#define CONFIGURE_POSIX_INIT_THREAD_TABLE
  • testsuites/psxtests/psxtimer01/system.h

    r5222488 rde59c065  
    4545#define CONFIGURE_MAXIMUM_POSIX_TIMERS              5
    4646#define CONFIGURE_MAXIMUM_TIMERS                    4
    47 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES             2
    4847
    4948
  • testsuites/psxtmtests/psxtmcond03/init.c

    r5222488 rde59c065  
    107107
    108108#define CONFIGURE_MAXIMUM_POSIX_THREADS     2
    109 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES 2
    110109#define CONFIGURE_POSIX_INIT_THREAD_TABLE
    111110
  • testsuites/psxtmtests/psxtmcond04/init.c

    r5222488 rde59c065  
    100100
    101101#define CONFIGURE_MAXIMUM_POSIX_THREADS     2
    102 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES 2
    103102#define CONFIGURE_POSIX_INIT_THREAD_TABLE
    104103
  • testsuites/psxtmtests/psxtmcond06/init.c

    r5222488 rde59c065  
    124124
    125125#define CONFIGURE_MAXIMUM_POSIX_THREADS  2 + N
    126 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES 2
    127126#define CONFIGURE_POSIX_INIT_THREAD_TABLE
    128127
  • testsuites/psxtmtests/psxtmcond07/init.c

    r5222488 rde59c065  
    120120
    121121#define CONFIGURE_MAXIMUM_POSIX_THREADS  2 + N
    122 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES 1
    123122#define CONFIGURE_POSIX_INIT_THREAD_TABLE
    124123
  • testsuites/psxtmtests/psxtmcond08/init.c

    r5222488 rde59c065  
    171171#define CONFIGURE_MAXIMUM_POSIX_THREADS     OPERATION_COUNT + 2
    172172#define CONFIGURE_POSIX_INIT_THREAD_TABLE
    173 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES 2
    174173
    175174#define CONFIGURE_INIT
  • testsuites/psxtmtests/psxtmmutex01/init.c

    r5222488 rde59c065  
    8484
    8585#define CONFIGURE_MAXIMUM_POSIX_THREADS     1
    86 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES     1
    8786#define CONFIGURE_POSIX_INIT_THREAD_TABLE
    8887
  • testsuites/psxtmtests/psxtmmutex02/init.c

    r5222488 rde59c065  
    125125
    126126#define CONFIGURE_MAXIMUM_POSIX_THREADS     OPERATION_COUNT + 2
    127 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES     1
    128127#define CONFIGURE_POSIX_INIT_THREAD_TABLE
    129128
  • testsuites/psxtmtests/psxtmmutex03/init.c

    r5222488 rde59c065  
    174174
    175175#define CONFIGURE_MAXIMUM_POSIX_THREADS     1
    176 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES     1
    177176#define CONFIGURE_POSIX_INIT_THREAD_TABLE
    178177
  • testsuites/psxtmtests/psxtmmutex04/init.c

    r5222488 rde59c065  
    125125
    126126#define CONFIGURE_MAXIMUM_POSIX_THREADS     OPERATION_COUNT + 2
    127 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES     1
    128127#define CONFIGURE_POSIX_INIT_THREAD_TABLE
    129128
  • testsuites/psxtmtests/psxtmmutex05/init.c

    r5222488 rde59c065  
    9797
    9898#define CONFIGURE_MAXIMUM_POSIX_THREADS     2
    99 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES     1
    10099#define CONFIGURE_POSIX_INIT_THREAD_TABLE
    101100
  • testsuites/psxtmtests/psxtmmutex06/init.c

    r5222488 rde59c065  
    151151
    152152#define CONFIGURE_MAXIMUM_POSIX_THREADS     OPERATION_COUNT + 2
    153 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES     1
    154153#define CONFIGURE_POSIX_INIT_THREAD_TABLE
    155154
  • testsuites/psxtmtests/psxtmmutex07/init.c

    r5222488 rde59c065  
    9898
    9999#define CONFIGURE_MAXIMUM_POSIX_THREADS     1
    100 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES     1
    101100#define CONFIGURE_POSIX_INIT_THREAD_TABLE
    102101
  • testsuites/smptests/smppsxmutex01/init.c

    r5222488 rde59c065  
    158158
    159159#define CONFIGURE_MAXIMUM_POSIX_THREADS 2
    160 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES 2
    161160
    162161#define CONFIGURE_MAXIMUM_PROCESSORS 2
  • testsuites/sptests/spmutex01/init.c

    r5222488 rde59c065  
    714714
    715715#ifdef RTEMS_POSIX_API
    716 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES 1
    717716#endif
    718717
  • testsuites/sptests/spsysinit01/init.c

    r5222488 rde59c065  
    104104  POSIX_THREADS_PRE,
    105105  POSIX_THREADS_POST,
    106   POSIX_MUTEX_PRE,
    107   POSIX_MUTEX_POST,
    108106  POSIX_MESSAGE_QUEUE_PRE,
    109107  POSIX_MESSAGE_QUEUE_POST,
     
    439437}
    440438
    441 FIRST(RTEMS_SYSINIT_POSIX_MUTEX)
    442 {
    443   assert(_POSIX_Mutex_Information.maximum == 0);
    444   next_step(POSIX_MUTEX_PRE);
    445 }
    446 
    447 LAST(RTEMS_SYSINIT_POSIX_MUTEX)
    448 {
    449   assert(_POSIX_Mutex_Information.maximum != 0);
    450   next_step(POSIX_MUTEX_POST);
    451 }
    452 
    453439FIRST(RTEMS_SYSINIT_POSIX_MESSAGE_QUEUE)
    454440{
     
    717703#define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES 1
    718704
    719 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES 1
    720705
    721706#define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES 1
  • testsuites/sptests/spthreadq01/init.c

    r5222488 rde59c065  
    4141  rtems_id br;
    4242#if defined(RTEMS_POSIX_API)
    43   pthread_mutex_t pmtx;
    44   pthread_cond_t pcv;
    4543  mqd_t pmq;
    4644#endif
     
    118116  int eno;
    119117  char buf[1];
    120 
    121   eno = pthread_mutex_lock(&ctx->pmtx);
    122   rtems_test_assert(eno == 0);
    123 
    124   wake_up_master(ctx);
    125   rtems_test_assert(get_wait_id(ctx) == ctx->pmtx);
    126 
    127   eno = pthread_mutex_unlock(&ctx->pmtx);
    128   rtems_test_assert(eno == 0);
    129 
    130   eno = pthread_mutex_lock(&ctx->pmtx);
    131   rtems_test_assert(eno == 0);
    132 
    133   eno = pthread_cond_signal(&ctx->pcv);
    134   rtems_test_assert(eno == 0);
    135 
    136   eno = pthread_mutex_unlock(&ctx->pmtx);
    137   rtems_test_assert(eno == 0);
    138118
    139119  wake_up_master(ctx);
     
    201181  int eno;
    202182  struct mq_attr attr;
    203 
    204   eno = pthread_mutex_init(&ctx->pmtx, NULL);
    205   rtems_test_assert(eno == 0);
    206 
    207   eno = pthread_cond_init(&ctx->pcv, NULL);
    208   rtems_test_assert(eno == 0);
    209183
    210184  memset(&attr, 0, sizeof(attr));
     
    288262  wait_for_worker(ctx);
    289263
    290   eno = pthread_mutex_lock(&ctx->pmtx);
    291   rtems_test_assert(eno == 0);
    292 
    293   eno = pthread_cond_wait(&ctx->pcv, &ctx->pmtx);
    294   rtems_test_assert(eno == 0);
    295 
    296   eno = pthread_mutex_unlock(&ctx->pmtx);
    297   rtems_test_assert(eno == 0);
    298 
    299   wait_for_worker(ctx);
    300 
    301264  buf[0] = 'y';
    302265  prio = 1;
     
    341304
    342305#if defined(RTEMS_POSIX_API)
    343   #define CONFIGURE_MAXIMUM_POSIX_MUTEXES 1
    344306  #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES 1
    345307  #define CONFIGURE_MESSAGE_BUFFER_MEMORY \
Note: See TracChangeset for help on using the changeset viewer.