This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: candidate sched.h and sys/sched.h for review


On Mar 30 05:32, Ralf Corsepius wrote:
> On 03/29/2010 08:12 PM, Joel Sherrill wrote:
> >Hi,
> >
> >Attached is a first attempt at adding sched_XXX
> >prototypes to sched.h, updating sched_param to
> >use the right field names for sporadic scheduler,
> >and to have RTEMS and Cygwin SCHED_XXX constants
> >unperturbed.
> >
> >I have compiled one target with this but that doesn't
> >mean it is close to right.  How does it look?
> 
> Comments interspersed.
> 
> > [...]
> >#include <sys/features.h>
> >#include <sys/time.h>
> Why sys/time.h?
> 
> SUSV/IEEE Std 1003.1-2008 says:
> 
> <cite>
> The <sched.h> header shall define the timespec structure as
> described in <time.h>.
> </cite>
> 
> I don't see that this file uses any types/defines from <sys/time.h>,
> but "timespec", which is mandated to specified in <time.h>

POSIX-1.2008 also says:

  Symbols from <time.h> may be made visible when <sched.h> is included.

Sched.h should either include <sys/types.h> and <time.h>, or, to
minimize the definitions, it could just include <sys/types.h> since
that's where timespec is defined in newlib anyway.

> >#include <sys/sched.h>
> Please move these includes above the "#ifdef __cplusplus".

I agree with Ralf.

> >#if defined(_POSIX_PRIORITY_SCHEDULING)
> >/*
> >  *  13.3.1 Set Scheduling Parameters, P1003.1b-1993, p. 252

This is just a formal thingy, but shouldn't new references to the
standard better refer to the latest standard, which would be IEEE
Std 1003.1-2008 at the present time?

> >#ifndef __POSIX_SYS_SCHEDULING_h
> >#define __POSIX_SYS_SCHEDULING_h
> 
> I would use "_SYS_SCHED_H_".

I agree.

> >struct sched_param {
> >   int sched_priority;           /* Process execution scheduling priority */
> >
> >#if defined(_POSIX_SPORADIC_SERVER) || defined(_POSIX_THREAD_SPORADIC_SERVER)
> >   int sched_ss_low_priority;    /* Low scheduling priority for sporadic */
> >                                 /*   server */
> >   struct timespec sched_ss_replenish_period;
> >                                 /* Replenishment period for sporadic server */

Per POSIX-1.2008 that should be sched_ss_repl_period.

Otherwise the file looks ok to me.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]