coverity appeasement
[minix.git] / kernel / system / do_abort.c
blob8208af5248e3e7565fbec47ad5fc45dee78a4a44
1 /* The kernel call implemented in this file:
2 * m_type: SYS_ABORT
4 * The parameters for this kernel call are:
5 * m1_i1: ABRT_HOW (how to abort, possibly fetch monitor params)
6 * m1_i2: ABRT_MON_ENDPT (proc nr to get monitor params from)
7 * m1_i3: ABRT_MON_LEN (length of monitor params)
8 * m1_p1: ABRT_MON_ADDR (virtual address of params)
9 */
11 #include "kernel/system.h"
12 #include <unistd.h>
14 #if USE_ABORT
16 /*===========================================================================*
17 * do_abort *
18 *===========================================================================*/
19 int do_abort(struct proc * caller, message * m_ptr)
21 /* Handle sys_abort. MINIX is unable to continue. This can originate e.g.
22 * in the PM (normal abort) or TTY (after CTRL-ALT-DEL).
24 int how = m_ptr->ABRT_HOW;
26 /* See if the monitor is to run the specified instructions. */
27 if (how == RBT_MONITOR) {
28 int p;
29 static char paramsbuffer[512];
30 int len;
31 len = MIN(m_ptr->ABRT_MON_LEN, sizeof(paramsbuffer)-1);
33 if((p=data_copy(m_ptr->ABRT_MON_ENDPT, (vir_bytes) m_ptr->ABRT_MON_ADDR,
34 KERNEL, (vir_bytes) paramsbuffer, len)) != OK) {
35 return p;
37 paramsbuffer[len] = '\0';
40 /* Now prepare to shutdown MINIX. */
41 prepare_shutdown(how);
42 return(OK); /* pro-forma (really EDISASTER) */
45 #endif /* USE_ABORT */