xref: /netbsd/sys/external/bsd/sljit/sljit/sljit_mod.c (revision 0bd2dd82)
1*0bd2dd82Salnsn /*	$NetBSD: sljit_mod.c,v 1.3 2014/07/26 21:07:45 alnsn Exp $	*/
21d5564efSchristos 
31d5564efSchristos /*-
41d5564efSchristos  * Copyright (c) 2012 The NetBSD Foundation, Inc.
51d5564efSchristos  * All rights reserved.
61d5564efSchristos  *
71d5564efSchristos  * Redistribution and use in source and binary forms, with or without
81d5564efSchristos  * modification, are permitted provided that the following conditions
91d5564efSchristos  * are met:
101d5564efSchristos  * 1. Redistributions of source code must retain the above copyright
111d5564efSchristos  *    notice, this list of conditions and the following disclaimer.
121d5564efSchristos  * 2. Redistributions in binary form must reproduce the above copyright
131d5564efSchristos  *    notice, this list of conditions and the following disclaimer in the
141d5564efSchristos  *    documentation and/or other materials provided with the distribution.
151d5564efSchristos  *
161d5564efSchristos  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
171d5564efSchristos  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
181d5564efSchristos  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
191d5564efSchristos  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
201d5564efSchristos  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
211d5564efSchristos  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
221d5564efSchristos  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
231d5564efSchristos  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
241d5564efSchristos  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
251d5564efSchristos  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
261d5564efSchristos  * POSSIBILITY OF SUCH DAMAGE.
271d5564efSchristos  */
281d5564efSchristos 
291d5564efSchristos #include <sys/cdefs.h>
30*0bd2dd82Salnsn __KERNEL_RCSID(0, "$NetBSD: sljit_mod.c,v 1.3 2014/07/26 21:07:45 alnsn Exp $");
311d5564efSchristos 
321d5564efSchristos #include <sys/param.h>
331d5564efSchristos #include <sys/kernel.h>
341d5564efSchristos #include <sys/module.h>
35d750a6a7Salnsn #include <sys/mutex.h>
361d5564efSchristos 
MODULE(MODULE_CLASS_MISC,sljit,NULL)371d5564efSchristos MODULE(MODULE_CLASS_MISC, sljit, NULL)
381d5564efSchristos 
39d750a6a7Salnsn /* Used in sljitUtils.c */
40d750a6a7Salnsn kmutex_t sljit_allocator_mutex;
41d750a6a7Salnsn kmutex_t sljit_global_mutex;
421d5564efSchristos 
431d5564efSchristos static int
441d5564efSchristos sljit_modcmd(modcmd_t cmd, void *arg)
451d5564efSchristos {
461d5564efSchristos 
471d5564efSchristos 	switch (cmd) {
481d5564efSchristos 	case MODULE_CMD_INIT:
49d750a6a7Salnsn 		mutex_init(&sljit_allocator_mutex, MUTEX_DEFAULT, IPL_NONE);
50d750a6a7Salnsn 		mutex_init(&sljit_global_mutex, MUTEX_DEFAULT, IPL_NONE);
511d5564efSchristos 		return 0;
521d5564efSchristos 
531d5564efSchristos 	case MODULE_CMD_FINI:
541d5564efSchristos 		return EOPNOTSUPP;
551d5564efSchristos 
561d5564efSchristos 	default:
571d5564efSchristos 		return ENOTTY;
581d5564efSchristos 	}
591d5564efSchristos }
60