Custom Distribution Mastering Toolkit

C and C++ programs API

The CDMT includes two files that enable you to use the SSO Path Mapping API with C and C++ programs:

Include this file in the source.

Link this file in when you compile the source.

For example:

cc options -lsso

   #include <sso/pathMap.h>

SSO_ALLOC_ID_OBJECT(uniqueName, "vendorCode", "componentCode", "version");

const char * SSO_GetSegmentRootPath(options, ssoIdObject); unsigned options; ssoIdObject_t *ssoIdObject;

char * SSO_GetAbsolutePath(options, ssoIdObject, relPath); unsigned options; ssoIdObject_t *ssoIdObject; const char *relPath;

This macro creates a ``patch area'' in the binary; the software management utilities can change this area dynamically. The macro creates the variable ssoIdObject_t uniqueName, initialized to the values vendorCode, componentCode, and version. These arguments are literal names; the macro will convert them to C strings. You can override the values later using the ssoPatch(CDMT) utility.

This function returns the pathname of the root directory of the SSO (SSOroot). This is determined by analyzing the patch area ssoIdObject, which should be created by a previous call to SSO_ALLOC_ID_OBJECT. The string returned by SSO_GetSegmentRootPath is static memory and should not be deallocated using free(S).

The options argument is a bit flag constructed from one or more of:

the function returns the path to the shared read-only SSO prototype (the /opt portion of the SSO).

the function returns the path to the client-specific read-write SSO location (the /var/opt portion of the SSO).

if the function is unable to return the requested information, it returns NULL instead of aborting. If SSO_NO_ABORT is not specified, the function aborts the execution.

This function returns the absolute pathname of the SSO internal file named by relPath. relPath specifies the pathname of an internal SSO file, relative to the root of the SSO.

The options and ssoIdObject arguments are the same as with SSO_ALLOC_ID_OBJECT.

The memory returned by the function SSO_GetAbsolutePath is dynamically allocated and should be deallocated with a call to free when it is no longer needed.

If you set the SSO_NO_ABORT flag, the SSO_GetAbsolutePath and SSO_GetSegmentRootPath functions can return the following values:

Patch area in the ssoIdObject is not valid.

Specified options flag is illegal.

Insufficient memory is available.

In cases where a static library from one component is intended to be linked with programs from another component, it is not possible for the static library to use the Path Mapping API. The actual text of the static library is located in the SSO of the executable, not the SSO of the library, so custom does not patch the library if the path to the SSO of the library changes.

Next topic: Tcl scripts API
Previous topic: Using the SSO Path Mapping API

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003