Subject: Re: sysctl.h is weird?
To: Charlie Allom <charlie@rubberduck.com>
From: Simon Burge <simonb@wasabisystems.com>
List: current-users
Date: 05/06/2003 17:27:30
Charlie Allom wrote:

> a few packages are a little weirded out by sysctl.h. ettercap and
> apache2 (not from pkgsrc). Can anyone tell if this is normal? (well
> ettercap built a month ago).
> 
> apache2:
> 
> checking sys/sysctl.h usability... no
> checking sys/sysctl.h presence... yes
> configure: WARNING: sys/sysctl.h: present but cannot be compiled
> configure: WARNING: sys/sysctl.h: check for missing prerequisite
> headers?
> configure: WARNING: sys/sysctl.h: proceeding with the preprocessor's
> result
> checking for sys/sysctl.h... yes
> 
> 
> ettercap:
> 
> cc  -O2 -funroll-loops -fomit-frame-pointer -Wall -I. -Isrc/include -I/usr/pkg/include -DHAVE_CONFIG_H -
DNETBSD -c -o ./src/OS/BSD/ec_inet_BSD.o ./src/OS/BSD/ec_inet_BSD.c
> In file included from /usr/include/sys/sysctl.h:48,
>                  from ./src/OS/BSD/ec_inet_BSD.c:37:
> /usr/include/sys/ucred.h:51: `NGROUPS' undeclared here (not in a function)
> /usr/include/sys/ucred.h:59: `NGROUPS' undeclared here (not in a function)
> In file included from /usr/include/sys/sysctl.h:50,
>                  from ./src/OS/BSD/ec_inet_BSD.c:37:
> /usr/include/sys/proc.h:69: `MAXLOGNAME' undeclared here (not in a function)
> /usr/include/sys/proc.h:240: `MAXCOMLEN' undeclared here (not in a function)
> /usr/include/sys/proc.h:240: size of array `p_comm' has non-integer type
> In file included from ./src/OS/BSD/ec_inet_BSD.c:37:
> /usr/include/sys/sysctl.h:323: `MAXLOGNAME' undeclared here (not in a function)
> *** Error code 1
> 
> Stop.
> make: stopped in /usr/obj/pkgsrc/net/ettercap/work.i386/ettercap-0.6.9
> *** Error code 1

The synopsis in sysctl(3) says you need:

	#include <sys/param.h>
	#include <sys/sysctl.h>

Just including <sys/sysctl.h> without <sys/param.h> gives the errors you
quote above.  I'm not sure if you can just include <sys/sysctl.h> on any
other operating systems that have that header file.  Given the way that
autoconf works, I'm not sure how to best attack this problem...

I wouldn't be against having <sys/sysctl.h> include <sys/param.h>
itself.  There's prior art for this in /usr/include.

Simon.
--
Simon Burge                            <simonb@wasabisystems.com>
NetBSD Support and Service:         http://www.wasabisystems.com/