Open Sound System
OSS 4.x Programmer's Guide

Do you have problems with sound/audio application development? Don't panic! Click here for help!


Return information about OSS and the devices


oss_sysinfo si;
ioctl(fd, OSS_SYSINFO, &si);

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 call was earlier called as OSS_SYSINFO. Some older programs may still use the old name. However new applications should use SNDCTL_SYSINFO instead.

This ioctl calls can be used to obtain information about the OSS version installed in the system as well as to get the number of various devices available in the system. This information is mostly static but certain fields may change while OSS is being loaded.

This ioctl call is supported by all OSS devices, including audio, mixer and MIDI devices.

The oss_sysinfo structure

The oss_sysinfo structure has the following fields.

productA string containing the name of the OSS implementation. For example "OSS/Linux".
versionA string that returns the current OSS version number. For example "4.0.0a". This is the version of the OSS implementation that is currently running.
licenseLicense of the current OSS version (for example "GPL" or "CDDL"). Empty string means commercial license.
versionnumThe API version number in numeric format. For example 0x040000 means version 4.0.0. However this version is the version of the soundcard.h file used to compile the OSS software. It's usually not the same than the version field.
optionsReserved for future use.
numaudiosThe number of audio device files currently configured in the system.
numaudioenginessThe number of audio engines currently configured in the system.
openedaudioA bit mask which tells the audio devices that are currently busy (OBSOLETE).
numsynthsNumber of synth devices. Obsolete.
nummidisNumber of MIDI port devices available in the system.
numtimersNumber of (MIDI) timer devices in the system.
nummixersNumber of mixer devices available in the system.
numcardsNumber of sound cards detected in the system. See SNDCTL_CARDINFO for more info.
openedmidiA bit mask that tells which MIDI devices are currently busy.

Related ioctl calls

The SNDCTL_CARDINFO, SNDCTL_AUDIOINFO, SNDCTL_MIDIINFO and SNDCTL_MIXERINFO calls can be used to obtain information about the audio, MIDI and mixer devices in the system.

OSS ioctl return values

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.

Sample programs

osstest.cThe osstest program shipped with OSS
ossinfo.cThe ossinfo program that is included in the OSS package.
ossxmix.cThis is the ossxmix (GTK++ GUI) program shipped with OSS
mixer_applet.cA sample program for developing a simple mixer applet.

Copyright (C) 4Front Technologies, 2007. All rights reserved.
Back to index OSS web site