hp.com home products and services support and drivers solutions how to buy
cd-rom home
End of Jump to page title
HP OpenVMS systems
documentation

Jump to content


HP C

HP C
Run-Time Library Reference Manual for OpenVMS Systems


Previous Contents Index

1.4.4 Extended File Specifications

The ODS-5 volume structure provides enhanced support for mixed UNIX and OpenVMS style file names. It supports long file names, allows the use of a wider range of characters within file names, and preserves case within file names. With OpenVMS Alpha Version 7.3-1, the C RTL has greatly improved support of ODS-5 characters, with 250 of the 256 characters supported, as opposed to only 214 supported previously. Also, file names without file types can now be accessed.

To enable the new support, you must define one or more C RTL feature logical names. These names include the following:

DECC$EFS_CHARSET
DECC$DISABLE_TO_VMS_LOGNAME_TRANSLATION
DECC$FILENAME_UNIX_NO_VERSION
DECC$FILENAME_UNIX_REPORT
DECC$READDIR_DROPDOTNOTYPE
DECC$RENAME_NO_INHERIT

See Section 1.6 for more information on these and other feature logical names.

1.5 Feature-Test Macros for Header-File Control

Feature-test macros provide a means for writing portable programs. They ensure that the HP C RTL symbolic names used by a program do not clash with the symbolic names supplied by the implementation.

The HP C RTL header files are coded to support the use of a number of feature-test macros. When an application defines a feature-test macro, the HP C RTL header files supply the symbols and prototypes defined by that feature-test macro and nothing else. If a program does not define such a macro, the HP C RTL header files define symbols without restriction.

The feature-test macros supported by the HP C RTL fall into three broad categories for controlling the visibility of symbols in header files according to the following:

1.5.1 Standards Macros

The HP C RTL implements parts of the following standards:

1.5.2 Selecting a Standard

You can define a feature-test macro to select each standard. You can do this either with a #define preprocessor directive in your C source before the inclusion of any header file, or with the /DEFINE qualifier on the CC command line.

Table 1-4 lists and describes the HP C RTL feature-test macros that control standards support.

Table 1-4 Feature Test Macros - Standards
Macro Name Standard Selected Other Standards Implied Description
_XOPEN_SOURCE_EXTENDED XPG4 V2 XPG4, ISO POSIX-2, ISO POSIX-1, ANSI C Makes visible XPG4-extended features, including traditional UNIX based interfaces not previously adopted by X/Open.
_XOPEN_SOURCE XPG4 ISO POSIX-2, ISO POSIX-1, ANSI C Makes visible XPG4 standard symbols and causes _POSIX_C_SOURCE to be set to 2 if it is not already defined with a value greater than 2. 1 2
_POSIX_C_SOURCE==199506 IEEE 1003.1c-1995 ISO POSIX-2, ISO POSIX-1, ANSI C Header files defined by ANSI C make visible those symbols required by IEEE 1003.1c-1995.
_POSIX_C_SOURCE==2 ISO POSIX-2 ISO POSIX-1, ANSI C Header files defined by ANSI C make visible those symbols required by ISO POSIX-2 plus those required by ISO POSIX-1.
_POSIX_C_SOURCE==1 ISO POSIX-1 ANSI C Header files defined by ANSI C make visible those symbols required by ISO POSIX-1.
__STDC_VERSION__==199409 ISO C amdt 1 ANSI C Makes ISO C Amendment 1 symbols visible.
_ANSI_C_SOURCE ANSI C --- Makes ANSI C standard symbols visible.


1Where the ISO C Amendment 1 includes symbols not specified by XPG4, defining __STDC_VERSION__ == 199409 and _XOPEN_SOURCE (or _XOPEN_SOURCE_EXTENDED) selects both ISO C and XPG4 APIs. Conflicts that arise when compiling with both XPG4 and ISO C Amendment 1 resolve in favor of ISO C Amendment 1.
2Where XPG4 extends the ISO C Amendment 1, defining _XOPEN_SOURCE or _XOPEN_SOURCE_EXTENDED selects ISO C APIs as well as the XPG4 extensions available in the header file. This mode of compilation makes XPG4 extensions visible.

Features not defined by one of the previously named standards are considered HP C extensions and are selected by not defining any standards-related, feature-test macros.

If you do not explicitly define feature test macros to control header file definitions, you implicitly include all defined symbols as well as HP C extensions.

1.5.3 Interactions with the /STANDARD Qualifier

The /STANDARD qualifier selects the dialect of the C language supported.

With the exception of /STANDARD=ANSI89 and /STANDARD=ISOC94, the selection of C dialect and the selection of HP C RTL APIs to use are independent choices. All other values for /STANDARD cause the entire set of APIs to be available, including extensions.

Specifying /STANDARD=ANSI89 restricts the default API set to the ANSI C set. In this case, to select a broader set of APIs, you must also specify the appropriate feature-test macro. To select the ANSI C dialect and all APIs, including extensions, undefine __HIDE_FORBIDDEN_NAMES before including any header file.

Compiling with /STANDARD=ISOC94 sets __STDC_VERSION__ to 199409. Conflicts that arise when compiling with both XPG4 and ISO C Amendment 1 resolve in favor of ISO C Amendment 1. XPG4 extensions to ISO C Amendment 1 are selected by defining _XOPEN_SOURCE.

The following examples help clarify these rules:

1.5.4 Multiple-Version-Support Macro

By default, the header files enable APIs in the HP 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 HP C User's Guide for OpenVMS Systems. For example, compiling on OpenVMS Version 6.2 causes only HP 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 HP 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:

  1. Define a logical DECC$SHR to point to the old version of DECC$SHR. The compiler uses a table from DECC$SHR to perform routine name prefixing.
  2. Define __VMS_VER appropriately, either with the /DEFINE qualifier or with a combination of the #undef and #define preprocessor directives. With /DEFINE, you may need to disable the warning regarding redefinition of a predefined macro.

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:

1.5.6 Curses and Socket Compatibility Macros

The following feature-test macros are used to control the Curses and Socket subsets of the HP 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:

1.5.7 2-Gigabyte File Size Macro

The C RTL provides support for compiling applications to use file sizes and offsets that are two gigabytes (GB) 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 (ALPHA, I64)

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.

To compile an application for 16-bit UID/GID support on systems that by default use 32-bit UIDs/GIDs, define the _DECC_SHORT_GID_T macro to 1.

1.5.9 Standard-Compliant stat Structure (ALPHA, I64)

The C RTL supports an X/Open standard-compliant definition of the stat structure and associated definitions. To use these new definitions, applications must compile with the _USE_STD_STAT feature-test macro defined.

When compiled with _USE_STD_STAT, the stat structure includes these changes:

1.6 Enabling C RTL Features Using Feature Logical Names

The C RTL provides an extensive list of feature switches that can be set 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 feature logical names can be set to a numeric value. For example:


$ DEFINE DECC$PIPE_BUFFER_SIZE 32768 

Notes

  • Do not set C RTL feature logical names for the system. Set them only for the applications that need them, because other applications including OpenVMS components depend on the default behavior of these logical names.
  • Older feature logicals from earlier releases of the C Run-Time Library were documented as supplying "any equivalence string" to enable a feature. While this was true at one time, we now strongly recommend that you use ENABLE for setting these feature logicals and DISABLE for disabling them. Failure to do so may produce unexpected results.

    The reason for this is twofold:
    • In previous versions of the C RTL, any equivalence string, even DISABLE, may have enabled a feature logical.
    • In subsequent and current versions of the C RTL, the following equivalence strings will disable a feature logical. Do not use them to enable a feature logical.
      DISABLE
      0 (zero)
      F
      FALSE
      N
      NO


      Any other string not on this list will enable a feature logical. The unintentionally misspelled string "DSABLE", for example, will enable a feature logical.

Table 1-5 lists the C RTL feature logical names, grouped by the type of features they control.

Table 1-5 C RTL Feature Logical Names
Feature Logical Name Default
Performance Optimizations
DECC$ENABLE_GETENV_CACHE DISABLE
DECC$LOCALE_CACHE_SIZE 0
DECC$TZ_CACHE_SIZE 2
Legacy Behaviors
DECC$ALLOW_UNPRIVILEGED_NICE DISABLE
DECC$NO_ROOTED_SEARCH_LISTS DISABLE
DECC$THREAD_DATA_AST_SAFE DISABLE
DECC$V62_RECORD_GENERATION DISABLE
DECC$WRITE_SHORT_RECORDS DISABLE
DECC$XPG4_STRPTIME DISABLE
File Attributes
DECC$DEFAULT_LRL 32767
DECC$DEFAULT_UDF_RECORD DISABLE
DECC$FIXED_LENGTH_SEEK_TO_EOF DISABLE
DECC$ACL_ACCESS_CHECK DISABLE
Mailboxes
DECC$MAILBOX_CTX_STM DISABLE
Changes for UNIX Conformance
DECC$SELECT_IGNORES_INVALID_FD DISABLE
DECC$STRTOL_ERANGE DISABLE
DECC$VALIDATE_SIGNAL_IN_KILL DISABLE
General UNIX Enhancements
DECC$UNIX_LEVEL DISABLE
DECC$ARGV_PARSE_STYLE DISABLE
DECC$PIPE_BUFFER_SIZE 512
DECC$PIPE_BUFFER_QUOTA 512
DECC$STREAM_PIPE DISABLE
DECC$POPEN_NO_CRLF_REC_ATTR DISABLE
DECC$STDIO_CTX_EOL DISABLE
DECC$USE_RAB64 DISABLE
DECC$GLOB_UNIX_STYLE DISABLE
Enhancements for UNIX Style File Names
DECC$DISABLE_TO_VMS_LOGNAME_TRANSLATION DISABLE
DECC$EFS_CHARSET DISABLE
DECC$ENABLE_TO_VMS_LOGNAME_CACHE ENABLE
DECC$FILENAME_UNIX_NO_VERSION DISABLE
DECC$FILENAME_UNIX_REPORT DISABLE
DECC$READDIR_DROPDOTNOTYPE DISABLE
DECC$RENAME_NO_INHERIT DISABLE
DECC$RENAME_ALLOW_DIR 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$DETACHED_CHILD_PROCESS DISABLE
DECC$FILENAME_UNIX_ONLY DISABLE
DECC$POSIX_STYLE_UID DISABLE
DECC$USE_JPI$_CREATOR DISABLE
New Behaviors for POSIX Conformance
DECC$ALLOW_REMOVE_OPEN_FILES DISABLE
DECC$POSIX_SEEK_STREAM_FILE DISABLE
DECC$UMASK RMS default
File-Name Handling
DECC$DISABLE_POSIX_ROOT ENABLE
DECC$EFS_CASE_PRESERVE DISABLE
DECC$EFS_CASE_SPECIAL DISABLE
DECC$EFS_NO_DOTS_IN_DIRNAME DISABLE
DECC$READDIR_KEEPDOTDIR DISABLE
DECC$UNIX_PATH_BEFORE_LOGNAME DISABLE


Previous Next Contents Index