cygwin/newlib types patchs
Joel Sherrill
joel.sherrill@OARcorp.com
Wed Mar 28 10:06:00 GMT 2001
Joel Sherrill wrote:
>
> Just to make sure I understand .. What you intend to do for
> structure is effectively this:
>
> #ifdef __RTEMS_INSIDE__
> typedef struct {
> int is_initialized;
> void *stackaddr;
> int stacksize;
> int contentionscope;
> int inheritsched;
> int schedpolicy;
> struct sched_param schedparam;
>
> /* P1003.4b/D8, p. 54 adds cputime_clock_allowed attribute. */
> #if defined(_POSIX_THREAD_CPUTIME)
> int cputime_clock_allowed; /* see time.h */
> #endif
> int detachstate;
>
> } pthread_attr_t;
> #else /* in user land */
> typedef void * pthread_attr_t;
> #endif
>
> If this is not the case, then I need to be educated further to make
> an intelligent decision. :)
>
> --joel
Something just bothered me... from opengroup.org
#include <pthread.h>
int pthread_attr_init(pthread_attr_t *attr);
int pthread_attr_destroy(pthread_attr_t *attr);
Shouldn't I be able to write this code?
{
pthread_attr_t my_attr;
pthread_attr_init( &my_attr );
}
The RTEMS implementation assumes that the user is providing the memory
for the structure. If you change the user view so pthread_attr_t is
a void *, we break.
On types like pthread_t, RTEMS is really a unsigned 32 bit integer
and we again assume that the user is providing that space.
Not letting the user know the size is broken for us. I agree that it is
certainly
bad form for them to look inside.
--joel
More information about the Cygwin-patches
mailing list