1 /* Copyright (C) 2004-2005 Manuel Novoa III <mjn3@codepoet.org>
3 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
5 * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details.
10 libc_hidden_proto(read)
11 libc_hidden_proto(write)
12 libc_hidden_proto(close)
13 #ifdef __UCLIBC_HAS_LFS__
14 libc_hidden_proto(lseek64)
16 libc_hidden_proto(lseek)
19 /**********************************************************************/
20 #ifdef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__
21 /**********************************************************************/
23 ssize_t attribute_hidden _cs_read(void *cookie, char *buf, size_t bufsize)
25 return read(*((int *) cookie), buf, bufsize);
28 /**********************************************************************/
30 ssize_t attribute_hidden _cs_write(void *cookie, const char *buf, size_t bufsize)
32 return write(*((int *) cookie), (char *) buf, bufsize);
35 /**********************************************************************/
37 int attribute_hidden _cs_seek(void *cookie, register __offmax_t *pos, int whence)
41 #ifdef __UCLIBC_HAS_LFS__
42 res = lseek64(*((int *) cookie), *pos, whence);
44 res = lseek(*((int *) cookie), *pos, whence);
47 return (res >= 0) ? ((*pos = res), 0) : ((int) res);
50 /**********************************************************************/
52 int attribute_hidden _cs_close(void *cookie)
54 return close(*((int *) cookie));
57 /**********************************************************************/
59 /**********************************************************************/
61 int attribute_hidden __stdio_seek(FILE *stream, register __offmax_t *pos, int whence)
65 #ifdef __UCLIBC_HAS_LFS__
66 res = lseek64(stream->__filedes, *pos, whence);
68 res = lseek(stream->__filedes, *pos, whence);
71 return (res >= 0) ? ((*pos = res), 0) : ((int) res);
74 /**********************************************************************/
76 /**********************************************************************/