This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Ping[3]: [PATCH][BZ #11741] printf should return negative valueon I/O error
On Fri, Nov 16, 2012 at 12:50 AM, Siddhesh Poyarekar
<siddhesh@redhat.com> wrote:
> On Fri, 16 Nov 2012 00:21:13 -0500, Carlos wrote:
>> No, we don't need to retain the C++ semantics, but we need to adjust
>> the comments in the libio headers to mention this and comment on the
>> differences between ISO C++ and what we have implemented here.
>
> OK, how about this for now:
>
> diff --git a/libio/libioP.h b/libio/libioP.h
> index a280052..fe81115 100644
> --- a/libio/libioP.h
> +++ b/libio/libioP.h
> @@ -25,6 +25,14 @@
> This exception applies to code released by its copyright holders
> in files containing the exception. */
>
> +/* NOTE: libio is now exclusively used only by glibc since libstdc++ has its
> + own implementation. As a result, functions that were implemented for C++
> + (like *sputn) may no longer have C++ semantics. This is of course only
> + relevant for internal callers of these functions since these functions are
> + not intended for external use otherwise.
> +
> + FIXME: All of the C++ cruft eventually needs to go away. */
> +
> #include <errno.h>
> #ifndef __set_errno
> # define __set_errno(Val) errno = (Val)
>
>
> I'll put this in as a separate patch once you ack the earlier patch and
> the wording above is OK..
OK to checkin both if you modify the xsputn comment to say that
it may return EOF or number of types written:
/* The 'xsputn' hook writes upto N characters from buffer DATA.
Returns the number of character actually written.
It matches the streambuf::xsputn virtual function. */
typedef _IO_size_t (*_IO_xsputn_t) (_IO_FILE *FP, const void *DATA,
_IO_size_t N);
#define _IO_XSPUTN(FP, DATA, N) JUMP2 (__xsputn, FP, DATA, N)
#define _IO_WXSPUTN(FP, DATA, N) WJUMP2 (__xsputn, FP, DATA, N)
Cheers,
Carlos.