posix: Check for new <pthread.h> prototypes

Update #3342.
Update #3343.
This commit is contained in:
Sebastian Huber
2018-07-03 11:50:53 +02:00
parent e07b51a710
commit 77fbbd620f
5 changed files with 40 additions and 9 deletions

View File

@@ -115,6 +115,29 @@ RTEMS_CHECK_FUNC([pthread_getattr_np],[
#define _GNU_SOURCE
#include <pthread.h>])
AC_LANG_PUSH(C)
AC_MSG_CHECKING([for pthread_mutex_getprioceiling(const pthread_mutex_t *, ...)])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include <pthread.h>
int pthread_mutex_getprioceiling(const pthread_mutex_t *__restrict, int *);
])],[
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_PTHREAD_MUTEX_GETCEILING_CONST, [], [pthread_mutex_getprioceiling(const pthread_mutex_t *, ...)])
],[
AC_MSG_RESULT([no])
])
AC_MSG_CHECKING([for pthread_setschedparam(..., const struct sched_param *)])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include <pthread.h>
int pthread_setschedparam(pthread_t, int, const struct sched_param *);
])],[
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_PTHREAD_SETSCHEDPARAM_CONST, [], [pthread_setschedparam(..., const struct sched_param *)])
],[
AC_MSG_RESULT([no])
])
AC_LANG_POP(C)
# Mandated by POSIX, not declared in some versions of newlib.
AC_CHECK_DECLS([getrusage],,,[#include sys/resource.h])

View File

@@ -97,7 +97,7 @@ int _POSIX_Thread_Translate_to_sched_policy(
*/
int _POSIX_Thread_Translate_sched_param(
int policy,
struct sched_param *param,
const struct sched_param *param,
Thread_CPU_budget_algorithms *budget_algorithm,
Thread_CPU_budget_algorithm_callout *budget_callout
);

View File

@@ -26,7 +26,11 @@
*/
int pthread_mutex_getprioceiling(
#ifdef HAVE_PTHREAD_MUTEX_GETCEILING_CONST
const pthread_mutex_t *mutex,
#else
pthread_mutex_t *mutex,
#endif
int *prioceiling
)
{
@@ -38,7 +42,7 @@ int pthread_mutex_getprioceiling(
return EINVAL;
}
the_mutex = _POSIX_Mutex_Get( mutex );
the_mutex = _POSIX_Mutex_Get( RTEMS_DECONST( pthread_mutex_t *, mutex ) );
POSIX_MUTEX_VALIDATE_OBJECT( the_mutex, flags );
_POSIX_Mutex_Acquire( the_mutex, &queue_context );

View File

@@ -42,7 +42,7 @@ int _POSIX_Thread_Translate_to_sched_policy(
int _POSIX_Thread_Translate_sched_param(
int policy,
struct sched_param *param,
const struct sched_param *param,
Thread_CPU_budget_algorithms *budget_algorithm,
Thread_CPU_budget_algorithm_callout *budget_callout
)

View File

@@ -33,7 +33,7 @@
static int _POSIX_Set_sched_param(
Thread_Control *the_thread,
int policy,
struct sched_param *param,
const struct sched_param *param,
Thread_CPU_budget_algorithms budget_algorithm,
Thread_CPU_budget_algorithm_callout budget_callout,
Thread_queue_Context *queue_context
@@ -115,7 +115,11 @@ static int _POSIX_Set_sched_param(
int pthread_setschedparam(
pthread_t thread,
int policy,
#ifdef HAVE_PTHREAD_SETSCHEDPARAM_CONST
const struct sched_param *param
#else
struct sched_param *param
#endif
)
{
Thread_CPU_budget_algorithms budget_algorithm;