Defect Report concerning: IEEE Std. 1003.1-1996, ISO/IEC 9945-1:1996 - C API
Clause: 13.1, 13.3.3.1
PASC Interpretation Ref: pasc-1003.1-87
Topic: struct sched_param and sched_setscheduler


This is an unapproved interpretation of PASC 1003.1-1996, ISO/IEC 9945-1:1996 - C API.

Use of the information contained in this unapproved document is at your own risk.

Last update: 10 April,2001


								1003.1-96  #87

 _____________________________________________________________________________

	Interpretation Number:	XXXX
	Topic:			struct sched_param and sched_setscheduler
	Relevant Sections:	13.1, 13.3.3.1


PASC Interpretation Request: (Defect Report)
----------------------------  

	Date: Tue Apr 14 14:12:00 BST 1998

------------------------------------------------------------------------ 

 7  Defect Report concerning (number and title of International Standard
    or DIS final text, if applicable): 

IEEE Std 1003.1-1996 (incorporates 1003.1-1990, 1003.1b-1993, 1003.1c-1995, 1003.1i-1995) (ISO 9945-1:1996)

------------------------------------------------------------------------ 

 8  Qualifier (e.g. error, omission, clarification required):

3

Error=1 , Omission=2, Clarification=3

------------------------------------------------------------------------ 

 9  References in document (e.g. page, clause, figure, and/or table
    numbers):

p 293, clause 13.3.3.1 sched_setscheduler, page 287 clause 13.1

------------------------------------------------------------------------ 

10  Nature of defect (complete, concise explanation of the perceived
    problem):


IEEE Std 1003.1-1996 contains a structure , struct sched_param
with one defined member sched_priority.

Consider the following code extract:

#define _POSIX_C_SOURCE 199506L

void mycode()
{
struct sched_param param1;
int j;
j = MINPRIO;   /* MINPRIO is a valid priority */

/* Also assume below that pid and policy are valid below */

param1.sched_priority = j;
if (sched_setscheduler(pid, policy, &param1) == -1)  {
        /* branch 1 */
}
else
   /* branch 2 */
}

Q1. Is an implementation conforming, that  returns -1 on a call
to sched_setscheduler() (branch 1) due to the fact that it 
has implementation defined members of the struct sched_param 
that are not initialized?

Section 13.1 has a section of text that states:

"Implementations may add extensions as permitted by 1.3.1.1, 
item(2). Adding extensions to this structure, which may change
the behavior of the application with respect to this standard
when those fields are uninitialized, also requires that the
extension be enabled as required by 1.3.1.1"

Q2. Is this a requirement on the application  or the implementation?

Q3. Is it possible to write a strictly conforming POSIX.1 application
using the sched_param structure?




------------------------------------------------------------------------ 

11  Solution proposed by the submitter (optional):

Q1. Yes since a conforming implementation may have extended
the sched_param structure

Q2. The application writer is required to consult the system
documentation and may have to add extra initialization code
for the sched_param structure.


Q3. Its not possible to write a strictly conforming POSIX.1
application that uses the sched_param structure.


------------------------------------------------------------------------ 

Interpretation:

Q1: The standard is clear that this is not conforming.  
    From 1.3.1.1, page 3 of 1003.1b-1993:

   The conformance document shall define an environment in
   which an application can be run with the behavior specified
   by the standard.  In no case shall such an environment
   require modification of a Strictly Conforming POSIX.1
   Application.

Q2: This is a requirement on the implementation.

Q3: Yes.  The implementation must not allow semantics related
to implementation-specific members of struct sched_param to
affect the behavior of a Strictly Conforming POSIX.1 Application.

Rationale:

The standard way to provide a choice between a strictly
conforming execution environment and one with extensions is
to have the implementation ignore the extensions unless an
implementation-defined feature test macro is #defined when
the program is compiled.

An implementation that returns -1 unless implementation-
added structure members are initialized and that documents
this as an error condition as specified in subclause 2.4
(page 28, lines 675-684 of POSIX.1b-1993) is not in
conformance with the Standard.  Such an implementation is
also broken with respect to 1.3.1.1, as quoted in the
Interpretation above, and broken with respect to the
application developer's reasonable expectations.

Forwarded to Interpretations group: 14 Apr 1998
Proposed Interpretation: 17 Jul 1998
Finalised: February 17 1999