Email List: Xaustin-review-lX
[All Lists]

Defect in XBD <sys/types.h>

To: yyyyyyyyyyyyyyy@xxxxxxxxxxxxx
Subject: Defect in XBD <sys/types.h>
From: yyyyyyy@xxxxxxxxxx
Date: Wed, 26 Mar 2003 09:28:24 GMT
        Defect report from : Ulrich Drepper , Red Hat, Inc.

(Please direct followup comments direct to yyyyyyyyyyyyyy@xxxxxxxxxxxxx)

@ page 367 line 12967 section <sys/types.h> objection {ud-timer-3}

Problem:

Defect code :  3. Clarification required

I've cited one place but the problem actually stretches across several
more.

The situation: the <sys/types.h> man page defines that timer_t shall
be an arithmetic type.  So clearly uintptr_t is allowed.


The timer_create() man page specifies that if the /evp/ parameter is
NULL the function behaves as if the timer ID is stored in the
sigev_value element, which is of type union sigval.


The <signal.h> man page (XBD 301) specifies that union sigval has
exactly the members:

int sival_int
void *sival_ptr


Now, what happens if timer_t == uintptr_t?  A uintptr_t value will
usually not fit in an 'int' and 64-bit platforms.  How will user code
checking the sigval value?  This point is left unclear in the
timer_create() specification.  Intentionally?  Should it then be made
clear that the implementation has to document the use?


The background is that I want to have an implementation where the
timer_t values are basically pointers.  To satisfy the current
requirements about the timer_t type I'll have to use type uintptr_t or 
something equivalent.  The value would fir in the sigval object but
would have to be accessed via sival_ptr.


From my perspective the requirement for timer_t to be an arithmetic
type makes no sense.  Where would such a requirement be used?  If no
requirement like that would be made timer_t could be void* and the
implementation could document that sival_ptr has to be used.


Otherwise, and *much* more restricting, the timer_t specification
would have to say that timer_t must be an arithmetic type with
sizeof(timer_t) <= sizeof(int).

Action:

Two solutions, pick one.  As said, I favor #1 since #2 is severely
limiting the possible implementation.

1. Remove requirement on type timer_t

XBD 367, add after line 12988

timer_t

(marked with TMR)

XSH 1514, line 46750.  Add new sentence at end:

Whether the sival_int or sival_ptr element of the sigev_value member is
used is implementation defined.


2. Restrict timer_t type

XBD 367, after line 13001 add:

* timer_t shall is an integer type with size not larger than /int/.


XSH 1514, line 46749, replace with

the /sigev_signo/ having a default signal number, and the
/sigev_value.sival_int/ member having the value of


(I chose this notation because "member .. of member ..." sounds
awkward).

<Prev in Thread] Current Thread [Next in Thread>