<net/bpf.h> should include <sys/ioccom.h>
<net/bpf.h> defines ioctl codes, so it should include <sys/ioccom.h>,
so it doesn't require code that includes <net/bpf.h> to also include
<sys/ioccom.h> or a header that includes it. When I originally
created <sys/ioccom.h> in SunOS 4.0, I intended it to be included by
header files that defined ioctls, rather than by .c files.
#2 Updated by swildner over 6 years ago
Guy, thanks for clarifying,
please see http://leaf.dragonflybsd.org/~swildner/ioccom.diff, which
adjusts our code to this intention (include <sys/ioccom.h> only in
headers where ioctl codes are defined).
If no one objects, I'll commit it tomorrow or Thursday.
#3 Updated by guy over 6 years ago
On Apr 14, 2009, at 12:05 PM, Sascha Wildner (via DragonFly issue
One other thing that came to mind, though - there's no (non-obsolete)
UN*X standard for what to include to get ioctl() declared. The Single
UNIX Specification only mentions ioctl() in order to support some
STREAMS stuff, so they declared it in some STREAMS header file - not
very useful for non-STREAMS devices - and that's now obsolete in the
current SUS. I think all the BSDs say that you include <sys/ioctl.h>
to declare it (Mac OS X does).
I might be tempted to move the declaration of ioctl() to sys/ioccom.h
as well; you could then still include <sys/ioctl.h> to get it
declared, but you also get it declared if you include some header that
includes <sys/ioccom.h> and declares ioctls.
#4 Updated by swildner over 6 years ago
Guy Harris schrieb:
> I might be tempted to move the declaration of ioctl() to sys/ioccom.h
> as well; you could then still include <sys/ioctl.h> to get it
> declared, but you also get it declared if you include some header that
> includes <sys/ioccom.h> and declares ioctls.
Hmm, I just checked..
DragonFly and FreeBSD do have the ioctl() declaration in <sys/ioccom.h>
while Net and Open don't.