Commit d04e13f0 authored by Christoph Hellwig's avatar Christoph Hellwig

[PATCH] uClinux bits for /dev/zero

uClinux ports can't use mmu tricks for reading /dev/zero due to the
lack of one.  similarly it can't mmap /dev/zero.
parent e5c6d30e
......@@ -377,6 +377,7 @@ static ssize_t write_null(struct file * file, const char * buf,
return count;
}
#ifdef CONFIG_MMU
/*
* For fun, we are using the MMU for this.
*/
......@@ -476,6 +477,29 @@ static int mmap_zero(struct file * file, struct vm_area_struct * vma)
return -EAGAIN;
return 0;
}
#else /* CONFIG_MMU */
static ssize_t read_zero(struct file * file, char * buf,
size_t count, loff_t *ppos)
{
unsigned long left;
if (!count)
return 0;
for (left = count; left > 0; left--, buf++) {
if (put_user(0, buf))
return -EFAULT;
cond_resched();
}
return count;
}
static int mmap_zero(struct file * file, struct vm_area_struct * vma)
{
return -ENOSYS;
}
#endif /* CONFIG_MMU */
static ssize_t write_full(struct file * file, const char * buf,
size_t count, loff_t *ppos)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment