DCE for the HP e3000 (B3821-90002)
Programming with Kernel Threads
Reentrant Interfaces
Chapter 5
57
Reentrant Interfaces
Many /lib/libc.a (POSIX C Library) routines return pointers to internal static data. This
causes problems in a multithreaded program; while one thread tries to access the data
another thread could be modifying it in some way.
The following are interfaces that should be called by multithreaded programs. These
versions of the interfaces are different from the original versions.
The reentrant definitions currently defined in /lib/libc.a are:
In addition, the following are provided as part of /usr/lib/libdce.a on the HP 3000:
There are four reentrant routines that are not defined in the DCE/3000 header files. To
use them, add the following lines to the /usr/include/time.h file, just before the last line (#endif
/* _TIME_INCLUDED */). For example:
# ifdef _REENTRANT
extern int asctime_r(const struct tm *, char *, int);
extern int ctime_r(const time_t *, char *, int);
extern int gmtime_r(const time_t *, struct tm *);
extern int localtime_r(const time_t *, struct tm *);
# endif /* _REENTRANT */stdio Interfaces
opendir_r readdir_r getgrgid_r getgrnam_r
getpwnam_r getwpuid_r getlogin_r
asctime_r crypt_r ctime_r ecvt_r
fcvt_r gmtime_r l64a_r localtime_r