Skip site navigation (1)Skip section navigation (2)
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>
References:  <53BC4F49.7000903@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--Apple-Mail=_81E8B3CF-17C0-480A-B843-FAF9043D41F8
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=windows-1252


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.
>=20
> However, as the comment next to time.h says itimerval is needed.
>=20
> struct proc {
> ..
> struct itimerval p_realtimer;   /* (c) Alarm timer. */
>=20
> This manifests when (hackishly) including sys/proc.h with _KERNEL =
defined:
>=20
>> In file included from =
/root/svn/base/usr.sbin/tcpdump/tcpdump/../../../contrib/tcpdump/print-pfl=
og.c:37:
>> /usr/include/sys/proc.h:524:19: error: field has incomplete type =
'struct itimerval'
>>        struct itimerval p_realtimer;   /* (c) Alarm timer. */
>=20
> (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.)
>=20
> 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=92t 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 =
=93I think it would be cool=94 is likely good enough these days since =
n^2 I/O behavior of always including all prereq files isn=92t as big a =
deal as it once was...

We can=92t do the forward struct declaration because by the time we get =
around to defining (not using) struct proc, its size must be known.

Warner


--Apple-Mail=_81E8B3CF-17C0-480A-B843-FAF9043D41F8
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP using GPGMail

-----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-----

--Apple-Mail=_81E8B3CF-17C0-480A-B843-FAF9043D41F8--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?95BA9E14-C369-4AC3-8D8A-51F1D16720C7>