Beispiel #1
0
ssize_t dev_stdout_write(struct file *file, const char *buf, size_t count,
                         off64_t *offset)
{
	char *t_buf;
	struct proc *p = current;
	if (p)
		t_buf = user_strdup_errno(p, buf, count);
	else
		t_buf = (char*)buf;
	if (!t_buf)
		return -1;
	/* TODO: tty hack.  they are sending us an escape sequence, and the keyboard
	 * would try to print it (which it can't do yet).  The hack is even dirtier
	 * in that we only detect it if it is the first char, and we ignore
	 * everything else. */
	if (t_buf[0] != '\033') /* 0x1b */
		cputbuf(t_buf, count);
	if (p)
		user_memdup_free(p, t_buf);
	return count;
}
Beispiel #2
0
/* Helper, frees a path that was allocated with copy_in_path. */
void free_path(struct proc *p, char *t_path)
{
	user_memdup_free(p, t_path);
}