Date: Thu, 15 Nov 2007 22:28:02 GMT From: John Birrell <jb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 129106 for review Message-ID: <200711152228.lAFMS2L8021053@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=129106 Change 129106 by jb@jb_freebsd1 on 2007/11/15 22:27:10 MFC proc/thread event handler changes. Affected files ... .. //depot/projects/dtrace6/src/sys/kern/kern_proc.c#2 edit .. //depot/projects/dtrace6/src/sys/kern/kern_thread.c#4 edit .. //depot/projects/dtrace6/src/sys/sys/eventhandler.h#2 edit Differences ... ==== //depot/projects/dtrace6/src/sys/kern/kern_proc.c#2 (text+ko) ==== @@ -54,6 +54,7 @@ #include <sys/user.h> #include <sys/jail.h> #include <sys/vnode.h> +#include <sys/eventhandler.h> #ifdef KTRACE #include <sys/uio.h> #include <sys/ktrace.h> @@ -132,6 +133,7 @@ struct proc *p; p = (struct proc *)mem; + EVENTHANDLER_INVOKE(process_ctor, p); return (0); } @@ -167,6 +169,7 @@ */ if (((p->p_flag & P_KTHREAD) != 0) && (td->td_altkstack != 0)) vm_thread_dispose_altkstack(td); + EVENTHANDLER_INVOKE(process_dtor, p); } /* @@ -185,6 +188,7 @@ kg = ksegrp_alloc(); bzero(&p->p_mtx, sizeof(struct mtx)); mtx_init(&p->p_mtx, "process lock", NULL, MTX_DEF | MTX_DUPOK); + EVENTHANDLER_INVOKE(process_init, p); p->p_stats = pstats_alloc(); proc_linkup(p, kg, td); sched_newproc(p, kg, td); @@ -198,6 +202,7 @@ static void proc_fini(void *mem, int size) { + EVENTHANDLER_INVOKE(process_fini, p); panic("proc reclaimed"); } ==== //depot/projects/dtrace6/src/sys/kern/kern_thread.c#4 (text+ko) ==== @@ -49,6 +49,7 @@ #include <vm/vm.h> #include <vm/vm_extern.h> #include <vm/uma.h> +#include <sys/eventhandler.h> /* * KSEGRP related storage. @@ -136,6 +137,7 @@ * next thread. */ td->td_critnest = 1; + EVENTHANDLER_INVOKE(thread_ctor, td); #ifdef AUDIT audit_thread_alloc(td); @@ -176,6 +178,7 @@ #ifdef AUDIT audit_thread_free(td); #endif + EVENTHANDLER_INVOKE(thread_dtor, td); free_unr(tid_unrhdr, td->td_tid); sched_newthread(td); } @@ -194,6 +197,7 @@ cpu_thread_setup(td); td->td_sleepqueue = sleepq_alloc(); td->td_turnstile = turnstile_alloc(); + EVENTHANDLER_INVOKE(thread_init, td); td->td_umtxq = umtxq_alloc(); td->td_sched = (struct td_sched *)&td[1]; sched_newthread(td); @@ -209,6 +213,7 @@ struct thread *td; td = (struct thread *)mem; + EVENTHANDLER_INVOKE(thread_fini, td); turnstile_free(td->td_turnstile); sleepq_free(td->td_sleepqueue); umtxq_free(td->td_umtxq); ==== //depot/projects/dtrace6/src/sys/sys/eventhandler.h#2 (text+ko) ==== @@ -166,11 +166,28 @@ typedef void (*exitlist_fn)(void *, struct proc *); typedef void (*forklist_fn)(void *, struct proc *, struct proc *, int); typedef void (*execlist_fn)(void *, struct proc *); - +typedef void (*proc_ctor_fn)(void *, struct proc *); +typedef void (*proc_dtor_fn)(void *, struct proc *); +typedef void (*proc_init_fn)(void *, struct proc *); +typedef void (*proc_fini_fn)(void *, struct proc *); +EVENTHANDLER_DECLARE(process_ctor, proc_ctor_fn); +EVENTHANDLER_DECLARE(process_dtor, proc_dtor_fn); +EVENTHANDLER_DECLARE(process_init, proc_init_fn); +EVENTHANDLER_DECLARE(process_fini, proc_fini_fn); EVENTHANDLER_DECLARE(process_exit, exitlist_fn); EVENTHANDLER_DECLARE(process_fork, forklist_fn); EVENTHANDLER_DECLARE(process_exec, execlist_fn); +struct thread; +typedef void (*thread_ctor_fn)(void *, struct thread *); +typedef void (*thread_dtor_fn)(void *, struct thread *); +typedef void (*thread_fini_fn)(void *, struct thread *); +typedef void (*thread_init_fn)(void *, struct thread *); +EVENTHANDLER_DECLARE(thread_ctor, thread_ctor_fn); +EVENTHANDLER_DECLARE(thread_dtor, thread_dtor_fn); +EVENTHANDLER_DECLARE(thread_init, thread_init_fn); +EVENTHANDLER_DECLARE(thread_fini, thread_fini_fn); + typedef void (*uma_zone_chfn)(void *); EVENTHANDLER_DECLARE(nmbclusters_change, uma_zone_chfn); EVENTHANDLER_DECLARE(maxsockets_change, uma_zone_chfn);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200711152228.lAFMS2L8021053>