Пример #1
0
static asmlinkage void kapi_stdout_write_handler(msg_t *msg)
{
    unsigned long reply_mbox_id = msg->mailbox_id;
    unsigned long printed_count = 0;
    msg_t *s = NULL;
    
    // Process the msg
    unsigned long console_id = (int)msg->params[0].value;
    char *buf = (char *)((unsigned long)msg + msg->params[1].offset);
    unsigned long count = msg->params[2].value;
    
    struct console *con = get_console(console_id);
    if (con && con->activated) {
        print_out_buffer(buf, count);
        printed_count = count;
    }
    
    // Setup reply msg
    s = syscall_msg();
    s->mailbox_id = reply_mbox_id;
    msg_param_value(s, printed_count);
    
    // Issue the reply
    syscall_respond();
    
    // Should never reach here
    sys_unreahable();
}
Пример #2
0
static int print_proc(char* page, char **start, off_t off, int count,int *eof, void *data)
{
	static int len;
	int new_count;

	if (off == 0)
	{
        bm_print_on();
		len = print_out_buffer(bm_print_buf);
	}

	if (off >= len)
	{
		*eof = 1;
		return 0;
	}

	new_count =  count + off > len ? len - off : count;

	memcpy(page, bm_print_buf + off, new_count);

	off += new_count;

	*eof = 0;

	*start = page;

	if( new_count < count )
	{
        bm_entry_pointer = bm_entry;
        bm_print_off();
	}

	return new_count;
}