sched.h question

Corinna Vinschen
Mon Mar 29 18:13:00 GMT 2010

On Mar 28 11:01, Joel Sherrill wrote:
> On 03/28/2010 10:29 AM, Corinna Vinschen wrote:
> >On Mar 27 16:31, Joel Sherrill wrote:
> >>Hi,
> >>
> >>I noticed that when you build RTEMS + newlib, there
> >>are two sched.h files and a sys/sched.h
> >>
> >>+ newlib sched.h - very minimal, includes<sys/sched.h>
> >>+ newlib sys/sched.h - very minimal, defines struct sched_param
> >>+ RTEMS sched.h - prototypes sched_XXX methods.
> >>
> >>Would it be OK to submit a patch to add the prototype of
> >>the following to newlib/libc/include/sched.h:
> >>
> >>+ sched_setparam
> >>+ sched_getparam
> >>+ sched_setscheduler
> >>+ sched_getscheduler
> >>+ sched_get_priority_min
> >   + sched_get_priority_max
> >
> >>+ sched_rr_get_interval
> >>+ sched_yield
> >>
> >>Asking since modifying files in libc/include impacts
> >>everything.
> >IMHO, that's fine.
> >
> >Can we please create sched.h and sys/sched.h which can be shared with
> >Cygwin as well?  Right now Cygwin uses its own sched.h, but the only
> >actual difference are the values of the three defines SCHED_OTHER (3),
> >SCHED_FIFO (1), and SCHED_RR (2).  We have to stick to these values for
> >backward compatibility, but it's no precedent to have different defines
> >in a file for different platforms, so that should be ok.
> >
> >
> That's great with me!! I would really prefer that RTEMS and
> Cygwin share as many .h files as is reasonable. It increases
> the probability that we both are compatible and doing the
> right thing.  It is also less target specific code for each of
> us to maintain. When I tell uses about the C library we use, I
> always say it is the one used by Cygwin.  :)
> I have no preference on the values of SCHED_XXX.  I will
> submit my patch Monday since I think the machine in
> the RTEMS Build Farm I was working on crashed. :(
> Is there anything else that should be in this .h file? I was

If you're really going to change the aforementioned SCHED_xxx values,
SCHED_SPORADIC needs to change its value as well.  Cygwin doesn't define
_POSIX_SPORADIC_SERVER so that conditional code has to be kept in.  The
sched_param members which are only available with _POSIX_SPORADIC_SERVER
have the wrong name and one member is missing (see POSIX-1.2008).

Other than that, Cygwin has two private functions defined in sched.h,
but these can be defined elsewhere within Cygwin.

That's all as far as I can see.


Corinna Vinschen
Cygwin Project Co-Leader
Red Hat

More information about the Newlib mailing list