Skip to Main Content
Hands-On System Programming with Linux
book

Hands-On System Programming with Linux

by Kaiwan N. Billimoria, Tigran Aivazian
October 2018
Beginner content levelBeginner
794 pages
19h 23m
English
Packt Publishing
Content preview from Hands-On System Programming with Linux

Refactoring glibc APIs from foo to foo_r

Of course, today, with MT applications being the de facto reality, what do we do? The glibc maintainers understand these issues, and have used precisely the refactoring techniques passing additional parameters to avoid the usage of global and/or static variables (like we did previous with our ch16/mt_iobuf_rfct.c code), including using parameters as return values—to refactor standard glibc functions to become thread-safe. The glibc naming convention is if the older function is named foo, the refactored, usually reentrant- and thread-safe, version is named foo_r.

To help lend clarity to this discussion, let's take an example of a glibc API that has both the older foo and the newer foo_r functionality. ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Linux System Programming Techniques

Linux System Programming Techniques

Jack-Benny Persson
Linux Device Drivers, Second Edition

Linux Device Drivers, Second Edition

Jonathan Corbet, Alessandro Rubini

Publisher Resources

ISBN: 9781788998475Supplemental Content