What’s new in the core C, math, and thread libraries for Red Hat Enterprise Linux 7?
With the recent release of Red Hat Enterprise Linux 7, we have some great new features to pass along. In this post we walk through the core C, math, and thread libraries and see what is new for developers.
The GNU C Library
The GNU C Library, or “glibc” as we like to call it, is a core component of Red Hat Enterprise Linux 7 and provides several key OS components including the core ISO C functionality (including the math library), and both BSD and POSIX APIs (including the thread library). The project provides the vast majority of the low-level interfaces that developers use day in and day out with the Linux kernel. You might expect that not much would change, but actually Red Hat Enterprise Linux 7 glibc introduces a large number of changes and improvements. In this article we’ll walk through these.
Everything you need to grow your career.
With your free Red Hat Developer program membership, unlock our library of cheat sheets and ebooks on next-generation application development.SIGN UP
New standards support, new interfaces, bugfixes galore
Since Red Hat Enterprise Linux 6 we have seen the release of a new version of ISO C i.e. ISO C11 or ISO/IEC 9899:2011, and several revisions of POSIX, with Issue 7 being the latest. Red Hat and the glibc upstream community have been tracking the standards and implementing new support in glibc for developers. However, it’s not just POSIX and ISO C that are changing, the Linux kernel is also continually adding new interfaces, which in turn are exposed by glibc for use by developers. So as you can see we’ve been busy with new features – and we’ve been fixing plenty of bugs, too. Without further ado, here is a boiled down list of the cool new things developers can do with Red Hat Enterprise Linux 7’s glibc.
- Experiment with initial ISO C11 support and start using new C11 features as they become available.
- Use new Linux system calls including prlimit, prlimit64, fanotify_init, fanotify_mark, clock_adjtime, name_to_handle_at, open_by_handle_at, syncfs, setns, sendmmsg, process_vm_readv, and process_vm_writev.
- Use new glibc functions scandirat and scandirat64 for scanning directories relative to a specified file descriptor instead of relative to the current working directory.
- Use the new glibc function secure_getenv to enable secure access to the application’s environment, particularly useful for applications which are SUID or SGID.
- Use the new glibc function getauxval and new header <sys/auxv.h> to easily access to the AT_* key-value pairs passed from the Linux kernel. The header also defines the HWCAP_* bits associated with the AT_HWCAP key allowing the application to examine in detail which processor capabilities are enabled. The entire auxiliary vector can be shown on the command line by the dynamic loader by setting the LD_SHOW_AUXVAL environment variable to one or your application like this `LD_SHOW_AUXVAL=1 <application>`.
- A new class of installed header has been documented for low-level platform-specific functionality. PowerPC added the first instance with a function to provide time base register access via <sys/platform/ppc.h> (provides all platform functionality) by calling __ppc_get_timebase to read the time base register.
- The crypt function has been made FIPS-aware; restricting the allowed cryptographic hashes if you boot your system in FIPS mode.
- All of the clock_* suite of functions, as declared in <time.h>, are now directly available from the core C library without the need to link with -lrt. Single-threaded programs using the clock_* suite of functions, and not linked with -lrt, will no longer implicitly load the POSIX threads library at runtime (required for other functionality enabled by -lrt) and so will not suffer the overhead associated with thread support in other libraries like the C++ runtime library.
- Use _FORTIFY_SOURCE and in addition to all the other robust checking functions get additional checking for FD_SET, FD_CLR, FD_ISSET, poll and ppoll.
- Enable caching of netgroups in the Name Service Cache Daemon (nscd). Red Hat has done extensive work to ensure netgroups caching is as robust as all the databases. If you previously tried this feature, please try it again!
- Enjoy increased performance from optimized string functions for: x86-64 and x86 (uses SSE, SSSE3, SSE4.2, and AVX), x86; 32-bit and 64-bit POWER systems; 32-bit and 64-bit S390 systems (optimized for System z10 and zEnterprise z196).
This is just a taste of what’s new in Red Hat Enterprise Linux 7, in addition to the above changes we have new SystemTap static probes for application profiling, 5 new character encodings, 25 new localizations, and over 589 bug and security fixes. Enjoy the new features and depend on the fixes!