Last change
on this file was
444,
checked in by satin@…, 6 years ago
|
add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc
|
File size:
819 bytes
|
Line | |
---|
1 | /* 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 | _pwrite_r (struct _reent *rptr, |
---|
10 | int fd, |
---|
11 | const void *buf, |
---|
12 | size_t n, |
---|
13 | off_t off) |
---|
14 | { |
---|
15 | off_t cur_pos; |
---|
16 | _READ_WRITE_RETURN_TYPE num_written; |
---|
17 | |
---|
18 | if ((cur_pos = _lseek_r (rptr, fd, 0, SEEK_CUR)) == (off_t)-1) |
---|
19 | return -1; |
---|
20 | |
---|
21 | if (_lseek_r (rptr, fd, off, SEEK_SET) == (off_t)-1) |
---|
22 | return -1; |
---|
23 | |
---|
24 | num_written = _write_r (rptr, fd, buf, n); |
---|
25 | |
---|
26 | if (_lseek_r (rptr, fd, cur_pos, SEEK_SET) == (off_t)-1) |
---|
27 | return -1; |
---|
28 | |
---|
29 | return (ssize_t)num_written; |
---|
30 | } |
---|
31 | |
---|
32 | #ifndef _REENT_ONLY |
---|
33 | |
---|
34 | ssize_t |
---|
35 | __libc_pwrite (int fd, |
---|
36 | const void *buf, |
---|
37 | size_t n, |
---|
38 | off_t off) |
---|
39 | { |
---|
40 | return _pwrite_r (_REENT, fd, buf, n, off); |
---|
41 | } |
---|
42 | weak_alias(__libc_pwrite,pwrite) |
---|
43 | |
---|
44 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.