Is Mac OS X POSIX inconsistent? (Timer_settime)

I wrote a C ++ program that uses the timer_settime function under Ubuntu, and then asked my friend to try to compile it under Mac OS X. The timer_settime manual timer_settime says that this function corresponds to POSIX.1-2001, but under OS X (which is said to be POSIX compliant) g ++ gives compilation errors. A web search showed that this feature is not available in the OS X API.

Does this mean that OS X does not fully comply with POSIX, or am I misunderstanding what POSIX compliance means?

EDIT: I looked at the POSIX project and found this function on page 2063 in the alphabetical list of system interfaces next to standard C functions like printf , so it doesn't seem to me that timer_settime is a kind of extension of the standard.

+5
source share
1 answer

It turned out that extended timer functions, such as timer_settime , were indeed part of the real-time POSIX extension, as Ken Thomases suggested. Referring to the documentation change history for this function:

Problem 6

The timer_getoverrun (), timer_gettime (), and timer_settime () functions are marked as part of the Timers parameter.

Problem 7

The functions timer_getoverrun (), timer_gettime () and timer_settime () are moved from the Timers option to the base.

The latest POSIX standard, POSIX.1-2008, Release 7, was released most recently, in 2013. My computer is running OS X 10.9, which was also released at the end of 2013, so I believe that it does not meet the latest standard. However, wikipedia says the latest version of OS X v10.10 “Yosemite,” released at the end of 2014, is fully compatible with POSIX.

In the end, however, I still don’t understand how to write portable code when certain functions are silently marked as “extensions” by standard, and man pages do not mention this significant fact.

+4
source

Source: https://habr.com/ru/post/1209025/


All Articles