qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v4 04/19] bsd-user: Clean up includes


From: Peter Maydell
Subject: Re: [PATCH v4 04/19] bsd-user: Clean up includes
Date: Fri, 27 Jan 2023 14:54:30 +0000

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]