Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX 11i Version 3 Release Notes: HP 9000 and HP Integrity Servers > Chapter 10 Libraries and Programming

HP-UX C library (libc) - Other Changes

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

The C library, libc, implements a set of commonly used functions. It also provides the interface between the user program and the kernel.

Summary of Change

What’s New for Customers Migrating from HP-UX 11i v1 September 2005?

  • Large PID:

    libc APIs mktemp and mkstemp have been enhanced to generate unique filenames when large PID is enabled. These APIs replace the X’s in the template string passed as a parameter and use the current process ID to form a unique filename.

    Since the maximum value of PID supported prior to HP-UX 11i v3 is 30000, it was possible to accommodate the PID in the five X’s specified in the template string. When large PID support is enabled in HP-UX 11i v3 (as specified in Unix 2003 standard specifications when the PID is less than 1 billion), the number of digits in the PID will be more than 5. So, new implementations of these APIs have been provided which can support large PID values while generating unique filenames.

  • Large UNAME and HOSTNAME:

    This solution supports uname and related libc interfaces to support hostnames in excess of eight bytes. Also, this supports the expansion of MAXHOSTNAMELEN constant from 64 bytes to 256 bytes.

    The following libc APIs are modified to support large UNAME and HOSTNAME:

    • uname(): Applications which want to take advantage of large uname have to recompile with -D_HPUX_API_LEVEL=20040821. They also have to provide for increase in buffer sizes from 9 to 256 in order to take advantage of large uname.

    • gethostname(): Applications which need to take advantage of a larger hostname should make calls with a larger buffer and a bigger “size” parameter (limit increased from 9 to 256) to gethostname().

    • sethostname(): Applications which need to take advantage of a larger hostname should make calls with a larger buffer and a bigger “size” parameter (limit has increased from 9 to 256) to sethostname().

    • setuname(): All applications which uses setuname() should provide for a larger buffer (const char* name) and a bigger namelen parameter (limit increased from 9 to 256)

    Please look at the respective manpages for more details.

  • Tru64 API Migration - APIs to support migration from Tru64 to HP-UX 11i v3

    This feature provides two new APIs in the C library:

    • mvalid() - checks a given memory region for validity

    • setlinebuf() - sets the buffering attributes of a stream

    Some other Tru64 APIs will be made available in HP-UX 11i v3 as part of Unix2003 standardization. These APIs are flock, setenv, unsetenv, seteuid, setguid.

    Please look at the respective manpages for more details .

  • malloc - thread local cache enhancements

    New options allow blocks in the per thread cache to be exchanged among threads. The exchange is facilitated by a global pool of blocks. max_cache_misses and num_global_slots are new options that can be set through the environment variable _M_CACHE_OPTS.

  • Long username and groupname support in libc

    libc APIs have been enhanced to work with long (255 bytes) user and group name. libc also supports new APIs that enable the application programmer to get the current username attributes of the system.

    The system administrator may use the newly provided lugadmin command to enable long user name. The lugadmin command will update a place holder file with the newly set maximum username length. Once long username is set it cannot be disabled.

    In order to make application logic transparent to any future expansion of username length, application programmers are encouraged to use the sysconf API with the _SC_LOGIN_NAME_MAX parameter to dynamically determine the currently set username length. The sysconf API will return the currently set username/groupname length for the system.

    Following libc APIs are long username and groupname enabled

    • getpwent family

    • getgrent family

    • getuts family

    • initgroups

    • sysconf

    A new API is provided in HP-UX 11i v3, ug_display_width, providing a mechanism for applications to check the number of bytes of the username/groupname that is apt for displaying. This display length can be set system wide using the lugadmin command or for a process or set of processes using the environment variable UG_DISPLAY_WIDTH.

    More information on enabling applications for long username can be found in the white paper, “Username and groupname sizes on HP-UX,” available at http://docs.hp.com and the manpage lugadmin.

    Please refer to the respective manpages for more details.

  • Change in localtime_r() and tzset():

    The API locatime_r() returns pointer to the time structure tm and tzset() sets the external variables timezone, daylight and tzname.

    If the value of the timezone cannot be determined from the environment variable TZ or from the file /etc/default/tz, it is set to a default value of EST5EDT. If the timezone is set to the default value of EST5EDT and the timezone adjustment file (/usr/lib/tztab) is not available, then localtime_r() and tzset() return values are as follows:

    localtime_r() returns Coordinated Universal Time (UTC) in the time structure tm and tzset() sets tzname, timezone and daylight according to Coordinated Universal Time (UTC) timezone.

    Please refer the manual page of localtime_r(3C) and tzset(3C) for more details.

What’s New for Customers Migrating from HP-UX 11i v2 June 2006?

  • Tru64 API Migration - Two new APIs to support migration from Tru64 onto HP-UX HP-UX 11i v3. Compared to HP-UX 11i v2, this feature provides the following two new APIs in C library to make use by other applications:

    • mvalid() - check memory region for validity

    • setlinebuf() - assign buffering to a stream.

  • Some other Tru64 APIs will be made available in HP-UX 11i v3 as part of Unix2003 standardization. These APIs are flock, setenv, unsetenv, seteuid and setguid.
    Please refer to the respective manpages for more details.

  • malloc - thread local cache enhancements

    New options allow blocks in the per thread cache to be exchanged among threads. The exchange is facilitated by a global pool of blocks. max_cache_misses and num_global_slots are new options that can be set through the environment variable _M_CACHE_OPTS.

  • Long username and groupname support in libc

    libc APIs have been enhanced to work with long (255 bytes) user and group name. libc also supports new APIs that enable the application programmer to get the current username attributes of the system.

    The system administrator may use the newly provided lugadmin command to enable long user name. The lugadmin command will update a place holder file with the newly set maximum username length. Once long username is set it cannot be disabled.

    In order to make application logic transparent to any future expansion of username length, application programmers are encouraged to use the sysconf API with the _SC_LOGIN_NAME_MAX parameter to dynamically determine the currently set username length. The sysconf API will return the currently set username/groupname length for the system.

    Following libc APIs are long username and groupname enabled

    • getpwent family

    • getgrent family

    • getuts family

    • initgroups

    • sysconf

    A new API is provided in HP-UX 11i v3, ug_display_width, providing a mechanism for applications to check the number of bytes of the username/groupname that is apt for displaying. This display length can be set system wide using the lugadmin command or for a process or set of processes using the environment variable UG_DISPLAY_WIDTH.

    Please refer to the respective manpages for more details.

    More information on enabling applications for long username can be found in the white paper, “Username and groupname sizes on HP-UX,” available at http://docs.hp.com and the manpage lugadmin(1M).

  • Change in localtime_r() and tzset():

    The API locatime_r() returns pointer to the time structure tm and tzset() sets the external variables timezone, daylight and tzname.

    If the value of the timezone cannot be determined from the environment variable TZ or from the file /etc/default/tz, it is set to a default value of EST5EDT. If the timezone is set to the default value of EST5EDT and the timezone adjustment file (/usr/lib/tztab) is not available, then localtime_r() and tzset() return values are as follows:

    localtime_r() returns Coordinated Universal Time (UTC) in the time structure tm and tzset() sets tzname, timezone and daylight according to Coordinated Universal Time (UTC) timezone.

    Please refer the manual page of localtime_r(3C) and tzset(3C) for more details.

Impact

The following APIs are impacted by the above change in localtime_r() and tzset():

Applications using localtime_r() or tzset() or any of the above mentioned API’s will be impacted, if the default timezone value of EST5EDT could not be read from the timezone adjustment file (/usr/lib/tztab).

Compatibility

  • Large PID:

    When Large PID is enabled, these APIs will always guarantee to return a unique filename. However, if the application expects the PID value in the unique filename returned by these APIs, it is not guaranteed. (Example: Applications which parse the PID from the filename.)

  • Large UNAME and HOSTNAME:

    This feature enables the customer requirement of establishing host naming conventions using more characters. Applications which have not been upgraded to use the expanded uname and/or hostname will continue to run without any problems as long as the system administrator does not assign a uname/nodename in excess of 8 bytes or a hostname in excess of 64 bytes.

  • Change in localtime_r() and tzset():

    If the value of the timezone cannot not be determined from the environment variable TZ or from the file /etc/default/tz, the default timezone is set to EST5EDT. In 11iv1 and 11iv2, if this default timezone value could not be read from the timezone adjustment file (/usr/lib/tztab), localtime_r() returns EST5EDT in time structure tm and tzset() sets tzname, timezone and daylight according to EST5EDT timezone.In 11i v3 if default timezone value of EST5EDT could not be read from the timezone adjustment file (/usr/lib/tztab), localtime_r() will return Coordinated Universal Time (UTC) in the time structure tm and tzset() will set tzname, timezone and daylight according to the Coordinated Universal Time (UTC) timezone.Some of the scenarios wherein libc cannot read timezone adjustment file (/usr/lib/tztab) are listed below:-1. In a HP-UX 11i Security Containment-enabled environment, a process can be blocked access to the timezone adjustment file (/usr/lib/tztab).2. When /usr is not mounted. (Ex.: In single user mode)3. When the timezone adjustment file (/usr/lib/tztab) is missing or corrupt.4. In “Change Root Directory” environment chroot(1m), if the new root does not have the timezone adjustment file (/usr/lib/tztab).In earlier releases in the above mentioned scenarios, if a user had set the timezone to a value having Day Light Saving (DST) Component and if libc could not read that timezone from the timezone adjustment file (/usr/lib/tztab), then the user would not be served in the requested timezone. It would be served based on the timezone EST5EDT.In the same scenario, now a user will get time served in Cordinated Universal time (UTC) if libc cannot read timezone EST5EDT from the timezone adjustment file (/usr/lib/tztab).

Performance

The new options max_cache_misses and num_global_slots can be used to tune the malloc thread local cache to improve the performance of certain multi-threaded applications. By allowing exchange of cached blocks among threads, these options allow malloc and free to be handled in a more efficient way.

There is no direct impact on performance from the other changes in libc.

Documentation

Manpages:

White Paper:

Obsolescence

Not applicable.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 2006-2007 Hewlett-Packard Development Company, L.P.