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.
17 DIR *dir = opendir("/proc/self/fd");
23 while ((d = readdir(dir)) != NULL) {
25 n = strtol(d->d_name, &endp, 10);
26 if (!errno && *endp == '\0' && endp != d->d_name &&
32 int fd = sysconf(_SC_OPEN_MAX);