2 * support/nfs/closeall.c
3 * Close all file descriptors greater than some limit,
4 * Use readdir "/proc/self/fd" to avoid excess close(2) calls.
14 DIR *dir = opendir("/proc/self/fd");
19 while ((d = readdir(dir)) != NULL) {
21 long n = strtol(d->d_name, &endp, 10);
22 if (*endp != '\0' && n >= min && n != dfd)
27 int fd = sysconf(_SC_OPEN_MAX);