read/write return type

J. Johnston
Mon Mar 5 17:09:00 GMT 2001

A patch has been checked into newlib whereby the return type for read() and write() is set in
libc/include/sys/config.h.  By default, this will be int to protect the legacy code out there.  For
platforms that want to use the POSIX definition (currently just RTEMS), the value can be set to

The following is the ChangeLog entry:

Mon Mar  5 21:48:54 2001  J"orn Rennecke <>

        * libc/include/sys/config.h (_READ_WRITE_RETURN_TYPE): Define.
        For RTEMS, define to be ssize_t.  Default to int if not defined.
        * libc/stdio/sscanf.c (eofread): Return _READ_WRITE_RETURN_TYPE.
        * libc/stdio/stdio.c (__sread, __swrite): Likewise.
        * libc/stdio/local.h (__sread, __swrite): Likewise.
        * libc/include/sys/reent.h (_read, _write): Likewise.
        * libc/include/sys/unistd.h (read, write, _read, _write): Likewise.
        * libc/syscalls/sysread.c (read): Likewise.
        * libc/syscalls/syswrite.c (write): Likewise.

-- Jeff J.

More information about the Newlib mailing list