| United States-English |
|
|
|
![]() |
HP-UX 11i Version 1.5 Release Notes: release id B.11.20for rx9610 and rx4610 hp serversand i2000 hp workstations > Chapter 7 ProgrammingChanges to libc |
|
libc.a is not available for native IPF development. Applications which explicitly link to libc.a will fail. This change affects makefile compatibility, makefiles which explicitly link to libc.a using
should be modified. The libc routines that convert between decimal strings representing floating-point numbers, and internal binary floating-point formats were changed for HP-UX 11i Version 1.5 (B.11.20). When compiled with the -fpwidetypes option, the HP-UX 11i Version 1.5 (B.11.20) <stdlib.h> header defines two new types:
quad is a synonym for long double; it is the 128-bit IEEE-754 floating type supported on PA systems. extended is the 80-bit IEEE-754 double-extended type in the Itanium architecture. The definitions, which also appear in the <math.h>, <float.h>, and <complex.h> headers, are protected by __ia64 and _INCLUDE_HPUX_SOURCE switches. To use these type names for other purposes, you should undefine them (with #undef) after inclusion of the above headers. The HP-UX 11i Version 1.5 (B.11.20) <stdlib.h> header, under the ia64 and _PROTOTYPE switches, defines the long_double type to be the true "long double" type supported by the compiler. In previous releases, long_double was defined to be a struct. A program which requires the struct definition can be compiled with the -Ac option (the default prior to HP-UX 11.0), or, alternatively, with -D_LONG_DOUBLE_STRUCT added to the compile command. The HP-UX 11i Version 1.5 (B.11.20) <stdlib.h> header, under the __ia64 and _INCLUDE_HPUX_SOURCE switches, declares the new function:
and, when compiled with the -fpwidetypes options, also declares these new functions:
all of which are defined in libc.
The routines which convert between decimal strings representing floating-point numbers and internal binary floating-point formats are correctly rounded according to the specification in ISO/IEC C99, to 36 significant decimal digits. (36 is the smallest number of digits that will distinguish all the numeric values in the 128-bit long double type.) Corresponding HP-UX 11i routines do not round correctly to the last bit or digit in all cases. The HP-UX 11i Version 1.5 (B.11.20) binary-to-decimal conversion (used by printf) produces zeros after the 36th significant digit, for all floating-point precisions; this differs from the HP-UX 11i conversion which produces zeros after the 17th significant digit in double and after the 33rd significant digit in long double. The long double strtold function for overflow cases returns the value HUGE_VALL (defined to be +infinity in <math.h>), with the appropriate sign. This follows the ISO/IEC C99 specification, and is analogous to strtod(), which returns HUGE_VAL (also equal to +infinity), with the appropriate sign. On HP-UX 11.0 and 11i, strtold() for overflow cases returns _LDBL_MAX or _LDBL_NMAX (defined in <values.h>), depending on the sign of the value; these are the largest-magnitude finite long double values. All the HP-UX 11i Version 1.5 (B.11.20) *cvt functions (double, extended, and long double) treat NaNs and infinities the same way, and that way is consistent with the HP-UX 11i double [efg]cvt functions: they return ++ and -- for +infinity and -infinity, and they return [-]? for NaNs. On HP-UX 11i, the long double _ld[efg]cvt functions return +INFINITY and -INFINITY for +infinity and -infinity, and they return [-]NaN for NaNs. In earlier versions of libc on PA, libc used a single lock in the malloc routines to make them thread-safe. In a multi-threaded application, there could be contention on this single lock if multiple threads are calling malloc and free at the same time. On HP-UX 11i Version 1.5 (B.11.20), libc provides multiple arenas, where malloc can allocate space from, and a lock for each arena. Threads are distributed among the arenas. Two new environment variables are introduced: _M_ARENA_OPTS _M_ARENA_OPTS can be used to tune the number of arenas and the arena expansion factor for threaded applications. In general, the more threads in an application, the more arenas should be used for better performance. Expansion factors control the number of pages to expand each time and assumes the page size is 4096 bytes. The number of arenas can be from 1 to 64 for threaded applications. (For non-threaded applications, only one arena is used regardless of whether this environment variable is set or not. However, you still can use this environment variable to change the expansion factor for non-threaded applications). If the environment variable is not set, or the number of arenas is set to be out of the range, the default number of 8 is used. The expansion factor is from 1 to 4096; the default value is 32. Again, if the factor is out of the range, the default value will be used. For example: $ export _M_ARENA_OPTS=8:32 where the number of arenas is 8, and the expansion size is 32*4096 bytes. In general, the more arenas you use, the smaller the expansion factor should be, and vice versa. Beginning in HP-UX 11i Version 1.5 (B.11.20), for Itanium-based systems only, the small block allocator is active by default with the following configuration: __maxfast = 512, num_smallblocks = 100, grain = 16. The default for num_smallblocks is unchanged from PA systems and the SVID 3 default. The default for grain is the default alignment for Itanium-based systems (16), which is the smallest grain allowable given that small blocks must have at least the default alignment. This requirement in turn comes from the standards requirement that malloc() must always return an address suitably aligned for any basic data type, and Itanium-based systems support 16-byte basic data types. The new default for __maxfast is 512, which is changed from 0 on PA systems. This means that the SBA is now active by default, rather than inactive by default, as was and remains the case for PA systems. Three exported integer variables have been added for IPF: int __hp_malloc_maxfast; These three variables may be set by applications to override the SBA defaults; e.g. if an application links to a module that defines int __hp_malloc_maxfast = -1; then the value -1 will be seen for __hp_malloc_maxfast when the function __get_sba_global() is called. The -1 value for __hp_malloc_maxfast means that the SBA should be turned off, i.e. __maxfast will be set to 0. A positive value for __hp_malloc_maxfast will replace the default value of __maxfast after rounding to a multiple of the grain. Positive values for the variables __hp_malloc_grain and __hp_malloc_num_smallblocks will be used to replace the grain and num_smallblocks values if the resulting values would be legal. These global variables override the environment variable _M_SBA_OPTS. It is presumed that any ISV that builds an application so that these variables are set wants that tuning and no other. However, subsequent mallopt() calls will revise the values for SBA configuration if the SBA has not yet been allocated. (In the same way that mallopt() calls will revise the SBA configuration even when the environment variable _M_SBA_OPTS has been set if the SBA has not yet been allocated at the time of the mallopt() calls.) _M_SBA_OPTS turns on the small block allocator, and sets up parameters for the small block allocator, namely, maxfast, grain, num_smallblocks. Refer to mallopt() for details about the small block allocator, and its parameters. Applications with a small block allocator turned on usually run faster than with it turned off. A small block allocator can be turned on through mallopt(); however, it is not early enough for C++/Java applications. The environment variable turns it on before the application starts. mallopt() call can still be used the same way. If the environment variable is set, and no small block allocator has been used, the subsequent mallopt() calls can still overwrite whatever is set through _M_SBA_OPTS. If the environment variable is set, and a small block allocator has been used, then mallopt() will have no effect. For example: $ export _M_SBA_OPTS=512:100:16 where the maxfast size is 512, the number of small blocks is 100, and the grain size is 16. You must supply all 3 values, and in that order. If not, the default ones will be used instead. The _M_ARENA_OPTS and _M_SBA_OPTS environment variables have the following impact:
The new API, memalign(), has been added to the malloc family. See the memalign(3C) manual page for details. HP-UX 11i Version 1.5 (B.11.20) includes an enhanced version of confstr() that defines three new parameter values.
The preferred method of calling these functions is defined in the confstr(3C) manpage as:
The first line will return the length of the string to be returned, allocate memory based on this value, then call confstr() again to get the actual value. For more information, see “Changes to Machine Identification” in Chapter 3 “HP-UX Features” and the confstr(3C) manual page. The linux compatibility interfaces, getresgid() and getresuid() have been added to libc. These functions return the real, effective, and saved gids and uids, respectively. See the getresgid(3C) and getresuid(3C) manual pages for more details. For more information about these changes, see
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||