Re: Header files and interfaces

Theodore Y. Ts'o (tytso@mit.edu)
Tue, 23 Jun 1998 15:26:16 -0400


Date: Tue, 23 Jun 1998 08:02:54 -0400
From: Raul Miller <rdm@test.legislate.com>

There's two ways of dealing with ioctls which are present on only newer
kernels:

(a) at runtime, deal with the error that occurs when you try to run a
missing ioctl,

(b) at compile time (or design time) leave out support for such ioctls.

Most of the time (a) is a superior approach (if the ioctl had any value
at all), however (b) has a rather elegant simplicity.

Probably the best approach to (b), though, is documentation which
includes for each ioctl a bit of its history (when it first appeared,
historically similar mechanisms).

The right answer, actually, is to do both. I tend to write programs
that do both runtime and compile time checking, so that if a program is
built with a newer kernel and then run on an older kernel, so that the
program can print an understandable error message (or perhaps use a
workaround if practical) if the kernel which the program is running
under doesn't support that particular ioctl.

- Ted

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu