[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 04/19] bsd-user: Clean up includes
From: |
Michael S. Tsirkin |
Subject: |
Re: [PATCH v4 04/19] bsd-user: Clean up includes |
Date: |
Fri, 27 Jan 2023 10:01:50 -0500 |
On Fri, Jan 27, 2023 at 02:54:30PM +0000, Peter Maydell wrote:
> On Thu, 19 Jan 2023 at 14:42, Warner Losh <imp@bsdimp.com> wrote:
> >
> > Also, why didn't you move sys/resource.h and other such files
> > to os-dep.h? I'm struggling to understand the rules around what
> > is or isn't included where?
>
> The rough rule of thumb is that if some OS needs a compatibility
> fixup or workaround for a system header (eg not every mmap.h
> defines MAP_ANONYMOUS; on Windows unistd.h has to come before
> time.h) then we put that header include and the compat workaround
> into osdep.h. This avoids "only fails on obscure platform" issues
> where somebody puts a header include into some specific .c file
> but not the compat workaround, and it works on the Linux host
> that most people develop and test on and we only find the
> problem later.
>
> There's also no doubt some includes there for historical
> reasons, and some which really are "everybody needs these"
> convenience ones. But we should probably not add new
> includes to osdep.h unless they fall into the "working around
> system header issues" bucket.
>
> thanks
> -- PMM
BTW maybe we should teach checkpatch about that rule:
if a header is in osdep do not include it directly.
--
MST
- Re: [PATCH v4 03/19] scripts/clean-includes: Skip symbolic links, (continued)
- [PATCH v4 02/19] scripts/clean-includes: Don't claim duplicate headers found when not, Markus Armbruster, 2023/01/19
- [PATCH v4 04/19] bsd-user: Clean up includes, Markus Armbruster, 2023/01/19
- Re: [PATCH v4 04/19] bsd-user: Clean up includes, Peter Maydell, 2023/01/27
- Re: [PATCH v4 04/19] bsd-user: Clean up includes,
Michael S. Tsirkin <=
- Re: [PATCH v4 04/19] bsd-user: Clean up includes, Michael S. Tsirkin, 2023/01/28
- Re: [PATCH v4 04/19] bsd-user: Clean up includes, Markus Armbruster, 2023/01/30
[PATCH v4 15/19] accel: Clean up includes, Markus Armbruster, 2023/01/19
[PATCH v4 05/19] crypto: Clean up includes, Markus Armbruster, 2023/01/19
[PATCH v4 09/19] qga: Clean up includes, Markus Armbruster, 2023/01/19
[PATCH v4 18/19] 9p: Drop superfluous include of linux/limits.h, Markus Armbruster, 2023/01/19