#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];
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);
}
}
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 */
}
}
*/
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 */
}
}
/* 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);
}
}
/* See if the caller made a valid request and try to handle it. */
if (! (priv(caller_ptr)->s_call_mask & (1<<call_nr)) &&
m.m_type != SYS_IOPENABLE ) {
+#if DEBUG_ENABLE_IPC_WARNINGS
kprintf("SYSTEM: request %d from %d denied.\n", call_nr,m.m_source);
+#endif
result = ECALLDENIED; /* illegal message type */
} else if (call_nr >= 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 {