Date: Tue, 8 Jul 2014 14:52:24 -0600 From: Warner Losh <imp@bsdimp.com> To: Bryan Drewery <bdrewery@freebsd.org> Cc: arch@FreeBSD.org Subject: Re: sys/proc.h inclusion of sys/time.h Message-ID: <95BA9E14-C369-4AC3-8D8A-51F1D16720C7@bsdimp.com> In-Reply-To: <53BC4F49.7000903@FreeBSD.org>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --]
On Jul 8, 2014, at 2:06 PM, Bryan Drewery <bdrewery@freebsd.org> wrote:
> In r34924 sys/proc.h was changed to only include sys/time.h if not building in kernel.
>
> However, as the comment next to time.h says itimerval is needed.
>
> struct proc {
> ..
> struct itimerval p_realtimer; /* (c) Alarm timer. */
>
> This manifests when (hackishly) including sys/proc.h with _KERNEL defined:
>
>> In file included from /root/svn/base/usr.sbin/tcpdump/tcpdump/../../../contrib/tcpdump/print-pflog.c:37:
>> /usr/include/sys/proc.h:524:19: error: field has incomplete type 'struct itimerval'
>> struct itimerval p_realtimer; /* (c) Alarm timer. */
>
> (Why am I doing this? I need PID_MAX and NO_PID for a tcpdump change I am testing that is intended for upstreaming. Perhaps I can use kern.pid_max in __FreeBSD__ and other hacks on other platforms, I have not yet decided on this.)
>
> Should we move the inclusion of sys/time.h outside of this ifdef or just add a forward declaration for struct itimerval above struct proc like many others?
In the kernel, usually we just include sys/time.h before including sys/proc.h. :) Traditionally, we haven’t included all the pre-reqs and left it to users of these files to do so. Should we change it? Not without a good reason, imho, but honestly I think any reason better than “I think it would be cool” is likely good enough these days since n^2 I/O behavior of always including all prereq files isn’t as big a deal as it once was...
We can’t do the forward struct declaration because by the time we get around to defining (not using) struct proc, its size must be known.
Warner
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - https://gpgtools.org
iQIcBAEBCgAGBQJTvFoIAAoJEGwc0Sh9sBEAs+IP/3dhH3seZ9b1z0yXMvUGoSna
rpSslDLjKbtTdPELjbSwv2EmsCXEwUZpO+Ca0m9KpRwlhiaDr4qDOJ3vKAMthNOD
L/gP9+n/D2mxAPZtzjsM2XDF8ualHnk22oJzxS3uKYEx0WNP0rT6fmHylGh9vT5v
LUBasU7lUQltshTUoIdmBRQ9ZfNNhRKCxCwxRa268KixDAiKrstwBl1Ulq7RFFkq
/FlJIEj/hmmYPrrMkB4d+8AtacmQUN6rASi84QYNSiDghTjNZj/Ojps06mQ/iNBZ
tODE1E1YiXkWj3uzj+Fgg5qCj0gq+Jfs4iGBbyMxz0dIvnSep6IcEeQsljzdPDEs
SkV0RRcwyrXba85lhFsyKXt7dngoxQteKjcyIbUg5UN5VotRAlDXBTPljIb0uDCy
iOHYin82H5VpW5/9ZJAHGc7s4VwozOkjeFItCekr3mx1S5RHXLciyhflllTdNmmP
NNEEJvfGuMxqwcgiV31nv77m4TbTpztPo9p72sqL5P7SVtGEoRRDi38R437yzgwj
DfQVY7RXdJ0mWE9Y0OHPdjyrccARXRr3s5Ap/EgjPgMlAHgHVVXy5hfSViqAo54R
iPNKMmFszpS7NzTOvkI/4ffrLOXxI3SYowkpKKmQJIuHlUsSMjS0GeqOYTqqkSJr
T8FWawk4An8klEumyMMy
=ax4H
-----END PGP SIGNATURE-----
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?95BA9E14-C369-4AC3-8D8A-51F1D16720C7>
