--- Generated on Sat Dec 6 14:35:25 GMT 2003 by rich --- Changes in 2.04 =============== Here is a list of changes from DJGPP V2.03 to V2.04. Ability to report the exact CPU type in `uname'. The functions `_creat', `_creatnew' and `_open' now set extended size flag in DOS calls to be able to create files with size up to 2^32-1, supported on FAT32 volumes. The function `llseek' added with type `offset_t' to support file seeks up to 2^32-2. The function `statfs' have been made to report correct values > 2^31 on FAT32 partitions. The function `_invent_inode' has been changed to start numbering invented inodes from `USHRT_MAX+1' to 2^28+1. Functions `_is_cdrom_drive', `_is_ram_drive' and `_media_type' has been taken out of `mntent.c' and made externally callable. New functions `_get_fat_size', `_get_fs_type' and `_is_fat32' added. When used together with GCC 2.96 or later, va_list facilities in `stdarg.h' and `varargs.h' are implemented using new builtins from GCC 2.96. `fsdb' checks for executables and loads them even if the extension `.exe' isn't given in the command line. `div', `ldiv' and `lldiv' return properly signed remainders for negative arguments. The function `remove' works around a DOS bug, whereby DOS returns a "File not found" error for write-protected floppy disks. The series produced by `rand' have a longer period. The execution speed of `drand48' and `erand48' has been improved. `__dpmi_simulate_real_mode_procedure_retf_stack' no longer corrupts the caller's stack. `getlogin' now examines the environment variable `USERNAME' to determine the user's name, in addition to `USER' and `LOGNAME'. New function `stpncpy' has been added, thanks to Richard E. Stone . Calling the `setitimer' function with both `it_interval.tv_sec' and `it_interval.tv_usec' members of `struct itimerval' set to zero no longer causes the timer to behave as if `it_interval.tv_usec' were set to the system clock granularity (55msec by default). UNIX-style symbolic links are fully emulated by library. As a part of this, new functions `__internal_readlink', `__solve_symlinks', `__solve_dir_symlinks', `lchown', `lstat' and `readlink'; new macros `S_ISLNK' and `S_IFLNK' have been added to library. `open' now follows symlinks when opening file. Also, it honors two new mode flags: `O_NOLINK' and `O_NOFOLLOW'. As a part of symlink emulation, `symlink' no longer emulates symlinks to executables by creating stubs. It creates symlinks to all files instead. A subtle bug was corrected in function `process_coff' used by `syms_init' from `libdbg.a' to read and sort the symbols from a COFF image. As a result, the `symify' utility should no longer crash in rare cases, especially when invoked on large programs. The linker script `lib/djgpp.djl' corrected to not unnecessarily pollute the name space with the symbols `etext', `edata' and `end'. The profiling code was also changed to not pollute the name space with `etext'. The `dtou' program accepts new command-line options for verbose operation, backup file creation, and control of file timestamp preservation. Its source can now be compiled on a Unix or GNU/Linux system. The protection against multiple redefinitions of various types like `size_t' has been rewriten to make DJGPP header files compatible with GCC provided ones. The `djtar' program can now unpack `.tar.bz2' archives compressed with the `bzip2' program. The functions `system' and `spawn*' can invoke Windows programs and advanced shells, such as `4DOS' and `NDOS', with command lines longer than 126 characters. For Windows programs, the command line can be up to 1015 characters long; `4DOS' and `NDOS' can be passed up to 247 characters. This is done by defining the `CMDLINE' environment variable whose value is the command line. The DJGPP startup code also supports `CMDLINE' method of passing long command lines, so DJGPP programs can now be invoked with long command lines from the `COMMAND.COM''s prompt, and also from other Windows programs which support `CMDLINE'. The functions `system' and `spawn*' have also been enhanced to free DPMI selectors leaked by many DPMI hosts. This fixes the problem with large makefiles failing before completion under Windows. The functions `rename' and `_rename' can now be used to change the letter case of a file name, like in this snippet: rename ("makefile", "Makefile"); (This only works when the LFN support is available, of course.) The function `__dosexec_find_on_path' no longer looks for files with the `.sh', `.ksh', `.pl', and `.sed' extensions before the files without those extensions. This is so e.g. `foo' is found _before_ `file.sh' if both of them are present in the same directory. The previous code was known to cause Bash to run the wrong script in some cases. This change affects all library functions which search for executables along the `PATH': `system', `popen', `pclose', and the functions from the `spawn*' family. The DOS standard extensions `.com', `.exe', `.bat', and `.btm' are still included in the search _before_ looking for the file name itself, for compatibility with stock DOS/Windows shells. The functions `valloc' and `memalign' have been added to the library to support allocating memory at power-of-2 addresses. The `djsplit' and `djmerge' utilities now preserve the original file's time stamp and mode bits. The `-t' switch to those programs restores the old behavior, where each file was created with the current time stamp and default attribute bits. The low-level function `_put_path' was changed to avoid referencing an `env' directory in the current working directory when library functions are passed the `/dev/env' file name. This avoids creating spurious `env' directories in any directory where the standard GNU `mkinstalldirs' script is run. Functions `rename' and `_rename' work on Windows 2000 when the file under the new name already exists. This solves the problems with linking DJGPP programs and with running the `stubify' utility on that OS. The function `lfilelength' added with return type `long long' to support file sizes of up to 2^63-1. Texinfo documentation (WIP) for `djasm' has been added. The dates inserted into the object file by `djasm' now follow ISO format. `djasm' now sets the offset of new executable field in the header of executables to zero (meaning not used). Allow one to allocate space in `djasm' using `.union' (instead of `.struct') when using a union. As there is no checking, `.struct' and `.union' are interchangeable. This feature taken from a version of `djasm' maintained by Bill Currie . The `fcntl' function has been significantly enhanced. In particular: - File locking functions (which were missing in every version up to v2.03) now work, with some exceptions relating to the absence of any read locking in DOS/Windows 9X environments. - These functions now interrogate and use the value of the DOS flag `_DEV_NO_INHERIT' to implement the `FD_CLOEXEC' flag; - The `F_SETFL' function is still an effective no-op, since DOS/Windows does not allow flags to be modified on an open file. A small exception is made for `F_SETFL': You may use `F_SETFL' to remove the`O_NONBLOCK' flag, because it is not supported by DJGPP anyway, and it does no harm to allow this functionality. The `F_GETFL' function now computes the open mode and status flags. On Windows NT this cannot report the open mode correctly -- `O_RDONLY' is always returned. - Documentation has been updated to reflect the new functionality and test programs have been provided for most new or changed functions. `flock' has been implemented using the new `fcntl' locking functions to implement file-level locking and unlocking. `lockf' (31-bit support) and `llockf' (FAT32 support, 32-bit only) have been added as compatible interfaces to the new `fcntl' locking functions. New function `dostrerr' has been coded to provide string values for the error codes returned from function `dosexterr'. Documentation and a test program have been provided. This function is an analogue of the `strerror' function for errno values, and is intended to be used when coding functions or programs that call DOS and want to print messages when errors occur. New functions `_dos_lk64' and `_dos_unlk64' have been added to provide a FAT32-compatible interface to the DOS locking code. Compatible functions `lock64' and `unlock64' are direct interfaces to these two new `_dos_*' functions. Support for enumeration type added to `djasm'. This feature taken from a version of `djasm' maintained by Bill Currie . Header files, which are part of the new ANSI/ISO C99 Standard, are now available. These include `stdint.h'. When used in C++ programs, the standard C header files now make their contents visible in namespace `std' as well as in the global namespace. `setjmp' is now a macro as well as a function. This is required by the C++ standard, and also recommended by the C standard. `_get_dos_version' now recognises OEM number `0xfd' as FreeDOS. Functions which convert numeric strings to the corresponding integer values no longer return non-zero values for strings which begin with 8-bit characters. `open' now honors `O_TEMPORARY'. A file opened with `O_TEMPORARY' will be deleted when all file descriptors that refer to it are closed. The functions `_rename' (and `rename' which calls it) and `mkdir' no longer fail on Windows ME when long file names support is disabled. This solves the problem with failures to link programs if the `LFN' variable is set to `n' because `stubify.exe' failed to rename the produced executable and reported `EINVAL'. When `write' and `_write' detect that a file pointer is past EOF, that space will now be filled with zeroes to increase POSIX compliance and plug a security hole on disks containing sensitive information. If a tar archive contains DOS batch files that have been stored with UNIX-style LF-only EOLs, `djtar' will now convert them automatically to DOS-style EOLs. This is because `COMMAND.COM' refuses to run batch files that contain UNIX-style EOLs. The function `pipe' is now implemented in the library. `.com' programs are now invoked by the `spawn*' family of functions directly, thus making their exit status available to the parent DJGPP program. Previously, when long file names were supported, `.com' programs were invoked through `COMMAND.COM', which would lose the exit status. File handles connected to the console device are no longer reported by the `select' function as not ready for input when termios functions are used to read those handles in cooked mode. New functions `snprintf' and `vsnprintf' added. The double-precision shift instructions `shld' and `shrd' are removed from `djasm' because they violate the established convention of using the `b', `w', or `d' mnemonic suffix to specify the memory operand size. (The result is that they use up two mnemonics that should have been reserved for the basic shift/rotate instructions.) Completed the support in `djasm' for the byte/word/double shift/rotate instructions. This feature taken from a version of `djasm' maintained by Bill Currie . The functions `fopen' and `freopen' improved to handle the append mode properly. The functions `fputc', `fprintf', `fwrite' and `write' always seek to end of file if the file has been opened in append mode. Type of `__file_handle_modes' extended to be able to hold the `O_APPEND' flag. Due to the improved append mode implementation, the functions `fopen', `fflush', `_flsbuf', `fopen', and `freopen' no longer use the `_IOAPPEND' flag. And since the flag is no longer used, the `_IOAPPEND' flag has been deleted from `libc/file.h'. When the first character in the valid options string is a colon `:', `getopt' will now return a colon when a missing option argument is detected and will not print error messages even when `opterr' is non-zero. The function `readdir' now includes the file's type in the `d_type' member of `struct dirent' it returns. This member is used by some GNU packages, such as Fileutils, to make directory traversal more efficient. *WARNING: This makes some object files built with DJGPP v2.03 incompatible with programs compiled with the v2.04 library!* Two new functions, `monstartup' and `moncontrol', allow to control when profiling starts and ends, and what range of addresses is recorded in the profiling data. There are new `malloc' debug facilities. While not as powerful and versatile as existing external packages, such as YAMD, these facilities do allow to detect a wide variety of heap corruption problems, and to report important heap usage statistics. The new functions are `mallinfo', `malloc_debug', `malloc_verify', and `mallocmap'; these names are compatible with many Unix and GNU/Linux systems. In addition, special hooks, such as `__libc_malloc_hook' and `__libc_free_hook', are provided for building custom `malloc' debugging packages. Nested DJGPP programs which are run by other DJGPP programs on Windows should no longer crash (and take the DOS box with them) due to the fact that Windows leaks selectors. These crashes were caused by a failure to allocate a selector for conventional memory, and subsequent use of the invalid selector by the startup code itself. This problem was typical for Make, Bash, and any other program which can launch lots of child programs without ever exiting to DOS. To avoid this, the startup code was fixed to print an error message and exit to DOS with an exit status that indicates a failure, when a selector for DOS memory could not be allocated by the DPMI host. `confstr' has been added to the library to support returning system-dependent configuration in strings. Colors for symlinks were added to the `LS_COLORS' environment variable in `djgpp.env'. Double-precision shift instructions reinstated in `djasm', using a simplified form of the implementation suggested by Bill Currie . The new mnemonics are `dshl' and `dshr', and no memory operand-size suffix is required. Obsolete usage of `shld' and `shrd' for double-precision shifts is flagged. Two new functions, `l64a' and `a64l' (both part of the POSIX draft standard), allow you to convert a 32-bit integer value to and from a base-64 encoding, respectively. Note that the encoding used is the one mandated by the POSIX spec, and not the one used by either `uuencode' or the MIME base64 encoding. The environment functions `setenv' and `putenv' are now both part of the POSIX draft standard and were updated to match the specs set forth by that standard. Both now set `errno' in case of failure, and `putenv''s argument is now a `char*' instead of a `const char*'. A new function, `unsetenv', which is also part of that standard, was added. `struct group' has a new field, `gr_passwd'. This helps out porters, as many Unixy apps expect it to exist. Since DOS is basically an insecure environment, this field always contains the empty string. Similarly, `struct passwd' has two new fields, `pw_gecos' and `pw_passwd'. `pw_gecos' gets the same value as `pw_name' (i.e. the value returned by `getlogin()'). Like `gr_passwd', `pw_passwd' gets the empty string as value. The function `uname' supports the new Pentium 4 CPU's by returning `"i786"' in the `machine' member of `struct utsname' it returns. A name conflict between `gettext' declared in `conio.h' and `gettext' provided by GNU Gettext has been resolved. `malloc' now declines ridiculously large allocation requests which exceed 2GB - 64KB. This is because anything larger is not supported by `sbrk' and by most DPMI hosts. Previously, `malloc' would sometimes allocate a very small buffer due to wrap-around of large unsigned numbers, and the calling program would then crash when it tried to use that buffer. `v2loadimage' now supports long command lines, instead of being restricted by the DOS 126-character limit. A new function, `__djgpp_spawn', has been added to allow control over whether a search for executable extensions is performed. The function `glob' and its helper functions have been changed to prevent an internal buffer from being overrun when the pattern to be expanded has more than 2000 characters. There's now a work-around for the bug in NTVDM, the DOS emulator, which ships with Windows 2000: nested DJGPP programs no longer cause NTVDM to crash. This allows to use GCC, Make, RHIDE, Bash, and other programs which routinely invoke child programs. The function `utime' now works on Windows 2000 and Windows XP. Previously, it would fail with `errno' set to `EIO'; this affected programs like `touch', `dtou', and `recode', which set time stamps of files. In addition, `utime' now allows to set the time stamp of directories, but only on Windows 2000 or XP (other versions of Windows do not allow to change time stamps of directories). A fix has been applied to the memory allocation routines in `sbrk' to prevent use of memory which would require address wrap when the host DPMI provider does not allow 4Gb address limits. This feature may also be enabled in other environments which do not require it to get better memory protection. `_CRT0_DISABLE_SBRK_ADDRESS_WRAP' flag was added to `_crt0_startup_flags' in file `crt0.h' A list of memory block sizes `__djgpp_memory_handle_size' was added for use in core dumps of the address space. Change the round up size for memory block allocations in `sbrk' to increase with the number of handles allocated. This helps keep the number of handles to the 256 allocated and reduce problems exhausting DPMI handle resources. The functions `dup' and `dup2' now copy to the new handle any Filesystem Extensions which hooked the original handle. Thus, the duplicate handle now behaves exactly like the original one, in that it is also hooked by the extension. The function `fstat' now work arounds incompatibilities in DOS IOCTL interface on Windows 2000 and Windows XP, and as a result returns correct read/write permissions in `st_mode' and correct device code in `st_dev' members of `struct stat'. This was known to fail functions like `link' and programs like GNU `cp' which tested files for being on the same filesystem by calling `fstat'. The long file name support in Windows 2000 and XP have bugs which cause handles returned with long name opens to give incorrect information in many library routines. Routines which open files now open using short name calls under Windows NT, 2K and XP if long file names are enabled. The set break DPMI call under Windows 2000 and XP do not return the break point handle, which prevented debuggers using break points from working properly. The handle is now guessed for this platforms which allows the debuggers to work with hardware break points. If the short name equivalent of the current path is greater than 64 characters, Windows 2000 and XP do not return the correct long path name - they return the root directory instead without any failure code. Since this can be disastrous in deep directories doing an rm -rf, we check for this bug and fix the path. Long directories can also cause `_fixpath' to fail on Windows 9x if LFN=n and this is now handled by returning a relative path instead of root. Many uses of `_fixpath' assume absolute directories so this change may break code in rare cases (such as saving the value and changing directories). Windows 2000/XP do not return the volume labels correctly using findfirst calls so we force short name usage to fix the problem. Drives higher than Z are suppressed. `freopen' was modified to always use the same handle even if it is not the first one available. This global variable declared in `dos.h' is a faster way to get the result of `_get_dos_version(1)'. New option `-e' has been added to `djtar' to skip specified files and directories when extracting. Also `djtar' can accept multiple `-o' and `-e' options in a single command line. Finally, the file name change file format allows skipping files and directories. The function `fgetpos' will now fail, if it is unable to determine the current offset for a stream. Previously the failure would have been silently ignored. New function `_is_DOS83' added to the library to support filename case lowering. This replaces the functionality used from `_lfn_gen_short_fname' which is hopelessly buggy on Windows 2000 and XP. New function used in `srchpath.c', `readdir.c', `glob.c', `fixpath.c', `lstat.c' and `getcwd.c'. The functions `stat', `lstat' and `fstat' now fill the `st_blksize' member of `struct stat' with the correct block size for the device where the file is located. The types `blksize_t' and `blkcnt_t' were added. `blksize_t' is now used for the `st_blksize' member of `struct stat'. The build system for the C libraries was modified, so that profiling versions can be built. Profiling options in `gcc.opt' are ignored for certain files in the C libraries' sources. The build system for `emu387.dxe', the math co-processor emulation library, was also modified, so that it can be built against a profiled version of libc. Corrected problem with negative gmt offsets with z format in `strftime'. The startup code was updated, to prevent memory corruption when the `DJGPP' environment variable is not set. The functions `fstatvfs' and `statvfs' have been added. `statvfs' does much the same as `statfs', but it is POSIX-compliant. Optional support for the devices `/dev/zero' and `/dev/full' was added. This is enabled using the `__install_dev_zero' and `__install_dev_full' functions. The `mkdoc' program is used to build the C library documentation. `mkdoc' now produces portability information in a clearer manner, to avoid ambiguity. `mkdoc' also now allows multiple versions of standards to be specified in the portability information, e.g. ANSI C89 and C99. The debug support routines in `libdbg.a' now support exceptions 18 and 19 (in case the application being debugged hooks them), and no longer overwrite memory when exceptions higher than 19 are used by the debuggee. The function `fchown' was added. A bug was fixed in the File System Extensions mechanism that could be exposed in environments where it is possible to have large numbers of file descriptors (> 256) and low memory. The `errno' value is now set correctly when a file open fails due to wildcard (illegal) characters in the name. If a wildcarded name failed to match the error message was EFAULT and misleading. A bug was fixed in the function `pow' in `libm.a'. Previously `pow(x,y)' returned 0 when `x' was very close to -1.0 and `y' was very large. A bug was fixed in the function `pow' in `libc.a'. Previously `pow' may have failed for negative numbers with a large magnitude. A bug was fixed in the function `findfirst'. Previously unexpected behaviour may have resulted, if the attribute argument had a value outside the range describable by the `FA_*' constants. The function `realpath' was added. `realpath' does much the same as `_fixpath', but is POSIX compliant and resolves symlinks. The function `isblank' was added. The `int_n_cs_precedes', `int_n_sep_by_space', `int_n_sign_posn', `int_p_cs_precedes', `int_p_sep_by_space' and `int_p_sign_posn' members were added to `struct lconv', to comply with the C99 standard. The function `_Exit' was added. The function `atoll' was added. The function `strtold' was added. The behaviour of the `%X' type conversion for the `scanf'-family of functions has changed. Previously `%X' denoted a `long' version of the `%x' type conversion. Now `%X' is equivalent to the `%x' type conversion, as required by C99. The `hh', `j', `t' and `z' conversion qualifiers are now supported by `_doprnt', `_doscan', the `printf' family of functions and the `scanf' family of functions. The `delay' function now works on Windows 2000 and XP. However, the accuracy in the delay is limited, by the timing method it has to use on Windows 2000 and XP. The functions `imaxabs', `imaxdiv', `strtoimax' and `strtoumax' were added. The `PRI' and `SCN' families of macros were added. The low-level function `_put_path' was changed to retain the `/dev' prefix if a `/dev' directory exists on the disk. This allows DJGPP images to work with directories by this name. You should avoid using the `/dev' prefix on DOS device names if possible since the behavior will change if the directory exists (and file operations which use the name will be slower). You should avoid using a `/dev' directory to avoid conflicts. Fix caching when environment variable `TZ' is not set. Prevents many calls to `getenv' which are not needed. The function `strtof' was added. The functions `strlcat' and `strlcpy' were added. The mnemonic `wbinvd' has been added to `djasm'. The constants `HUGE_VALF' and `HUGE_VALL' were added. `ssize_t' was changed from an `int' to a `signed long int'. `ssize_t' is now really a signed version of `size_t'. The error code `EILSEQ' was added -- `errno' may be assigned it. `perror' and `strerror' were updated to display/return an error message for `EILSEQ'. It's possible to set stub parameters by passing `-stubparams=...' to `stubify'. Info documentation was added for `go32-v2', `stubify', `stubedit', `exe2coff', `coff2exe', `dxegen', `symify', `edebug32', and `fsdb'. The internal declaration of these two variables was moved to `crt0.S'. This change makes the new `crt0.o' incompatible with previous DJGPP releases if you accidentally link crt0 with the wrong libc. `__djgpp_ds_alias' used to be declared in the `.text' section and locked by default. It is now in `.data' and not locked. If you are referencing this value in a hardware interrupt handler, you should lock the memory area or copy it to your handler's locked memory. Added `_rdtsc' as a direct call to the hardware instruction. It will inline to a single instruction when compiled with optimization. `chmod' and `chown' can now be hooked by File System Extensions. The function `isatty' now checks whether the file descriptor passed to it is a valid. If not, it will set `errno' to `EBADF'. The function `perror' no longer prints a colon and blank if called with a null pointer or a pointer to a null string. The function `fchmod' was added. The functions `_tolower' and `_toupper' were added. The functions `readv' and `writev' were added. The function `pwrite' was added. The macro `NAN' was added. The function `fchdir' was added. This required modifications to the POSIX functions `open', `read', `write', `lseek', `ftruncate', `fstat', `select', `fsync' and `fdopen' and the ANSI functions `fopen', `freopen', `fclose', `ftell', `fseek' and `rewind', to make them aware of file descriptors for directories. *Simple temporary fix - TODO: more complete fix*: `fstat' will now use the file name used to open the file, when inventing inodes. This is done so that the same inode is generated irrespective of the actual file path used to open the file. This also fixes the problem where multiple calls to fstat on the same file descriptor would give different inodes. `stat' and `fstat' should now return the same inode for a file in most cases. New enhanced dynamic module support has been added with a Posix compliant interface. You can now create complex DXEs which depend on each other and call code from the main image. Converting libraries to standalone DXEs which can be linked via library is as simple as a single command.