On FreeBSD 5.2.1, I see this compilation error:

In file included from /usr/include/sys/user.h:46,
                 from ../../gllib/vma-iter.c:63:
/usr/include/sys/ucred.h:75: error: `NGROUPS' undeclared here (not in a 
function)
In file included from /usr/include/sys/user.h:51,
                 from ../../gllib/vma-iter.c:63:
/usr/include/sys/proc.h:82: error: `MAXLOGNAME' undeclared here (not in a 
function)
/usr/include/sys/proc.h:82: error: variable-size type declared outside of any 
function
/usr/include/sys/proc.h:599: error: `MAXCOMLEN' undeclared here (not in a 
function)
gmake[4]: *** [vma-iter.o] Error 1

Apparently <sys/param.h> is a prerequisite of <sys/user.h> on this old platform.
This patch therefore fixes it.


2023-10-15  Bruno Haible  <br...@clisp.org>

        vma-iter: Fix compilation error on FreeBSD 5.2.1.
        * lib/vma-iter.c [FreeBSD]: Include <sys/param.h>.

diff --git a/lib/vma-iter.c b/lib/vma-iter.c
index 2584d5ec34..b28d21dc7a 100644
--- a/lib/vma-iter.c
+++ b/lib/vma-iter.c
@@ -60,6 +60,7 @@
 #if defined __FreeBSD__ || defined __FreeBSD_kernel__ /* FreeBSD, GNU/kFreeBSD 
*/
 # include <sys/types.h>
 # include <sys/mman.h> /* mmap, munmap */
+# include <sys/param.h> /* prerequisite of <sys/user.h> */
 # include <sys/user.h> /* struct kinfo_vmentry */
 # include <sys/sysctl.h> /* sysctl */
 #endif




Reply via email to