char * asctime(const struct tm *timeptr) { static char result[MAX_ASCTIME_BUF_SIZE]; _THREAD_PRIVATE_KEY(asctime); char *resultp = (char *)_THREAD_PRIVATE(asctime, result, NULL); if (resultp == NULL) return NULL; else return asctime3(timeptr, resultp, sizeof(result)); }
char * getlogin(void) { _THREAD_PRIVATE_KEY(getlogin); char * name = (char *)_THREAD_PRIVATE(getlogin, logname, NULL); if ((errno = getlogin_r(name, sizeof logname)) != 0) return NULL; if (*name == '\0') { errno = ENOENT; /* well? */ return NULL; } return name; }
char * ttyname(int fd) { _THREAD_PRIVATE_KEY(ttyname); char * bufp = (char*) _THREAD_PRIVATE(ttyname, buf, NULL); int err; if (bufp == NULL) return NULL; err = ttyname_r(fd, bufp, sizeof buf); if (err) { errno = err; return NULL; } else return bufp; }