Index: getdtablecount.c =================================================================== --- getdtablecount.c (revision 290836) +++ getdtablecount.c (working copy) @@ -29,21 +29,25 @@ #include #include +#ifndef KERN_PROC_NFDS +#include +#endif #include +#include -int getdtablecount(void); - -/* - * Return the count of open file descriptors for this process. - * - */ +/* Return the count of open file descriptors for this process. */ int getdtablecount(void) { + /* + * KERN_PROC_NFDS wasn't added until r290473; we need to stub out this + * libcall in order to unbreak bootstrapping from older versions of + * FreeBSD + */ +#ifdef KERN_PROC_NFDS int mib[4]; - int error; - int nfds; size_t len; + int error, nfds; len = sizeof(nfds); mib[0] = CTL_KERN; @@ -55,4 +59,8 @@ if (error) return (-1); return (nfds); +#else + errno = ENOSYS; + return (-1); +#endif }