Brian Silverman | af78486 | 2014-05-13 08:14:55 -0700 | [diff] [blame] | 1 | This directory has replacements for some libc functions that we don't want to |
| 2 | use because they're not thread-safe and/or they allocate memory. |
| 3 | |
| 4 | Some of them are implemented as C++ functions because it makes fixing the |
| 5 | memory management issues that cause the standard versions to be not thread-safe |
| 6 | possible and some of them are still callable from C when it makes sense. |
| 7 | |
| 8 | <http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_09_01> |
| 9 | has a list of the not-thread-safe POSIX functions. We've gotten rid of all of |
| 10 | those except for the following: |
| 11 | getenv(3): <http://austingroupbugs.net/view.php?id=188> proposes changing |
| 12 | POSIX to require it to return a pointer into environ, making it thread-safe, |
| 13 | which glibc already does. |
| 14 | inet_ntoa(3): Glibc uses a thread-local buffer, which makes it thread-safe, |
| 15 | and uses of this function should go away soon. |
| 16 | readdir(3): Glibc already guarantees that only invocations on the same |
| 17 | directory stream aren't thread-safe, and there's talk of changing POSIX to |
| 18 | say the same thing. |