int dirfd (DIR *dir_p) { int fd = DIR_TO_FD (dir_p); if (fd == -1) errno = ENOTSUP; return fd; }
int dirfd (DIR *dir_p) { int fd = DIR_TO_FD (dir_p); if (fd == -1) #ifndef __KLIBC__ errno = ENOTSUP; #else { struct dirp_fd_list *dirp_fd; for (dirp_fd = dirp_fd_start; dirp_fd; dirp_fd = dirp_fd->next) if (dirp_fd->dirp == dir_p) return dirp_fd->fd; errno = EINVAL; } #endif return fd; }
int dirfd (DIR const *dir_p) { return DIR_TO_FD (dir_p); }