Document revision date: 15 July 2002 | |
Previous | Contents | Index |
By default, the header files enable APIs in the Compaq C RTL provided by the version of the operating system on which the compilation occurs. This is accomplished by the predefined setting of the __VMS_VER macro, as described in the Compaq C User's Guide for OpenVMS Systems. For example, compiling on OpenVMS Version 6.2 causes only Compaq C RTL APIs from Version 6.2 and earlier to be made available.
Another example of the use of the __VMS_VER macro is support for the 64-bit versions of Compaq C RTL functions available with OpenVMS Alpha Version 7.0 and higher. In all header files, functions that provide 64-bit support are conditionalized so that they are visible only if __VMS_VER indicates a version of OpenVMS that is greater than or equal to 7.0.
To target an older version of the operating system, do the following:
Targeting a newer version of the operating system might not always be possible. For some versions, you can expect that the new DECC$SHR.EXE will require new features of the operating system that are not present. For such versions, the defining if the logical DECC$SHR in Step 1 would cause the compilation to fail.
To override the value of
__VMS_VER
, define
__VMS_VER_OVERRIDE
on the compiler command line. Defining
__VMS_VER_OVERRIDE
without a value sets
__VMS_VER
to the maximum value.
1.5.5 Compatibility Modes
The following predefined macros are used to select header-file compatibility with previous versions of DEC C) or the OpenVMS operating system:
There are two types of incompatibilities that can be controlled in the header files:
The following examples help clarify the use of these macros:
dev_t off_t gid_t pid_t ino_t size_t mode_t ssize_t nlink_t uid_t |
The following feature-test macros are used to control the Curses and Socket subsets of the Compaq C RTL library:
Strict XPG4 V2 compliance requires the 4.4BSD-compatible socket interface. Therefore, if _XOPEN_SOURCE_EXTENDED is defined on OpenVMS Version 7.0 or higher, _SOCKADDR_LEN is defined to be 1.
The following examples help clarify the use of these macros:
The C RTL provides support for compiling applications to use file sizes and offsets that are two gigabytes and larger. This is accomplished by allowing file offsets of 64-bit integers.
The fseeko and ftello functions, which have the same behavior as fseek and ftell , accept or return values of type off_t , which allows for a 64-bit variant of off_t to be used.
C RTL functions lseek , mmap , ftuncate , truncate , stat , fstat , and ftw can also accommodate a 64-bit file offset.
The new 64-bit interfaces can be selected at compile time by defining
the
_LARGEFILE
feature macro.
1.5.8 32-bit UID and GID Macros
The C RTL supports 32-bit User Identification (UID) and Group Identification (GID). When an application is compiled to use 32-bit UID/GID, the UID and GID are derived from the UIC as in previous versions of the operating system. Use the following macros to control UID/GID size:
The C RTL provides an extensive list of feature switches that can be enabled or disabled using DECC$ logical names. These switches affect the behavior of a C application at run time.
The feature switches introduce new behaviors and also preserve old behaviors that have been deprecated.
You enable most features by setting a logical name to ENABLE and disable a feature by setting the logical name to DISABLE:
$ DEFINE DECC$feature ENABLE $ DEFINE DECC$feature DISABLE |
Some features logical names can be set to a numeric value. For example:
$ DEFINE DECC$PIPE_BUFFER_SIZE 65536 |
Older features from earlier releases of the C Run-Time Library were documented as supplying any equivalence string to enable the features. While this is correct, Compaq recommends that you use "ENABLE" for all features enabled using logical names. This avoids possible side effects if the feature switch is enhanced to allow both enabling and disabling with the logical name defined. In particular, avoid the following values for any feature previously documented as accepting any equivalence string:
|
Table 1-5 lists the C RTL feature logical names, grouped by the type of features they control.
Feature Logical Name | Default |
---|---|
Performance Optimizations | |
DECC$ENABLE_GETENV_CACHE | DISABLE |
DECC$LOCALE_CACHE_SIZE | 0 |
DECC$TZ_CACHE_SIZE | 2 |
Legacy Behaviors | |
DECC$V62_RECORD_GENERATION | DISABLE |
DECC$XPG4_STRPTIME | DISABLE |
DECC$THREAD_DATA_AST_SAFE | DISABLE |
File Attributes | |
DECC$DEFAULT_LRL | 32767 |
DECC$DEFAULT_UDF_RECORD | DISABLE |
DECC$FIXED_LENGTH_SEEK_TO_EOF | DISABLE |
Mailboxes | |
DECC$MAILBOX_CTX_STM | DISABLE |
Changes for UNIX Conformance | |
DECC$STRTOL_ERANGE | DISABLE |
DECC$VALIDATE_SIGNAL_IN_KILL | DISABLE |
DECC$SELECT_IGNORES_INVALID_FD | DISABLE |
General UNIX Enhancements | |
DECC$ARGV_PARSE_STYLE | DISABLE |
DECC$PIPE_BUFFER_SIZE | 512 |
DECC$STDIO_CTX_EOL | DISABLE |
DECC$USE_RAB64 | DISABLE |
Enhancements for UNIX Style File Names | |
DECC$DISABLE_TO_VMS_LOGNAME_TRANSLATION | DISABLE |
DECC$EFS_CHARSET | DISABLE |
DECC$FILENAME_UNIX_NO_VERSION | DISABLE |
DECC$FILENAME_UNIX_REPORT | DISABLE |
DECC$READDIR_DROPDOTNOTYPE | DISABLE |
DECC$RENAME_NO_INHERIT | DISABLE |
Enhancements for UNIX Style File Attributes | |
DECC$EFS_FILE_TIMESTAMPS | DISABLE |
DECC$EXEC_FILEATTR_INHERITANCE | DISABLE |
DECC$FILE_OWNER_UNIX | DISABLE |
DECC$FILE_PERMISSION_UNIX | DISABLE |
DECC$FILE_SHARING | DISABLE |
UNIX Compliance Mode | |
DECC$FILENAME_UNIX_ONLY | DISABLE |
DECC$DETACHED_CHILD_PROCESS | DISABLE |
New Behaviors for POSIX Conformance | |
DECC$POSIX_SEEK_STREAM_FILE | DISABLE |
DECC$UMASK | RMS default |
File Name Handling | |
DECC$READDIR_KEEPDOTDIR | DISABLE |
DECC$EFS_CASE_PRESERVE | DISABLE |
DECC$EFS_CASE_SPECIAL | DISABLE |
DECC$UNIX_PATH_BEFORE_LOGNAME | DISABLE |
DECC$DISABLE_POSIX_ROOT | DISABLE |
An alphabetic listing and description of the C RTL feature logical names follows. Unless otherwise stated, the feature logicals are enabled with ENABLE and disabled with DISABLE.
DECC$ARGV_PARSE_STYLE
With DECC$ARGV_PARSE_STYLE enabled, case is preserved in command line arguments when the process has been set up for extended DCL parsing using SET PROCESS/PARSE_STYLE=EXTENDED.DECC$ARGV_PARSE_STYLE must be defined externally as a logical name or set in a function called using the LIB$INITIALIZE mechanism because it is evaluated before function main is called.
DECC$DEFAULT_LRL
DECC$DEFAULT_LRL specifies the default value for the RMS attribute for longest record length. The default value 32767 is the largest record size supported by RMS.Default: 32767
Maximum: 32767
DECC$DEFAULT_UDF_RECORD
With DECC$DEFAULT_UDF_RECORD enabled, file access mode defaults to RECORD instead of STREAM mode for all files except STREAMLF.DECC$DETACHED_CHILD_PROCESS
With DECC$DETACHED_CHILD_PROCESS enabled, child processes created using vfork and exec are created as detached processes instead of subprocesses.This feature has only limited support. In some cases the console cannot be shared between the parent process and the detached process, which can cause exec to fail.
DECC$DISABLE_POSIX_ROOT
With DECC$DISABLE_POSIX_ROOT enabled, support for the POSIX root directory defined by SYS$POSIX_ROOT is disabled.With DECC$DISABLE_POSIX_ROOT disabled, the SYS$POSIX_ROOT logical name is interpreted as the equivalent of the file path "/". If a UNIX path starting with "/" is given and the value after the leading slash cannot be translated as a logical name, SYS$POSIX_ROOT is used as the parent directory for the specified UNIX file path.
More Detail:
The C RTL supports a UNIX style root that behaves like a real directory. This allows such actions as:
% cd / % mkdir /dirname % tar -xvf tarfile.tar /dirname % ls /Previously, the C RTL did not recognize "/" as a directory name. The normal processing for a file path starting with "/" was to interpret the first element as a logical name or device name. If this failed, there was special processing for the name /dev/null and names starting with /bin and /tmp :
/dev/null NLA0: /bin SYS$SYSTEM: /tmp SYS$SCRATCH:These behaviors are retained for compatibility purposes. In addition, support has been added to the C RTL for the logical name SYS$POSIX_ROOT as an equivalent to "/".
To enable this feature for use by the C RTL, define SYS$POSIX_ROOT as a concealed logical name. For example:
$ DEFINE/TRANSLATION=(CONCEALED,TERMINAL) SYS$POSIX_ROOT "$1$DKA0:[SYS0.abc.]"To disable this feature:
$ DEFINE DECC$DISABLE_POSIX_ROOT {1, ENABLE 0, DISABLE}Enabling SYS$POSIX_ROOT results in the following behavior:
- If the existing translation of a UNIX path starting with "/" fails and SYS$POSIX_ROOT is defined, the name is interpreted as if it starts with /sys$posix_root .
- When converting from an OpenVMS to a UNIX style file name, and the OpenVMS name starts with "SYS$POSIX_ROOT:", then the "SYS$POSIX_ROOT:" is removed. For example, SYS$POSIX_ROOT:[dirname] becomes /dirname . If the resulting name could be interpreted as a logical name or one of the special cases previously listed, the result is /./dirname instead of /dirname .
DECC$DISABLE_TO_VMS_LOGNAME_TRANSLATION
With DECC$DISABLE_TO_VMS_LOGNAME_TRANSLATION enabled, the conversion routine decc$to_vms will only treat the first element of a UNIX style name as a logical name if there is a leading slash "/".DECC$EFS_CASE_PRESERVE
With DECC$EFS_CASE_PRESERVE enabled, case is preserved for file names on ODS level 5 disks.With DECC$EFS_CASE_PRESERVE disabled, UNIX style file names are always reported in lowercase.
However, note that enabling DECC$EFS_CASE_SPECIAL overrides the setting for DECC$EFS_CASE_PRESERVE.
DECC$EFS_CASE_SPECIAL
With DECC$EFS_CASE_SPECIAL enabled, case is preserved only for file names containing lowercase. If an element of a file name contains all uppercase letters, it is reported in all lowercase in UNIX style.When enabled, DECC$EFS_CASE_SPECIAL overrides the value of DECC$EFS_CASE_PRESERVE.
DECC$EFS_CHARSET
With DECC$EFS_CHARSET enabled, UNIX names can contain ODS-5 extended characters. Support includes multiple dots and all ASCII characters in the range 0 to 255, except the following:<NUL>
/
"
*
?Unless DECC$FILENAME_UNIX_ONLY is enabled, some characters can be interpreted as OpenVMS characters depending on context. They are:
:
[
<
^
;DECC$EFS_CHARSET might be necessary for existing applications that make assumptions about file names based on the presence of certain characters, because the following non-standard and undocumented C RTL extensions do not work when EFS extended character-set support is enabled:
- $HOME is interpreted as the user's login directory
With DECC$EFS_CHARSET enabled, $HOME is treated literally and may be in an OpenVMS or UNIX style file name.- ~name is interpreted as the login directory for user name
With DECC$EFS_CHARSET enabled, ~name is treated literally and can be in an OpenVMS or UNIX style file name.- Wild card regular expressions in the form [a-z]
With DECC$EFS_CHARSET enabled, square brackets are acceptable in OpenVMS and UNIX style file names. For instance, in a function such as open , abc[a-z]ef.txt is interpreted as a UNIX style name equivalent to the OpenVMS style name abc^[a-z^]ef.txt , and [a-z]bc is interpreted as an OpenVMS style name equivalent to the UNIX style name /sys$disk/a-z/bc .With DECC$EFS_CHARSET enabled, the following encoding for EFS extended characters is supported when converting from an OpenVMS style file name to a UNIX style file name:
- All ODS-2 compatible names
- All encoding for 8-bit characters, either as single byte or using two-digit hexadecimal form ^ab . In a UNIX path these are always represented as a single byte.
- Encoding for DEL (^7F)
- The following characters when preceded by a caret:
space ! , _ & ' ( ) + @ { } ; # [ ] % ^ = $ - ~ .- The following characters when not preceded by a caret:
$ - ~ .- The implementation supports the conversion from OpenVMS to UNIX needed for functions readdir , ftw , getname , fgetname , getcwd , and others.
DECC$EFS_FILE_TIMESTAMPS
With DECC$EFS_FILE_TIMESTAMPS enabled, stat and fstat report new ODS-5 access time ( st_atime ), attribute revision time ( st_ctime ) and modification time ( st_mtime ) for files on ODS-5 volumes that have the extended file times enabled using SET VOLUME/VOLUME=ACCESS_DATES.If DECC$EFS_FILE_TIMESTAMPS is disabled, or the volume is not ODS-5, or the volume does not have support for these additional times enabled, st_ctime continues to be the file creation time and st_atime the same as the st_mtime .
Functions utime and utimes support these ODS-5 times in the same way as stat .
DECC$ENABLE_GETENV_CACHE
The C RTL supplements the list of environment variables in the environ table with all logical names and DCL symbols available to the process.By default, whenever getenv is called for a name not in the environ table, an attempt is made to resolve this as a logical name and, if this fails, as a DCL symbol.
With DECC$ENABLE_GETENV_CACHE enabled, once a logical name or DCL name has been successfully translated, its value is stored in a cache. When the same name is requested in a future call to getenv , the value is returned from the cache instead of reevaluating the logical name or DCL symbol.
DECC$EXEC_FILEATTR_INHERITANCE
With DECC$EXEC_FILEATTR_INHERITANCE enabled, the current file pointer and the file open mode is passed to the child process in exec calls if the child is a C program.With this logical name disabled, the child process does not inherit append mode or the file position.
DECC$FILENAME_UNIX_ONLY
With DECC$FILENAME_UNIX_ONLY enabled, file names are never interpreted as OpenVMS style names. This prevents any interpretation of the following as OpenVMS special characters:
Previous Next Contents Index
privacy and legal statement 5763PRO_004.HTML