svn commit: r214125 - head/sys/kern

Xin LI delphij at delphij.net
Thu Oct 21 19:08:29 UTC 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 10/21/10 04:46, John Baldwin wrote:
> On Thursday, October 21, 2010 4:57:25 am Xin LI wrote:
>> Author: delphij
>> Date: Thu Oct 21 08:57:25 2010
>> New Revision: 214125
>> URL: http://svn.freebsd.org/changeset/base/214125
>>
>> Log:
>>   In syscall_module_handler(): all switch branches return, remove
>>   unreached code as pointed out in a Chinese forum [1].
>>   
>>   [1] http://www.freebsdchina.org/forum/viewtopic.php?t=50619
>>   
>>   Pointed out by:		btw616 <btw s qq com>
>>   MFC after:		1 month
> 
> I think this exposes a bug though in that the default case doesn't pass 
> through to chainevh.  The default case should look more like the removed code 
> (except returning EOPNOTSUPP instead of 0 if there is no chainevh).

Hmm...  It sounds reasonable in theory (so that modules can handle
events other than MOD_LOAD/UNLOAD) at least, while I don't think it's
really being used anywhere.

Will the attached patch look reasonable?  (If data->chainevh is NULL
then operation is not supported, if not then delegate to the module).

Cheers,
- -- 
Xin LI <delphij at delphij.net>	http://www.delphij.net/
FreeBSD - The Power to Serve!	       Live free or die
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (FreeBSD)

iQEcBAEBCAAGBQJMwI+cAAoJEATO+BI/yjfBADUH/21dtdgSziij8hNi8ef5xOZH
QMbGRoHNUREVfuAnAevGNDotSonaRv+VEs5k9raRqqYFdtst6KzNjVQuumJsskmq
+6j7rSPXQvAmgEf6JgEZmjU/WzRbs4lozMjUOx0TW6ZSTtiXq+PSvmMe7q9iydiT
YKOj8E/itVFjKY2qMGNkAQ893qzIWvptDR9QGJP+m+8usTnYvAlk8vQw3XhfR/ws
MNE726rDNwD2sblH2IZI0dt/xy8i6mD5Ef1aM4KEkeussBjGlLAktSS6qFB71lql
JpGC9SCelhJRci6gLTvAbAyIe9hoFf8C7P+AbFXgVNMQxYWIHSzQr5BktwxSpc0=
=C6jc
-----END PGP SIGNATURE-----
-------------- next part --------------
Index: sys/kern/kern_syscalls.c
===================================================================
--- sys/kern/kern_syscalls.c	(revision 214146)
+++ sys/kern/kern_syscalls.c	(working copy)
@@ -181,7 +181,9 @@
 		error = syscall_deregister(data->offset, &data->old_sysent);
 		return (error);
 	default:
-		return EOPNOTSUPP;
+		if (data->chainevh)
+			return (data->chainevh(mod, what, data->chainarg));
+		return (EOPNOTSUPP);
 	}
 
 	/* NOTREACHED */


More information about the svn-src-all mailing list