diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2001-03-06 01:04:43 +0000 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2001-03-06 01:04:43 +0000 |
commit | cfc05d9675436a157ea959a5fb06da60722234c7 (patch) | |
tree | dfd096db23b4c24f2be67e69276e7b10c9cc04d6 /newlib/libc/include | |
parent | a887211b0012ee3ce20e1327bb0a6ed49719edf5 (diff) | |
download | newlib-cfc05d9675436a157ea959a5fb06da60722234c7.zip newlib-cfc05d9675436a157ea959a5fb06da60722234c7.tar.gz newlib-cfc05d9675436a157ea959a5fb06da60722234c7.tar.bz2 |
Mon Mar 5 21:48:54 2001 J"orn Rennecke <amylaar@redhat.com>
* 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.
Diffstat (limited to 'newlib/libc/include')
-rw-r--r-- | newlib/libc/include/sys/config.h | 7 | ||||
-rw-r--r-- | newlib/libc/include/sys/reent.h | 5 | ||||
-rw-r--r-- | newlib/libc/include/sys/unistd.h | 18 |
3 files changed, 14 insertions, 16 deletions
diff --git a/newlib/libc/include/sys/config.h b/newlib/libc/include/sys/config.h index 0cf4b1e..60c6eb9 100644 --- a/newlib/libc/include/sys/config.h +++ b/newlib/libc/include/sys/config.h @@ -137,11 +137,18 @@ typedef unsigned int __uint32_t; #if defined(__rtems__) #define __FILENAME_MAX__ 255 +#define _READ_WRITE_RETURN_TYPE ssize_t #endif #ifndef __IMPORT #define __IMPORT #endif +/* Define return type of read/write routines. In POSIX, the return type + for read()/write() is "ssize_t" but legacy newlib code has been using + "int" for some time. If not specified, "int" is defaulted. */ +#ifndef _READ_WRITE_RETURN_TYPE +#define _READ_WRITE_RETURN_TYPE int +#endif #endif /* __SYS_CONFIG_H__ */ diff --git a/newlib/libc/include/sys/reent.h b/newlib/libc/include/sys/reent.h index 8a0fb7f..7aae3f4 100644 --- a/newlib/libc/include/sys/reent.h +++ b/newlib/libc/include/sys/reent.h @@ -111,8 +111,9 @@ struct __sFILE { /* operations */ _PTR _cookie; /* cookie passed to io functions */ - int _EXFUN((*_read),(_PTR _cookie, char *_buf, int _n)); - int _EXFUN((*_write),(_PTR _cookie, const char *_buf, int _n)); + _READ_WRITE_RETURN_TYPE _EXFUN((*_read),(_PTR _cookie, char *_buf, int _n)); + _READ_WRITE_RETURN_TYPE _EXFUN((*_write),(_PTR _cookie, const char *_buf, + int _n)); _fpos_t _EXFUN((*_seek),(_PTR _cookie, _fpos_t _offset, int _whence)); int _EXFUN((*_close),(_PTR _cookie)); diff --git a/newlib/libc/include/sys/unistd.h b/newlib/libc/include/sys/unistd.h index 143129f..9741daf 100644 --- a/newlib/libc/include/sys/unistd.h +++ b/newlib/libc/include/sys/unistd.h @@ -66,12 +66,7 @@ off_t _EXFUN(lseek, (int __fildes, off_t __offset, int __whence )); long _EXFUN(pathconf, (const char *__path, int __name )); int _EXFUN(pause, (void )); int _EXFUN(pipe, (int __fildes[2] )); -/* POSIX 1003.1b-1993 says read() returns ssize_t */ -#if defined(__rtems__) -ssize_t _EXFUN(read, (int __fildes, void *__buf, size_t __nbyte )); -#else -int _EXFUN(read, (int __fildes, void *__buf, size_t __nbyte )); -#endif +_READ_WRITE_RETURN_TYPE _EXFUN(read, (int __fd, void *__buf, size_t __nbyte )); int _EXFUN(rmdir, (const char *__path )); #if defined(__rtems__) void * _EXFUN(sbrk, (ptrdiff_t __incr)); @@ -95,12 +90,7 @@ int _EXFUN(tcsetpgrp, (int __fildes, pid_t __pgrp_id )); char _EXFUN(*ttyname, (int __fildes )); int _EXFUN(unlink, (const char *__path )); int _EXFUN(vhangup, (void )); -/* POSIX 1003.1b-1993 says write() returns ssize_t */ -#if defined(__rtems__) -ssize_t _EXFUN(write, (int __fildes, const void *__buf, size_t __nbyte )); -#else -int _EXFUN(write, (int __fildes, const void *__buf, size_t __nbyte )); -#endif +_READ_WRITE_RETURN_TYPE _EXFUN(write, (int __fd, const void *__buf, size_t __nbyte )); #ifndef _POSIX_SOURCE pid_t _EXFUN(vfork, (void )); @@ -113,10 +103,10 @@ pid_t _EXFUN(_fork, (void )); pid_t _EXFUN(_getpid, (void )); int _EXFUN(_link, (const char *__path1, const char *__path2 )); off_t _EXFUN(_lseek, (int __fildes, off_t __offset, int __whence )); -int _EXFUN(_read, (int __fildes, void *__buf, size_t __nbyte )); +_READ_WRITE_RETURN_TYPE _EXFUN(_read, (int __fd, void *__buf, size_t __nbyte )); void * _EXFUN(_sbrk, (size_t __incr)); int _EXFUN(_unlink, (const char *__path )); -int _EXFUN(_write, (int __fildes, const void *__buf, size_t __nbyte )); +_READ_WRITE_RETURN_TYPE _EXFUN(_write, (int __fd, const void *__buf, size_t __nbyte )); int _EXFUN(_execve, (const char *__path, char * const __argv[], char * const __envp[] )); #if defined(__CYGWIN__) || defined(__rtems__) |