1 /* Copyright (C) 2004 Manuel Novoa III <mjn3@codepoet.org>
3 * GNU Library General Public License (LGPL) version 2 or later.
5 * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details.
10 #ifndef __DO_LARGEFILE
12 # define OFFSET_TYPE long int
15 OFFSET_TYPE
FTELL(register FILE *stream
)
17 #if !defined(__DO_LARGEFILE)
19 __offmax_t pos
= ftello64(stream
);
21 if ((sizeof(long) >= sizeof(__offmax_t
)) || (((long) pos
) == pos
)) {
24 __set_errno(EOVERFLOW
);
31 __STDIO_AUTO_THREADLOCK_VAR
;
33 __STDIO_AUTO_THREADLOCK(stream
);
35 __STDIO_STREAM_VALIDATE(stream
);
37 if ((__SEEK(stream
, &pos
,
38 ((__STDIO_STREAM_IS_WRITING(stream
)
39 && (stream
->__modeflags
& __FLAG_APPEND
))
40 ? SEEK_END
: SEEK_CUR
)) < 0)
41 || (__stdio_adjust_position(stream
, &pos
) < 0)) {
45 __STDIO_AUTO_THREADUNLOCK(stream
);
53 libc_hidden_def(ftello64
)
55 libc_hidden_def(ftell
)
56 strong_alias_untyped(ftell
,ftello
)