nptl: remove sysdep-cancel ASM macros, convert to C
[uclibc-ng.git] / libc / stdio / __fpending.c
blobe7e33e80ae63b00f9a3952010daa425509ae12eb
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.
6 */
8 #include "_stdio.h"
9 #include <stdio_ext.h>
11 /* Solaris function --
12 * Returns the number of bytes in the buffer for a writing stream.
14 * NOTE: GLIBC DIFFERENCE!!!
16 * glibc will return the number of wide chars pending for wide oriented
17 * streams. We always return the number of bytes in the buffer, as we
18 * convert wide chars to their multibyte encodings and buffer _those_.
21 size_t __fpending(register FILE * __restrict stream)
23 __STDIO_STREAM_VALIDATE(stream);
25 return (__STDIO_STREAM_IS_WRITING(stream))
26 ? __STDIO_STREAM_BUFFER_WUSED(stream)
27 : 0;