f78
Reentrancy is a characteristic of library functions allowing multiple processes to use the same address space with assurance that the values stored in those spaces will remain constant between calls.
Cygnus Solutions implements the library functions to ensure that, whenever possible, these library functions are reentrant.
However, there are some functions that can not be trivially made reentrant. Hooks have been provided to allow you to use these functions in a fully reentrant fashion. These hooks use the structure, _reent, defined in reent.h.
All functions which must manipulate global information are available in two versions.
For example, the function, fopen, takes two arguments, file and mode, and uses the global reentrancy structure. The function, _fopen_r, takes the argument, struct_reent, which is a pointer to an instance of the ffb reentrancy structure, file and mode.
Each function which uses the global reentrancy structure uses the global variable, _impure_ptr, which points to a reentrancy structure.
This means that you have two ways to achieve reentrancy. Both require that each thread of execution control initialize a unique global variable of type, struct _reent.
The following functions are provided in both reentrant and non-reentrant versions.
Equivalent for errno variable:
_errno_r |
_localeconv_r |
_setlocale_r |
_stdin_r |
_stdout_r |
_stderr_r |
_fdopen_r |
_mkstemp_r |
_remove_r |
_fopen_r |
_mktemp_r |
_rename_r |
_getchar_r |
_perror_r |
_tempnam_r |
_gets_r |
_putchar_r |
_tmpnam_r |
_iprintf_r | _puts_r | _tmpfile_r |
_raise_r | _signal_r |
_dtoa_r |
_realloc_r |
_strtoul_r |
_free_r |
_srand_r |
_system_r |
_malloc_r |
_strtod_r |
|
_rand_r | _strtol_r |
_strtok_r |
_close_r |
_lseek_r |
_stat_r |
_fork_r |
_open_r |
_unlink_r |
_fstat_r |
_read_r |
_wait_r |
_link_r | _sbrk_r | _write_r |
_asctime_r |