ECO NUMBER: VAXACRT02_072 PRODUCT: OpenVMS VAX OPERATING SYSTEM V7.2 UPDATE PRODUCT: OpenVMS VAX OPERATING SYSTEM V7.2 Compaq C RTL for OpenVMS VAX V7.2 ECO Cover Letter 1 KIT NAME VAX 2 KITS SUPERSEDED BY THIS KIT VAXACRT01_072 3 KIT DEPENDENCIES 3.1 Required remedial kits before installation The following remedial kit(s) must be installed BEFORE installation of this, or any required kit: None 3.2 Required remedial kits In order to receive all the corrections listed in this kit, the following remedial kits should also be installed: None. 4 KIT DESCRIPTION 4.1 Version(s) of OpenVMS to which this kit may be applied: OpenVMS VAX V7.2 4.2 Files patched or replaced: o [SYSLIB]DECC$SHR.EXE (new image) o [SYSLIB]CRTL.OBJ (new file - used to update STARLET.OBJ) o [SYSLIB]CRTLMSGDEF.OBJ (new file - used to update STARLET.OBJ) 5 PROBLEMS ADDRESSED IN VAXACRT02_072 KIT o mktime() performance Function mktime()'s algorithm locked thread specific data, which didn't need to be done. This change uses stack allocated -- COVER LETTER -- Page 2 24 May 2001 data, and improves performance. o Performance in open() Function open() had unnecessary calls to SYS$GETJPI. These were removed. o Functions mmap() and munmap() changes Several problems in function mmap() and munmap() were addressed. - Function munmap() would sometimes fail when releasing memory allocated with MAP_ANON. This is because it wrongly tried to deassign a file channel that was not associated with the memory range. - Function mmap() was incorrectly specifying global memory when MAP_ANON is specified. Change will only do this with flag MAP_SHARED specified. o Function gettimeofday() fails without setting errno Function gettimeofday() now sets errno and vaxc$errno appropriately if UTC time functions fail because of a system service failure. o File creation incorrectly inherits directory attributes The file creation functions (fopen, open, creat) have been corrected to not inherit file attributes if a directory by the same name exists for the file being created. For example, creating a file named "foo." in a directory which contained a "foo.dir" would incorrectly inherit file attributes from this directory file. o Incorrect timestamp returned from stat and fstate functions The stat function no longer puts the wrong values into st_?time members of the stat structure. More precisely, during daylight savings time the values of st_?time are no longer one hour ahead from file creation/modification time reported by the $DIRECTORY command. o Support for timezones requiring a TDF of -13 The time functions time, ftime, gettimeofday and getclock would fail for a TDF (time differential factor) of -13 hours, the value required in New Zealand. According to the U.S. Naval Observatory information the valid range for the TDF is -13.75 to +13, inclusive. The C RTL now allows this full range. -- COVER LETTER -- Page 3 24 May 2001 o Correct interpretation of years in strptime function In the previous ECO kit, a change was introduced to the function strptime() for XPG5-compatibility to handle expressions for the 2-digit year format %y when the century was not specified. The requirement is for 2-digit years in the range 0-68 to be treated as 21st century and years in the range 69-99 as 20th century. The 2-digit years in the range 69-99 were incorrectly being treated as 21st century. o Prefixing of image names in execlp and execvp functions The execlp and execvp functions were unconditionally prefixing the file specification of the image to be run in the child process with "VAXC$PATH:" string. When passed a fully qualified file specification, this would result in an invalid file specification. o Seeking past end of file no longer extends the physical file The behavior of lseek() and fseek() at positions beyond the end of data in a file were not conforming to the POSIX/ANSI standard. The file was being physically null padded on disk even though the standard only requires this null padding if data is actually written at this point. In the case reported by the user, seeking to the end of a file by using a large offset would take a long time and may exhaust available disk space. To get the POSIX behavior, you must define DECC$POSIX_SEEK_STREAM_FILE as "ENABLE". The default behavior is unchanged. o Implicitly open files for shared access The Compaq C RTL was enhanced to open all files for shared access as if the "shr=del,get,put,upd" option was specified in the open* or creat call. To enable this feature, define the logical name DECC$FILE_SHARING to the value "ENABLE". The value is case-insensitive and is checked only once per image activation, not on a file-by-file basis. o Writing large amounts of data to a pipe The Compaq C RTL was failing when the amount of data written to a pipe exceeded the buffer size of that pipe. The RTL now breaks the large write into a sequence of writes whose size is the size of the underlying mailbox used to implement pipes. o Image exit handler processing changed to avoid hangs in multithreaded programs A problem was reported that the RTL could hang if exit were called while threads were continuing to do I/O. Analysis showed that the hang was caused by a thread holding the lock necessary to close the file and the exit handler blocking on this lock. The change implemented was to not attempt to close files whose locks were currently in use. -- COVER LETTER -- Page 4 24 May 2001 o Extending a file using ftruncate does not extend the physical file When a stream file is extended using ftruncate() it is documented that the extended area will be filled with zeroes. This is now done correctly. Prior to this change, the file was not extended. o Select function is not terminated by exceptions as documented The documentation of the select function states that it returns either when a socket is ready to be read or written, when the timeout period expires, or when exceptions occur. It was not properly terminating when an exception occurred. This problem was corrected by dynamically linking to and calling an abort function in the socket library. A complete correction to interrupting the select function will also require an ECO kit from the Compaq TCP/IP product which includes this new abort function. o Calls to fstat function may result in an Access Violation The fstat function was corrected to not access violate when called with stdin, stdout, stderr, or a directory specification. o Supporting search lists in calls to chdir The chdir function was not well behaved when the calling program passed an argument which was a search list logical. The chdir function was unconditionally changing the logical sys$disk to the first member of the search list was effectively dropping the remaining members. More work may be done in this area in future releases of the C RTL. 6 PROBLEMS ADDRESSED IN VAXACRT01_072 KIT o The getenv() function has been corrected to check for a Command Line Interpreter (CLI) symbol only when called in user access mode. While Compaq C RTL is a user-mode run time library, a decision was made to correct getenv() in order to make the library more robust. The reason for this change is because calling the CLI from within exec or kernel mode may result in an access violation. With this fix, when called from inner access mode, the getenv() function will search only the C environment list and OpenVMS logical names. This fix does not mean, however, that the user-mode only restriction was lifted. It is still unsupported to call the Compaq C RTL functions, including getenv(), in any access mode other than in user-mode. -- COVER LETTER -- Page 5 24 May 2001 o The strptime() function has been modified to comply with X/Open CAE Specification System Interfaces and Headers Issue 5 (commonly known as XPG5). In XPG5, how the strptime() function processes the "%y" directive was changed for a two-digit year within the century, if no century is specified. According to XPG5, for the "%y" directive, when a century is not otherwise specified, values in the range 69-99 refer to years in the twentieth century (1969 to 1999 inclusive), while values in the range 00-68 refer to years in the twenty-first century (2000 to 2068 inclusive). Essentially, for the "%y" directive, strptime() became a "pivoting" function with 69 being a pivoting year. Before this change, the strptime() function was always interpreting a two-digit year with no century as a year within the twentieth century. With the current ECO kit, XPG5-compliant strptime() becomes a default strptime() function in the Compaq C RTL. However, for compatibility reasons, the previous "non-pivoting" XPG4-compliant strptime() function was retained. The "pivoting" is controlled by the DECC$XPG4_STRPTIME logical name. Defining this logical name prior to invoking the application (as enable) will cause the Compaq C RTL to use the "non-pivoting" flavor of strptime(). Also, "non-pivoting" strptime() can be called directly as the decc$strptime_xpg4() function. While there is an easy way to disable "pivoting" by just defining a logical name, you should be aware that if the application ceases to work correctly due to the change in the strptime() function, it almost certainly means that there is a Y2K problem in the application. Y2K-safe applications should not be affected by the change in strptime(). o The stat() function has been corrected to process file specifications such as "foo:[000000]", where foo is defined as a concealed device like the following: $ define/trans=(conc) foo device:[bar.] Prior to this fix, the stat() function would fail for such a file specification with errno set to ENOENT (No such file or directory). o Both flavors of the system() function were corrected to ensure that the function always returns the correct status. The POSIX-compliant system() function has been corrected to always return a status corresponding to the signal, which terminated the child process if the child process was terminated due to receiving a signal. -- COVER LETTER -- Page 6 24 May 2001 Prior to this fix, there was a small timing window when the function could return the status corresponding to the child process completion code, even in the case when the child process was terminated by a signal. The Non-POSIX system() function has been corrected to always return the OpenVMS completion code of the child process. Prior to this fix, there was a small timing window when the function could return the status from LIB$SPAWN(), instead of the completion code of the child process. None of these problems were ever reported by a customer. o The opendir() and readdir() functions have been corrected to process directories on a remote node specified using the following DECnet file specification: nodename"username password"::device:[directory] Prior to this fix, opendir() could fail with errno set to ENOTDIR (Not a directory). In the case when opendir() could successfully open the directory, the readdir() function could return incorrect file names. o The times() and clock() functions have been modified to be both thread-safe and AST-reentrant. Prior to this change, these functions belonged to the class of functions which are thread safe, but not AST-reentrant (see section 1.7.2 Multithread Restrictions in the DEC C RTL Reference Manual). The change in the reentrancy status of the times() and clock() functions will be reflected in the next release of the Manual. o The stat() function no longer fails due to the failure of the mktime() function. It was reported that the stat() function fails for a file created on April 4th 1999 at 2:04 a.m. EST, which is the "missing hour" in the transition from standard to daylight saving time in the Eastern time zone. The problem was due to the failure of the mktime() function to process the "missing hour" (stat() calls mktime() to fill st_?time members of the stat structure with the UTC time). While the mktime() function was not fixed, the stat() function was corrected to handle the failure of mktime() and set st_?time fields correctly, even if mktime() fails. Note, that, strictly speaking, "missing hour" is an invalid input for mktime(): there is no such time as "April 4th 1999 2:04 a.m.", for example, in the Eastern time zone. Given the possibility of calling mktime() with an invalid time, the -- COVER LETTER -- Page 7 24 May 2001 stat() function probably should not have used mktime() in the first place or at least should have been prepared for a mktime() failure. o The select() function has been corrected to return a failure status if either an invalid file descriptor or file descriptor not associated with a socket is found in one of the specified file descriptor sets. In the case of an invalid file descriptor, the select() function sets errno to EBADF. In case of a file descriptor not associated with a socket, the function sets errno to ENOTSOCK. Failure with errno set to EBADF is the standard requirement for the select() function. Failure with errno set to ENOTSOCK occurs because the select() function can currently operate only on sockets. Prior to this fix, the function was setting errno as described above, but otherwise was ignoring invalid file descriptors and file descriptors not associated with sockets. The old behavior can be requested by defining the logical name DECC$SELECT_IGNORES_INVALID_FD prior to invoking the application (any equivalence string). o The problem commonly known as the "Y2038 bug" has been fixed. The C run-time library time functions, which access the current time using the OpenVMS time functions, have been corrected to handle times after 19-Jan-2038 3:14:07. Data type time_t is defined on OpenVMS as an unsigned 32-bit integer. However, some of the functions which retrieve current time from the system and convert it to time_t format were using signed arithmetic. This fix affects the functions: o decc$fix_time() o time() o ftime() o gettimeofday() o getclock() With this fix, Compaq C RTL time functions will handle times successfully until 07-Feb-2106 06:28:15. o The printf() family of functions have been enhanced to perform better when the calling application has exhausted available memory. o The file access functions have been corrected to process file names on UNIX systems over DECnet. The file name for a file on a UNIX system accessed over DECnet was being converted to uppercase, even when the name was enclosed in double quotes. This problem was introduced on OpenVMS V7.2 and also affects OpenVMS V7.1-2 and OpenVMS V7.2-1. File names of the form node::"/dir/name" are now processed correctly. -- COVER LETTER -- Page 8 24 May 2001 7 KIT INSTALLATION RATING The following kit installation rating, based upon current CLD information, is provided to serve as a guide to which customers should apply this remedial kit. (Reference attached Disclaimer of Warranty and Limitation of Liability Statement) INSTALLATION RATING: INSTALL_3 : To be installed by customers experiencing the problems corrected. 8 INSTALLATION INSTRUCTIONS Install this kit with the VMSINSTAL utility by logging into the SYSTEM account, and typing the following at the DCL prompt: @SYS$UPDATE:VMSINSTAL VAXACRT01_072 [location of the saveset] The saveset location may be a tape drive, CD, or a disk directory that contains the kit saveset. Since the images in this kit will not take effect until the system is rebooted, you must reboot the system after installing this kit. If you have other nodes in your OpenVMS cluster, they must also be rebooted in order to make use of the new image(s). If it is not possible or convenient to reboot the entire cluster at this time, a rolling re-boot may be performed. During installation you may see the following message: %INSTALL-E-NODELSHRADR, unable to delete image with shareable address data -INSTALL-I-PLSREBOOT, please reboot to install a new version of this image This is not a cause for concern. It simply means that DECC$SHR.EXE was installed as a resident image, which is the standard configuration for OpenVMS VAX systems. The new image will not take effect until the system is rebooted.