DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
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:


/usr/include/sso/pathMap.h
Include this file in the source.

/usr/lib/libsso.a
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;


SSO_ALLOC_ID_OBJECT
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.

SSO_GetSegmentRootPath
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:


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

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

SSO_NO_ABORT
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.

SSO_GetAbsolutePath
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:


EINVAL
Patch area in the ssoIdObject is not valid.

ERANGE
Specified options flag is illegal.

ENOMEM
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