From 5d8a8c2b664e36006eea5698709b98849b0ad129 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Wed, 1 Sep 2010 23:36:14 +0200 Subject: Prevent pthread.h from exposing assert() * sysdeps/generic/bits/cancelation.h: Do not include (__pthread_cleanup_pop): Do not call `assert'. --- sysdeps/generic/bits/cancelation.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/sysdeps/generic/bits/cancelation.h b/sysdeps/generic/bits/cancelation.h index db9169a9..46486f5e 100644 --- a/sysdeps/generic/bits/cancelation.h +++ b/sysdeps/generic/bits/cancelation.h @@ -20,8 +20,6 @@ #ifndef _BITS_CANCELATION_H #define _BITS_CANCELATION_H 1 -#include - struct __pthread_cancelation_handler { void (*handler)(void *); @@ -47,7 +45,6 @@ struct __pthread_cancelation_handler **__pthread_get_cleanup_stack (void); #define __pthread_cleanup_pop(execute) \ if (execute) \ __handler.handler (__handler.arg); \ - assert (*__handlers == &__handler); \ *__handlers = __handler.next; \ } -- cgit v1.2.3 From 59ce2f2ebf8eb60b34fec056d8e6ccc9ad5ef6f8 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Thu, 2 Sep 2010 03:59:40 +0200 Subject: Use __sched_param instead of sched_param to avoid exposing inclusion of and exposure of sched_param from * sysdeps/generic/bits/thread-attr.h: Define __need_schedparam and include instead of including (__pthread_attr): Use `__sched_param' instead of `sched_param'. --- sysdeps/generic/bits/thread-attr.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sysdeps/generic/bits/thread-attr.h b/sysdeps/generic/bits/thread-attr.h index c3a93fde..f2e55f2b 100644 --- a/sysdeps/generic/bits/thread-attr.h +++ b/sysdeps/generic/bits/thread-attr.h @@ -20,7 +20,8 @@ #ifndef _BITS_THREAD_ATTR_H #define _BITS_THREAD_ATTR_H 1 -#include +#define __need_schedparam +#include enum __pthread_detachstate; enum __pthread_inheritsched; @@ -30,7 +31,7 @@ enum __pthread_contentionscope; that not all of them are supported on all systems. */ struct __pthread_attr { - struct sched_param schedparam; + struct __sched_param schedparam; void *stackaddr; size_t stacksize; size_t guardsize; -- cgit v1.2.3 From ba5c9d57be1a4e8167747dfdf4d94c2e03b9e24d Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Fri, 3 Sep 2010 00:20:42 +0200 Subject: Fix __sched_param / sched_param conversion * sysdeps/generic/pt-attr-getschedparam.c (pthread_attr_getschedparam): memcpy from `attr->schedparam' to `param' to convert from __sched_param to sched_param. * sysdeps/generic/pt-attr-setschedparam.c (pthread_attr_setschedparam): memcpy from `param' to `attr->schedparam' to convert from sched_param to __sched_param. --- sysdeps/generic/pt-attr-getschedparam.c | 2 +- sysdeps/generic/pt-attr-setschedparam.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sysdeps/generic/pt-attr-getschedparam.c b/sysdeps/generic/pt-attr-getschedparam.c index 25afebd0..6c3f15be 100644 --- a/sysdeps/generic/pt-attr-getschedparam.c +++ b/sysdeps/generic/pt-attr-getschedparam.c @@ -26,6 +26,6 @@ int pthread_attr_getschedparam (const pthread_attr_t *attr, struct sched_param *param) { - *param = attr->schedparam; + memcpy (param, &attr->schedparam, sizeof *param); return 0; } diff --git a/sysdeps/generic/pt-attr-setschedparam.c b/sysdeps/generic/pt-attr-setschedparam.c index 18a575ec..5459f108 100644 --- a/sysdeps/generic/pt-attr-setschedparam.c +++ b/sysdeps/generic/pt-attr-setschedparam.c @@ -30,7 +30,7 @@ pthread_attr_setschedparam (pthread_attr_t *attr, if (memcmp (param, &__pthread_default_attr.schedparam, sizeof *param) == 0) { - attr->schedparam = *param; + memcpy (&attr->schedparam, param, sizeof *param); return 0; } -- cgit v1.2.3