Re: older kernels + new glibc?

From: DervishD
Date: Tue Mar 30 2004 - 12:17:25 EST


Hi Richard :)

* Richard B. Johnson <root@xxxxxxxxxxxxxxxxxx> dixit:
[Kernel-related userspace tools]
> That's why you should use an 'include' search path on the
> compiler command line when you are compiling these. The search
> path should point to the kernel headers of the version you
> intend to use. The kernel tries to remain compatible, but
> when you access internal structures, compatibility may be lost.

So, as a rule of thumb, anytime I compile or install such
programs, I should set an include search path for them.

> > If I've understood correctly, these tools (like hdparm) should
> > *not* use current (running) kernel headers, but those that were in
> > use when glibc was built, am I right? Which, BTW, is a big problem
> > because I don't have the slightest idea about which kernel was in use
> > when I built my glibc.
> Yes. One can usually 'trust' a distribution and use whatever they
> shipped.

I don't use a distro, I have a do-it-yourself linux box, part of
it is from an old Debian 1.3.1, but most of it is hand-made. I
compile my own kernel-related tools. I suppose that, for each package
I install that may be kernel-related, I should do 'grep "<linux/"'
just in case...

> > But putting under /usr/include/linux and /usr/include/asm the
> > headers in use when glibc is built can lead to a problem, too.
> > Imagine that at some point in the future, the contents of the asm or
> > linux dirs depends on which facilities the kernel has configured
> > e.g. no scsi.h if no scsi support is present in the configured
> > kernel. That way, you don't have scsi.h under your
> > /usr/include/linux, but you may need it if you add an SCSI card with
> > your running kernel and want to compile some 'scsiutils' or whatever
> > like that.
> No. User-mode programs must never, never, never, ever include
> kernel headers directly. Instead, if they are for kernel utilities,
> the include search-path must be explicitly set.

Nice. But I don't feel it is current practice... For example,
hdparm doesn't set such include search path, iproute2 does but
modutils (up to 2.4.27, AFAIK) doesn't... I don't know many more
examples, so I may well be wrong.

Raúl Núñez de Arenas Coronado

--
Linux Registered User 88736
http://www.pleyades.net & http://raul.pleyades.net/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/