From: Ben Gras Date: Tue, 18 Oct 2005 16:13:12 +0000 (+0000) Subject: Turn IPC warning messages off by default X-Git-Tag: v3.1.2a~612 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zpipe.c?a=commitdiff_plain;h=2bf8bfe126d142f3ed91057479f78cd8bb8bd5d5;p=minix.git Turn IPC warning messages off by default (because inet deadlocks are normal and will confuse our users). --- diff --git a/kernel/debug.h b/kernel/debug.h index befb677bd..c5bdb71fe 100644 --- a/kernel/debug.h +++ b/kernel/debug.h @@ -18,6 +18,17 @@ #define TIMING_CATEGORIES 20 #define TIMING_NAME 10 +/* Enable prints such as + * . send/receive failed due to deadlock or dead source or dead destination + * . trap not allowed + * . bogus message pointer + * . kernel call number not allowed by this process + * + * Of course the call still fails, but nothing is printed if these warnings + * are disabled. + */ +#define DEBUG_ENABLE_IPC_WARNINGS 0 + /* Definition of the data structure to store lock() timing data. */ struct lock_timingdata { char names[TIMING_NAME]; diff --git a/kernel/proc.c b/kernel/proc.c index 11e1b01f8..1a050d74a 100755 --- a/kernel/proc.c +++ b/kernel/proc.c @@ -111,21 +111,27 @@ message *m_ptr; /* pointer to message in the caller's space */ if (! (priv(caller_ptr)->s_trap_mask & (1 << function)) || (iskerneln(src_dst) && function != SENDREC && function != RECEIVE)) { +#if DEBUG_ENABLE_IPC_WARNINGS kprintf("sys_call: trap %d not allowed, caller %d, src_dst %d\n", function, proc_nr(caller_ptr), src_dst); +#endif return(ECALLDENIED); /* trap denied by mask or kernel */ } /* Require a valid source and/ or destination process, unless echoing. */ if (src_dst != ANY && function != ECHO) { if (! isokprocn(src_dst)) { +#if DEBUG_ENABLE_IPC_WARNINGS kprintf("sys_call: invalid src_dst, src_dst %d, caller %d\n", src_dst, proc_nr(caller_ptr)); +#endif return(EBADSRCDST); /* invalid process number */ } if (isemptyn(src_dst)) { +#if DEBUG_ENABLE_IPC_WARNINGS kprintf("sys_call: dead src_dst; trap %d, from %d, to %d\n", function, proc_nr(caller_ptr), src_dst); +#endif return(EDEADSRCDST); } } @@ -141,8 +147,10 @@ message *m_ptr; /* pointer to message in the caller's space */ if (vlo < caller_ptr->p_memmap[D].mem_vir || vlo > vhi || vhi >= caller_ptr->p_memmap[S].mem_vir + caller_ptr->p_memmap[S].mem_len) { +#if DEBUG_ENABLE_IPC_WARNINGS kprintf("sys_call: invalid message pointer, trap %d, caller %d\n", function, proc_nr(caller_ptr)); +#endif return(EFAULT); /* invalid message pointer */ } } @@ -152,8 +160,10 @@ message *m_ptr; /* pointer to message in the caller's space */ */ if (function & CHECK_DST) { if (! get_sys_bit(priv(caller_ptr)->s_ipc_to, nr_to_id(src_dst))) { +#if DEBUG_ENABLE_IPC_WARNINGS kprintf("sys_call: ipc mask denied trap %d from %d to %d\n", function, proc_nr(caller_ptr), src_dst); +#endif return(ECALLDENIED); /* call denied by ipc mask */ } } @@ -161,8 +171,10 @@ message *m_ptr; /* pointer to message in the caller's space */ /* Check for a possible deadlock for blocking SEND(REC) and RECEIVE. */ if (function & CHECK_DEADLOCK) { if (group_size = deadlock(function, caller_ptr, src_dst)) { +#if DEBUG_ENABLE_IPC_WARNINGS kprintf("sys_call: trap %d from %d to %d deadlocked, group size %d\n", function, proc_nr(caller_ptr), src_dst, group_size); +#endif return(ELOCKED); } } diff --git a/kernel/system.c b/kernel/system.c index a413bac82..feafef001 100755 --- a/kernel/system.c +++ b/kernel/system.c @@ -77,10 +77,14 @@ PUBLIC void sys_task() /* See if the caller made a valid request and try to handle it. */ if (! (priv(caller_ptr)->s_call_mask & (1<= NR_SYS_CALLS) { /* check call number */ +#if DEBUG_ENABLE_IPC_WARNINGS kprintf("SYSTEM: illegal request %d from %d.\n", call_nr,m.m_source); +#endif result = EBADREQUEST; /* illegal message type */ } else {