Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is Mac OS X POSIX-incompliant? (timer_settime)

Tags:

unix

posix

macos

I've written a program in C++ that uses the timer_settime function under Ubuntu, and then asked my friend to try to compile it under Mac OS X. The man page of timer_settime says that this function conforms to POSIX.1-2001, but under OS X (which is claimed to conform POSIX) the g++ gives compilation errors. The web search has shown that this function is absent from OS X API.

Does that mean that OS X does not conform completely to POSIX, or do I misunderstand what does the POSIX-compliance mean?

EDIT: I've looked through the POSIX draft and found this function on page 2063 in the alphabetical list of system interfaces just next to the standard C functions such as printf, thus it does not seem to me that timer_settime is some sort of extension of the standard.

like image 911
Oleg Andriyanov Avatar asked Dec 14 '14 20:12

Oleg Andriyanov


1 Answers

It turns out that the advanced timer functions like timer_settime were indeed a part of POSIX real-time extension as Ken Thomases has suggested. Citing the change history of the documentation for this function:

Issue 6

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

Issue 7

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

The latest POSIX standard, POSIX.1-2008, issue 7, was released quite recently, in 2013. My friend's computer runs OS X 10.9 which was released also in the late 2013, thus I suppose it does not conform to the latest standard. However, the wikipedia says that the latest OS X v10.10 "Yosemite", that was released in late 2014, is fully POSIX-compliant.

After all, however, I still don't understand how one is supposed to write portable code when certain functions are silently marked as 'extensions' by standard and the man pages do not mention this significant fact.

like image 94
Oleg Andriyanov Avatar answered Sep 22 '22 01:09

Oleg Andriyanov