Open Sound System
|Do you have problems with sound/audio application development? Don't panic! Click here for help!|
ioctl(fd, OSS_GETVERSION, &ver);
The above code fragment lacks all error checks for clarity. Real world applications must always check for the errors and handle them as described below. Also most OSS ioctl calls will return information in the argument variable and it's usually necessary to check it too.
This ioctl call returns the version number OSS API used in the current system. Applications can use this information to find out if the OSS version is new enough to support the features required by the application. However this methods should be used with great care. Usually it's recommended that applications check availability of each ioctl() by calling it and by checking if the call returned errno=EINVAL.
The version number is encoded so that 0x010203 means version 1.2 of the API and 3rd revision of it.
Systems supporting the OSS 4.0 API will return 0x040002 or above. Versions 0x0399xx, 0x040000 and 0x040001 support most features of the final OSS 4.0 API. Versions 0x0309xx and earlier are based on the older OSS3 API.
Version number of 0x040003 is used by OSS-4.0 build1008 that contains some enhancements to the original v4.0 API.
The return value from the OSS ioctl calls will be -1 if a fatal error occurred. Other values mean that the ioctl call was more or less successful. However in most cases the application must check the value returned in the argument to see what was the accepted value.
Please see the Possible error codes (errno) returned by OSS calls section for more info about the error codes returned by OSS.