AoLoadConfig()
Load a configuration from a file and add its interfaces to the global list
Synopsis:
#include <aoi.h>
int32_t AoLoadConfig(const char *config_name,
AOLoadedConfig_t **cfg);
Arguments:
- config_name
- The name of the configuration to load, or NULL to load the default configuration. Refer to the function description for details about how this name maps to a pathname in the filesystem.
- cfg
- A pointer to a location containing the address of an
AOLoadedConfig_t structure.
The application provides this argument to
AoUnloadConfig() to unload the configuration.
The function writes the metadata about the configuration,
including the DLLs and the hold counts, into the new structure.
Note:If your application is loading only one configuration and doesn't need to unload it by calling AoUnloadConfig(), then this argument can be NULL.
Library:
libaoi.soDescription:
This function loads the configuration indicated by config_name. The configuration names the DLLs containing the interfaces that the application requires. The function adds these interfaces to the global list, and saves information necessary for AoUnloadConfig() to later unload them at the location that cfg points to (if it's non-NULL).
In the config_name argument, you can either name the configuration to load or provide a NULL pointer and use the default configuration.
When config_name points to a string that does not start with a slash, AOLoadConfig() interprets it as a request to use the named configuration if it exists, or the default configuration otherwise. The function adds a directory path and a slash in front of the provided name, as well as appends it with the ".conf" extension, thus making it a full path. For information about how the library chooses the configuration directory, refer to the aoiconftool entry in the Utilities Reference.
If an attempt to open this path fails with ENOENT (i.e. there is no matching file in the configuration directory), AOLoadConfig() then proceeds to open the default file.
If the full path points to a file that exists but can't be opened for another reason (such as EPERM), AOLoadConfig() fails without attempting to open the default file.
When config_name starts with a slash (/
), the AoLoadConfig() function interprets it as a full path.
If the file can't be opened, AOLoadConfig() fails without looking for a default file.
This method lets an application try to load an explicitly named file and avoid implicitly loading the default file.
Returns:
- 0
- Success.
- A positive error number
- Failed to open the config file. Refer to errno.
- -1
- Opened the file successfully, but failed when processing it.
Classification:
QNX Neutrino
