Document revision date: 15 July 2002
[Compaq] [Go to the documentation home page] [How to order documentation] [Help on this site] [How to contact us]
[OpenVMS documentation]

Compaq C
Run-Time Library Reference Manual for OpenVMS Systems


Previous Contents Index


:   [   ^ 

DECC$FILENAME_UNIX_NO_VERSION

With DECC$FILENAME_UNIX_NO_VERSION enabled, OpenVMS version numbers are not supported in UNIX style file names.

With DECC$FILENAME_UNIX_NO_VERSION disabled, in UNIX style names, version numbers are reported preceded by a dot (.).

DECC$FILENAME_UNIX_REPORT

With DECC$FILENAME_UNIX_REPORT enabled, all file names are reported in UNIX style unless the caller specifically selects OpenVMS style. This applies to getpwnam , getpwuid , argv[0] , getname , and fgetname .

With DECC$FILENAME_UNIX_REPORT disabled, unless specified in the function call, file names are reported in OpenVMS style.

DECC$FILE_OWNER_UNIX

With DECC$FILE_OWNER_UNIX enabled, the owner for a new file or directory is always based on the effective UIC. When an earlier version of the file exists, the owner for the new file is inherited from the earlier version.

With DECC$FILE_OWNER_UNIX disabled, the owner for a new file is set following OpenVMS rules and may inherit the owner from the parent directory.

DECC$FILE_PERMISSION_UNIX

With DECC$FILE_PERMISSION_UNIX enabled, the file permissions for new files and directories are set according to the file creation mode and umask . This includes mode 0777. When an earlier version of the file exists, the file permissions for the new file are inherited from the earlier version. This mode sets DELETE permission for a new directory when WRITE permission is enabled.

With DECC$FILE_PERMISSION_UNIX disabled, modes 0 and 0777 indicate using RMS default protection or protection from the previous version of the file. Permissions for new directories also follow OpenVMS rules, including disabling DELETE permissions.

DECC$FILE_SHARING

With DECC$FILE_SHARING enabled, all files are opened with full sharing enabled (FAB$M_DEL | FAB$M_GET | FAB$M_PUT | FAB$M_UPD). This is set as a logical OR with any sharing mode specified by the caller.

DECC$FIXED_LENGTH_SEEK_TO_EOF

With DECC$FIXED_LENGTH_SEEK_TO_EOF enabled, lseek , fseeko , and fseek with the direction paremeter set to SEEK_END will position relative to the last byte in the file for files with fixed-length records.

With DECC$FIXED_LENGTH_SEEK_TO_EOF disabled, lseek , fseek , and fseeko when called with SEEK_EOF on files with fixed-length records, will position relative to the end of the last record in the file.

DECC$LOCALE_CACHE_SIZE

DECC$LOCALE_CACHE_SIZE defines how much memory, in bytes, to allocate for caching locale data. The default value is 0, which disables the locale cache.

Default: 0

Maximum: 2147483647

DECC$MAILBOX_CTX_STM

By default, an open on a local mailbox that is not a pipe treats mailbox records as having a record attribute of FAB$M_CR.

With DECC$MAILBOX_CTX_STM enabled, the record attribute FAB$M_CR is not set.

DECC$PIPE_BUFFER_SIZE

The system default buffer size of 512 bytes for pipe write operations can limit performance and generate extra line feeds when handling messages longer than 512 bytes.

DECC$PIPE_BUFFER_SIZE allows a larger default buffer size to be used for pipe functions such as pipe and popen . A value of 512 to 65024 bytes can be specified.

If DECC$PIPE_BUFFER_SIZE is not specified, the default buffer size 512 is used.

Default: 512

Minimum: 512

Maximum: 65536

DECC$POSIX_SEEK_STREAM_FILE

With DECC$POSIX_SEEK_STREAM_FILE enabled, positioning beyond end-of-file on STREAM files does not write to the file until the next write. If the write is beyond the current end-of-file, this positions beyond the old end-of-file, and the start position for the write is filled with zeros.

With DECC$POSIX_SEEK_STREAM_FILE disabled, positioning beyond end-of-file will immediately write zeros to the file from the current end-of-file to the new position.

DECC$READDIR_DROPDOTNOTYPE

With DECC$READDIR_DROPDOTNOTYPE enabled, readdir when reporting files in UNIX style only reports the trailing dot for files with no file type when the file name contains a dot.

With this logical name disabled, all files without a file type are reported with a trailing dot.

DECC$READDIR_KEEPDOTDIR

The default behavior when reporting files in UNIX style from readdir is to report directories without a file type.

With DECC$READDIR_KEEPDOTDIR enabled, directories are reported in UNIX style with a file type of ".DIR".

DECC$RENAME_NO_INHERIT

With DECC$RENAME_NO_INHERIT enabled, the new name for the file does not inherit anything from the old name. The new name must be specified completely.

With DECC$RENAME_NO_INHERIT disabled, the new file name inherits missing components of the file name such as the device, directory, file type, and version from the old file, in the same way as the DCL RENAME command.

DECC$SELECT_IGNORES_INVALID_FD

With DECC$SELECT_IGNORES_INVALID_FD enabled, select fails with errno set to EBADF when an invalid file descriptor is specified in one of the descriptor sets.

With DECC$SELECT_IGNORES_INVALID_FD disabled, select ignores invalid file descriptors.

DECC$STDIO_CTX_EOL

With DECC$STDIO_CTX_EOL enabled, writing to stdout and stderr for stream access is deferred until a terminator is seen or the buffer is full.

With DECC$STDIO_CTX_EOL disabled, each fwrite generates a separate write, which for mailbox and record files generates a separate record.

DECC$STRTOL_ERANGE

With DECC$STRTOL_ERANGE enabled, the strtol behavior for an ERANGE error is corrected to consume all remaining digits in the string.

With DECC$STRTOL_ERANGE disabled, the legacy behavior of leaving the pointer at the failing digit is preserved.

DECC$THREAD_DATA_AST_SAFE

The C RTL has a mode that allocates storage for thread-specific data allocated by threads at non-AST level separate for data allocated for ASTs. In this mode, each access to thread-specific data requires a call to LIB$AST_IN_PROG, which can add significant overhead when accessing thread-specific data in the C RTL.

The alternate mode protects thread-specific data only if another function has it locked. This protects data that is in use within the C RTL, but does not protect the caller from an AST changing the data pointed to.

This latter mode is now the C RTL default for the strtok , ecvt , and fcvt functions.

You can select the legacy AST safe mode by enabling DECC$THREAD_DATA_AST_SAFE.

DECC$TZ_CACHE_SIZE

DECC$TZ_CACHE_SIZE specifies the number of time zones that can be held in memory.

Default: 2

Maximum: 2147483647

DECC$UMASK

DECC$UMASK specifies the default value for the permission mask umask . By default, a parent C program sets the umask from the RMS default permissions for the process. A child process inherits the parent's value for umask .

To enter the value as an octal value, add the leading zero; otherwise, it is translated as a decimal value. For example:


$ DEFINE DECC$UMASK 026 

Maximum: 0777

DECC$UNIX_PATH_BEFORE_LOGNAME

With DECC$UNIX_PATH_BEFORE_LOGNAME enabled, when translating a UNIX file name not starting with a leading slash (/), an attempt is made to match this to a file or directory in the current directory. If this is not found and the name is valid as a logical name in an OpenVMS file name, an attempt is made to translate the logical name and, if found, is used as part of the resulting file name.

Enabling DECC$UNIX_PATH_BEFORE_LOGNAME overrides the setting for DECC$DISABLE_TO_VMS_LOGNAME_TRANSLATION.

DECC$USE_RAB64

With DECC$USE_RAB64 enabled, open functions allocate a RAB64 structure instead of the traditional RAB structure.

This provides latent support for file buffers in 64-bit memory.

DECC$VALIDATE_SIGNAL_IN_KILL

With DECC$VALIDATE_SIGNAL_IN_KILL enabled, a signal value that is in the range 0 to _SIG_MAX but is not supported by the C RTL generates an error with errno set to EINVAL, which makes the behavior the same as for raise .

With this logical name disabled, validation of signals is restricted to checking that the signal value is in the range 0 to _SIG_MAX. If sys$sigprc fails, errno is set based on sys$sigprc exit status.

DECC$V62_RECORD_GENERATION

OpenVMS Versions 6.2 and higher can output record files using different rules.

With DECC$V62_RECORD_GENERATION enabled, the output mechanism follows the rules used for OpenVMS Version 6.2.

DECC$XPG4_STRPTIME

XPG5 support for strptime introduces pivoting year support so that years in the range 0 to 68 are in the 21st century, and years in the range 69-99 are in the 20th century.

With DECC$XPG4_STRPTIME enabled, XPG5 support for the pivoting year is disabled and all years in the range 0 to 99 are in the current century.

1.7 32-Bit User and Group Identifiers

When supported in versions of the OpenVMS operating system, POSIX style identifiers refers to the User Identification (UID), Group Identification (GID), and Process Group. The scope includes real and effective identifiers.

The support for POSIX style identifiers in the Compaq C RTL requires 32-bit user and group ID support and also depends on features in the base version of OpenVMS. Currently, POSIX style IDs are supported only by some OpenVMS versions done for specific government agencies, but will be integrated into future OpenVMS releases.

OpenVMS Version 7.3-1 does not support POSIX style IDs, but it does support 32-bit UID/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. In some cases, such as with the getgroups function, more information may be returned when the application supports 32-bit GIDs.

On OpenVMS Version 7.3-1, to compile an application for 32-bit UID/GID support, define the macro __USE_LONG_GID_T . To compile an application for 16-bit UID/GID support, define the macro _DECC_SHORT_GID_T .

In addition, although you cannot compile with POSIX style IDs enabled on OpenVMS Version 7.3-1, you can run programs that were compiled with POSIX style IDs enabled on OpenVMS systems that do provide that support.

1.8 Input and Output on OpenVMS Systems

After you learn how to link with the Compaq C RTL and call Compaq C functions and macros, you can use the Compaq C RTL for its primary purpose: input/output (I/O).

Since every system has different methods of I/O, familiarize yourself with the OpenVMS-specific methods of file access. In this way, you will be equipped to predict functional differences when porting your source program from one operating system to another.

Figure 1-2 shows the I/O methods available with the Compaq C RTL. The OpenVMS system services communicate directly with the OpenVMS operating system, so they are closest to the operating system. The OpenVMS Record Management Services (RMS) functions use the system services, which manipulate the operating system. The Compaq C Standard I/O and UNIX I/O functions and macros use the RMS functions. Since the Compaq C RTL Standard I/O and UNIX I/O functions and macros must go through several layers of function calls before the system is manipulated, they are furthest from the operating system.

Figure 1-2 I/O Interface from C Programs


The C programming language was developed on the UNIX operating system, and the Standard I/O functions were designed to provide a convenient method of I/O that would be powerful enough to be efficient for most applications, and also be portable so that the functions could be used on any system running C language compilers.

The Compaq C RTL adds functionality to this original specification. Since, as implemented in the Compaq C RTL, the Standard I/O functions recognize line terminators, the Compaq C RTL Standard I/O functions are particularly useful for text manipulation. The Compaq C RTL also implements some of the Standard I/O functions as preprocessor defined macros.

In a similar manner, the UNIX I/O functions originally were designed to provide a more direct access to the UNIX operating systems. These functions were meant to use a numeric file descriptor to represent a file. A UNIX system represents all peripheral devices as files to provide a uniform method of access.

The Compaq C RTL adds functionality to the original specification. The UNIX I/O functions, as implemented in Compaq C, are particularly useful for manipulating binary data. The Compaq C RTL also implements some of the UNIX I/O functions as preprocessor defined macros.

The Compaq C RTL includes the Standard I/O functions that should exist on all C compilers, and also the UNIX I/O functions to maintain compatibility with as many other implementations of C as possible. However, both Standard I/O and UNIX I/O use RMS to access files. To understand how the Standard I/O and UNIX I/O functions manipulate RMS formatted files, learn the fundamentals of RMS. See Section 1.8.1 for more information about Standard I/O and UNIX I/O in relationship to RMS files. For an introduction to RMS, see the Guide to OpenVMS File Applications.

Before deciding which method is appropriate for you, first ask this question: Are you concerned with UNIX compatibility or with developing code that will run solely under the OpenVMS operating system?

If you are writing system-level software, you may need to access the OpenVMS operating system directly through calls to system services. For example, you may need to access a user-written device driver directly through the Queue I/O Request System Service ($QIO). To do this, use the OpenVMS level of I/O; this level is recommended if you are an experienced OpenVMS programmer. For examples of programs that call OpenVMS system services, see the Compaq C User's Guide for OpenVMS Systems.

You may never use the RMS or the OpenVMS system services. The Standard I/O and UNIX I/O functions are efficient enough for a large number of applications. Figure 1-3 shows the dependency of the Standard I/O and the UNIX I/O functions on RMS, and the various methods of I/O available to you.

Figure 1-3 Mapping Standard I/O and UNIX I/O to RMS


1.8.1 RMS Record and File Formats

To understand the capabilities and the restrictions of the Standard I/O and UNIX I/O functions and macros, you need to understand VAX Record Management Services (RMS).

RMS supports the following file organizations:

Sequential files have consecutive records with no empty records in between; relative files have fixed-length cells that may or may not contain a record; and indexed files have records that contain data, carriage-control information, and keys that permit various orders of access.

The Compaq C RTL functions can access only sequential files. If you wish to use the other file organizations, you must use the RMS functions. For more information about the RMS functions, see the Compaq C User's Guide for OpenVMS Systems.

RMS is not concerned with the contents of records, but it is concerned about the record format, which is the way a record physically appears on the recording surface of the storage medium.

RMS supports the following record formats:

You can specify a fixed-length record format at the time of file creation. This means that all records occupy the same amount of space in the file. You cannot change the record format once you create the file.

The length of records in variable-length, VFC, and stream file formats can vary up to a maximum size that must be specified when you create the file. With variable-length record or VFC format files, the size of the record is held in a header section at the beginning of the data record. With stream files, RMS terminates the records when it encounters a specific character, such as a carriage-control or line-feed character. Stream files are useful for storing text.

RMS allows you to specify carriage-control attributes for records in a file. Such attributes include the implied carriage-return or the Fortran formatted records. RMS interprets these carriage controls when the file is output to a terminal, a line printer, or other device. The carriage-control information is not stored in the data records.

By default, files inherit the RMS record format, maximum record size and record attributes, from the previous version of the file, if one exists; to an OpenVMS system programmer, the inherited attributes are known as fab$b_rfm, fab$w_mrs and fab$b_rat. If no previous versions exist, the newly created file defaults to stream format with line-feed record separator and implied carriage-return attributes. (This manual refers to this type of file as a stream file.) You can manipulate stream files using the Standard I/O and the UNIX I/O functions of the Compaq C RTL. When using these files and fixed-record files with no carriage control, there is no restriction on the ability to seek to any random byte of the file using the fseek or the lseek functions. However, if the file has one of the other RMS record formats, such as variable-length record format, then these functions, due to RMS restrictions, can seek only to record boundaries. Use the default VAX stream format unless you need to create or access files to be used with other VAX languages or utilities.

1.8.2 Access to RMS Files

RMS sequential files can be opened in record mode or stream mode. By default, STREAM_LF files are opened in stream mode; all other file types are opened in record mode. When opening a file, you can override these defaults by specifying the optional argument "ctx=rec" to force record mode, or "ctx=stm" to force stream mode. RMS relative and indexed files are always opened in record mode. The access mode determines the behavior of various I/O functions in the Compaq C RTL.

One of the file types defined by RMS is an RMS-11 stream format file, corresponding to a value of FAB$C_STM for the record format. The definition of this format is such that the RMS record operation SYS$GET removes leading null bytes from each record. Because this file type is processed in record mode by the Compaq C RTL, it is unsuitable as a file format for binary data unless it is explicitly opened with "ctx=stm", in which case the raw bytes of data from the file are returned.

Note

In OpenVMS Version 7.0 the default LRL value on stream files was changed from 0 to 32767. This change caused significant performance degradation on certain file operations such as sort.

This is no longer a problem. The Compaq C RTL now lets you define the logical DECC$DEFAULT_LRL to change the default record-length value on stream files.

The Compaq C RTL first looks for this logical. If it is found and it translates to a numeric value between 0 and 32767, that value is used for the default LRL.

To restore the behavior prior to OpenVMS Version 7.0, enter the following command:


$ DEFINE DECC$DEFAULT_LRL 0 

1.8.2.1 Accessing RMS Files in Stream Mode

Stream access to RMS files is done with the block I/O facilities of RMS. Stream input is performed from RMS files by passing each byte of the on-disk representation of the file to your program. Stream output to RMS files is done by passing each byte from your program to the file. The Compaq C RTL performs no special processing on the data.

When opening a file in stream mode, the Compaq C RTL allocates a large internal buffer area. Data is read from the file using a single read into the buffer area and then passing the data to your program as needed. Data is written to the file when the internal buffer is full or when the fflush function is called.

1.8.2.2 Accessing RMS Record Files in Record Mode

Record access to record files is done with the record I/O facilities of RMS. The Compaq C RTL emulates a byte stream by translating carriage-control characters during the process of reading and writing records. Random access is allowed to all record files, but positioning (with fseek and lseek ) must be on a record boundary for VFC files, variable record files, or files with non-null carriage control. Positioning a record file causes all buffered input to be discarded and buffered output to be written to the file.

Record input from RMS record files is emulated by the Compaq C RTL in two steps:

  1. The Compaq C RTL reads a logical record from the file.
    If the record format is variable length with fixed control (RFM = VFC), and the record attributes are not print carriage control (RAT is not PRN), then the Compaq C RTL concatenates the fixed-control area to the beginning of the record.
  2. The Compaq C RTL expands the record to simulate a stream of bytes by translating the record's carriage-control information (if any).

In RMS terms, the Compaq C RTL translates the record's carriage-control information using one of the following methods:

As you read from the file, the Compaq C RTL delivers a stream of bytes resulting from the translations. Information that is not read from an expanded record by one function call is delivered on the next input function call.

The Compaq C RTL performs record output to RMS record files in two steps.

The first part of the record output emulation is the formation of a logical record. As you write bytes to a record file, the emulator examines the information being written for record boundaries. The handling of information in the byte stream depends on the attributes of the destination file or device, as follows:

The second part of record output emulation is to write the logical record formed during the first step. The Compaq C RTL forms the output record as follows:


Previous Next Contents Index

  [Go to the documentation home page] [How to order documentation] [Help on this site] [How to contact us]  
  privacy and legal statement  
5763PRO_005.HTML