...but still no luck...this seems to violate the POSIX standard,
because unistd.h does define _POSIX_PRIORITY_SCHEDULING, whereas
"POSIX systems on which sched_setscheduler and sched_getscheduler
are available define _POSIX_PRIORITY_SCHEDULING in <unistd.h>."
The code you're trying to compile is not technically portable; the
value (-1) means "unsupported" according to the current POSIX
standards document. You will tend to have problems porting it to
other POSIX or POSIX-like platforms, not just MacOS X.
This is an increasingly common mistake that pops up now due to a
change between POSIX 1003.1-2001 and POSIX 1003.1-2003, which
requires that these values be defined in all cases, but have
particular values based on whether or not the option is supported (-1
means "unsupported"; 0 also means "unsupported", and is included
because if the value is not #defined at all, and you do math with it,
the ISO c99 standard requires a preprocess treat the value as if it
were zero; 200112L means "supported").
That means that the feature test in C programs has to change from:
#if (_POSIX_PRIORITY_SCHEDULING - 0) >= 200112L
Which is what it really should have been all along. Technically, it
could also be:
But if you used that variant, your code would not be future-proof
against newer versions of the standard bumping the constant from
200112L to something larger (obviously, they could also change the
semantics if they did that, but you at least have a fighting chance
of your code still working without additional changes).
"If a symbolic constant is defined with the value -1, the
not supported. Headers, data types, and function interfaces
only for the option need not be supplied. An application that
to use anything associated only with the option is considered
requiring an extension."
[ ... ]
"_POSIX_PRIORITY_SCHEDULING The implementation supports the
Scheduling option. If this symbol is defined in <unistd.h>,
be defined to be -1, 0, or 200112L. The value of this symbol
by sysconf() shall either be -1 or 200112L."
Hope that clears things up for you!
Do not post admin requests to the list. They will be ignored.
Unix-porting mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden