blob: 1177a413609e045bec8d62d0e10763d1878a87e1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
/* Reentrant versions of read system call. */
#include <reent.h>
#include <unistd.h>
#include <errno.h>
#include <hurd/rm.h>
_ssize_t
read (int fd, void *buf, size_t cnt)
{
if (fd != 0)
{
errno = EBADF;
return -1;
}
if (cnt == 0)
return 0;
struct io_buffer buffer;
rm_read (cnt, &buffer);
memcpy (buf, buffer.data, buffer.len);
return buffer.len;
}
_ssize_t
_DEFUN (_read_r, (ptr, fd, buf, cnt),
struct _reent *ptr _AND
int fd _AND
_PTR buf _AND
size_t cnt)
{
return read (fd, buf, cnt);
}
|