blob: 5bfa5edc5743afecad164f953c7701276870b95a (
plain) (
tree)
|
|
#include <sys/types.h>
#include <dirent.h>
#include "getdtablecount.h"
#ifdef __linux__
int
getdtablecount(void)
{
struct dirent *dp;
DIR *dir;
int n;
/* XXX: return something different? */
if (!(dir = opendir("/proc/self/fd")))
return 0;
n = 0;
while ((dp = readdir(dir)))
n++;
closedir(dir);
return n;
}
#else
#error getdtablecount(2) not supported
#endif
|