e3c4d44886
The PaX team started constifying `struct ctl_table` as of their Linux 3.8.0 patchset. This lead to zfsonlinux/spl#225 and Gentoo bug #463012. While investigating our options, I learned that there is a preprocessor directive called CONSTIFY_PLUGIN that we can use to detect the presence of the PaX changes and adjust the code accordingly. The PaX Team had suggested adopting ctl_table_no_const, but supporting older kernels required declaring that whenever the CONSTIFY_PLUGIN was set. Future compiler changes could potentially cause that to break in the presence of -Werror, so instead we define our own spl_ctl_table typdef and use that. This should be compatible with all PaX kernels. This introduces a Linux kernel version number check to prevent a build failure on versions of the PaX GCC plugin that existed for kernels before Linux 3.8.0. Affected versions of the PaX plugin will trigger a compiler error when they see no_const cast on a non-constified structure. Ordinarily, we would need an autotools check to catch that. However, it is safe to do a kernel version check instead of an autotools check in this specific instance because the affected versions of the PaX GCC plugin only exist for Linux kernels before 3.8.0 and the constification of `struct ctl_table` by the PaX developers only occurs in Linux 3.8.0 and later. Signed-off-by: Richard Yao <ryao@gentoo.org> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #225 |
||
---|---|---|
.. | ||
Makefile.in | ||
spl-atomic.c | ||
spl-condvar.c | ||
spl-cred.c | ||
spl-debug.c | ||
spl-err.c | ||
spl-generic.c | ||
spl-kmem.c | ||
spl-kobj.c | ||
spl-kstat.c | ||
spl-mutex.c | ||
spl-proc.c | ||
spl-rwlock.c | ||
spl-taskq.c | ||
spl-thread.c | ||
spl-time.c | ||
spl-tsd.c | ||
spl-vnode.c | ||
spl-xdr.c | ||
spl-zlib.c |