OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.18.0/] [newlib/] [libc/] [sys/] [linux/] [pread.c] - Blame information for rev 207

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 207 jeremybenn
/* Linux version of pread so we can have a weak_alias */
2
 
3
#include <_ansi.h>
4
#include <unistd.h>
5
#include <reent.h>
6
#include <machine/weakalias.h>
7
 
8
ssize_t
9
_DEFUN (_pread_r, (rptr, fd, buf, n, off),
10
     struct _reent *rptr _AND
11
     int fd _AND
12
     _PTR buf _AND
13
     size_t n _AND
14
     off_t off)
15
{
16
  off_t cur_pos;
17
  _READ_WRITE_RETURN_TYPE num_read;
18
 
19
  if ((cur_pos = _lseek_r (rptr, fd, 0, SEEK_CUR)) == (off_t)-1)
20
    return -1;
21
 
22
  if (_lseek_r (rptr, fd, off, SEEK_SET) == (off_t)-1)
23
    return -1;
24
 
25
  num_read = _read_r (rptr, fd, buf, n);
26
 
27
  if (_lseek_r (rptr, fd, cur_pos, SEEK_SET) == (off_t)-1)
28
    return -1;
29
 
30
  return (ssize_t)num_read;
31
}
32
 
33
#ifndef _REENT_ONLY
34
 
35
ssize_t
36
_DEFUN (__libc_pread, (fd, buf, n, off),
37
     int fd _AND
38
     _PTR buf _AND
39
     size_t n _AND
40
     off_t off)
41
{
42
  return _pread_r (_REENT, fd, buf, n, off);
43
}
44
weak_alias(__libc_pread,pread)
45
 
46
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.