kernel: kill proc with bogus ipc address
[minix.git] / kernel / system / do_profbuf.c
blobe82f500f6b18cf4f0b5e7de79d4d2ffbd5edc22a
1 /* The kernel call that is implemented in this file:
2 * m_type: SYS_PROFBUF
4 * The parameters for this kernel call are:
5 * m7_p1: PROF_CTL_PTR (location of control struct)
6 * m7_p2: PROF_MEM_PTR (location of profiling table)
8 * Changes:
9 * 14 Aug, 2006 Created (Rogier Meurs)
12 #include "kernel/system.h"
14 #if CPROFILE
16 /*===========================================================================*
17 * do_profbuf *
18 *===========================================================================*/
19 int do_profbuf(struct proc * caller, message * m_ptr)
21 /* This kernel call is used by profiled system processes when Call
22 * Profiling is enabled. It is called on the first execution of procentry.
23 * By means of this kernel call, the profiled processes inform the kernel
24 * about the location of their profiling table and the control structure
25 * which is used to enable the kernel to have the tables cleared.
26 */
27 int proc_nr;
28 struct proc *rp;
30 /* Store process name, control struct, table locations. */
31 if(!isokendpt(caller->p_endpoint, &proc_nr))
32 return EDEADSRCDST;
34 if(cprof_procs_no >= NR_SYS_PROCS)
35 return ENOSPC;
37 rp = proc_addr(proc_nr);
39 cprof_proc_info[cprof_procs_no].endpt = caller->p_endpoint;
40 cprof_proc_info[cprof_procs_no].name = rp->p_name;
42 cprof_proc_info[cprof_procs_no].ctl_v = (vir_bytes) m_ptr->PROF_CTL_PTR;
43 cprof_proc_info[cprof_procs_no].buf_v = (vir_bytes) m_ptr->PROF_MEM_PTR;
45 cprof_procs_no++;
47 return OK;
50 #endif /* CPROFILE */