return(EACCES);
#endif
- /* If it's not an ATAPI device, then don't open with RO_BIT. */
- if (!(wn->state & ATAPI) && (m_ptr->COUNT & RO_BIT)) return EACCES;
-
/* Partition the drive if it's being opened for the first time,
* or being opened after being closed.
*/
if ((rmp->mp_flags & (REPLY | ONSWAP | IN_USE | ZOMBIE)) ==
(REPLY | IN_USE)) {
if ((s=send(rmp->mp_endpoint, &rmp->mp_reply)) != OK) {
- panic(__FILE__,"PM can't reply to",
- rmp->mp_endpoint);
+ printf("PM can't reply to %d (%s)\n",
+ rmp->mp_endpoint, rmp->mp_name);
+ panic(__FILE__, "PM can't reply", NO_NUM);
}
rmp->mp_flags &= ~REPLY;
}
*===========================================================================*/
PUBLIC int do_reboot()
{
- char monitor_code[32*sizeof(char *)];
+ char monitor_code[256];
vir_bytes code_addr;
int code_size;
int abort_flag;
abort_flag = (unsigned) m_in.reboot_flag;
if (abort_flag >= RBT_INVALID) return(EINVAL);
if (RBT_MONITOR == abort_flag) {
- code_addr = (vir_bytes) m_in.reboot_code;
+ int r;
+ if(m_in.reboot_strlen >= sizeof(monitor_code))
+ return EINVAL;
+ if((r = sys_datacopy(who_e, (vir_bytes) m_in.reboot_code,
+ SELF, (vir_bytes) monitor_code, m_in.reboot_strlen)) != OK)
+ return r;
+ code_addr = (vir_bytes) monitor_code;
+ monitor_code[m_in.reboot_strlen] = '\0';
code_size = m_in.reboot_strlen + 1;
}
/* Ask the kernel to abort. All system services, including the PM, will
* get a HARD_STOP notification. Await the notification in the main loop.
*/
- sys_abort(abort_flag, who_e, code_addr, code_size);
+ sys_abort(abort_flag, PM_PROC_NR, code_addr, code_size);
+ printf("sys_abort called\n");
return(SUSPEND); /* don't reply to caller */
}