OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [newlib-1.17.0/] [newlib/] [libc/] [sys/] [linux/] [pwrite.c] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
/* Linux version of pwrite 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 (_pwrite_r, (rptr, fd, buf, n, off),
10
     struct _reent *rptr _AND
11
     int fd _AND
12
     _CONST _PTR buf _AND
13
     size_t n _AND
14
     off_t off)
15
{
16
  off_t cur_pos;
17
  _READ_WRITE_RETURN_TYPE num_written;
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_written = _write_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_written;
31
}
32
 
33
#ifndef _REENT_ONLY
34
 
35
ssize_t
36
_DEFUN (__libc_pwrite, (fd, buf, n, off),
37
     int fd _AND
38
     _CONST _PTR buf _AND
39
     size_t n _AND
40
     off_t off)
41
{
42
  return _pwrite_r (_REENT, fd, buf, n, off);
43
}
44
weak_alias(__libc_pwrite,pwrite)
45
 
46
#endif

powered by: WebSVN 2.1.0

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