[PATCH 5/7] Remove unused sys/param.h

Kostiantyn Kostiuk posted 7 patches 1 week ago
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Kevin Wolf <kwolf@redhat.com>
There is a newer version of this series
[PATCH 5/7] Remove unused sys/param.h
Posted by Kostiantyn Kostiuk 1 week ago
Signed-off-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
---
 util/path.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/util/path.c b/util/path.c
index 72a255890e..e1565894d2 100644
--- a/util/path.c
+++ b/util/path.c
@@ -4,7 +4,6 @@
    The assumption is that this area does not change.
 */
 #include "qemu/osdep.h"
-#include <sys/param.h>
 #include "qemu/cutils.h"
 #include "qemu/path.h"
 #include "qemu/thread.h"
-- 
2.52.0
Re: [PATCH 5/7] Remove unused sys/param.h
Posted by Peter Maydell 1 week ago
On Thu, 26 Mar 2026 at 16:02, Kostiantyn Kostiuk <kkostiuk@redhat.com> wrote:
>
> Signed-off-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
> ---
>  util/path.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/util/path.c b/util/path.c
> index 72a255890e..e1565894d2 100644
> --- a/util/path.c
> +++ b/util/path.c
> @@ -4,7 +4,6 @@
>     The assumption is that this area does not change.
>  */
>  #include "qemu/osdep.h"
> -#include <sys/param.h>
>  #include "qemu/cutils.h"
>  #include "qemu/path.h"
>  #include "qemu/thread.h"

We dropped the use of PATH_MAX in commit f3a8bdc1d5b26 (which
basically completely rewrote the path handling); I think that
was likely why we wanted param.h.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM
Re: [PATCH 5/7] Remove unused sys/param.h
Posted by Kostiantyn Kostiuk 1 week ago
Hi Peter,

This is a very old commit. I tested removing sys/param.h based on 512b794b109
(Update version for v11.0.0-rc1 release).
The full QEMU tree was compiled successfully, so I am not sure why we need
it.

Best Regards,
Kostiantyn Kostiuk.


On Thu, Mar 26, 2026 at 6:17 PM Peter Maydell <peter.maydell@linaro.org>
wrote:

> On Thu, 26 Mar 2026 at 16:02, Kostiantyn Kostiuk <kkostiuk@redhat.com>
> wrote:
> >
> > Signed-off-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
> > ---
> >  util/path.c | 1 -
> >  1 file changed, 1 deletion(-)
> >
> > diff --git a/util/path.c b/util/path.c
> > index 72a255890e..e1565894d2 100644
> > --- a/util/path.c
> > +++ b/util/path.c
> > @@ -4,7 +4,6 @@
> >     The assumption is that this area does not change.
> >  */
> >  #include "qemu/osdep.h"
> > -#include <sys/param.h>
> >  #include "qemu/cutils.h"
> >  #include "qemu/path.h"
> >  #include "qemu/thread.h"
>
> We dropped the use of PATH_MAX in commit f3a8bdc1d5b26 (which
> basically completely rewrote the path handling); I think that
> was likely why we wanted param.h.
>
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
>
> thanks
> -- PMM
>
>
Re: [PATCH 5/7] Remove unused sys/param.h
Posted by Peter Maydell 1 week ago
On Thu, 26 Mar 2026 at 16:22, Kostiantyn Kostiuk <kkostiuk@redhat.com> wrote:
>
> Hi Peter,
>
> This is a very old commit. I tested removing sys/param.h based on 512b794b109 (Update version for v11.0.0-rc1 release).
> The full QEMU tree was compiled successfully, so I am not sure why we need it.

Note that "it compiled OK" is not a 100% reliable way to
check for "do we need this include?". For historical and
backwards-compatibility reasons, the glibc headers have
various places where one header might pull in another.
The glibc developers have in the past done cleanup work where
they fix that kind of thing so you only get the function
definition when you include the header that the standards
say you need for that function; it's quite plausible they
might do that again in future. So the best approach is to
check the POSIX spec etc to see which header it says you need
to include, and include that one.

-- PMM