aboutsummaryrefslogtreecommitdiff
path: root/newlib
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2001-03-06 01:04:43 +0000
committerJeff Johnston <jjohnstn@redhat.com>2001-03-06 01:04:43 +0000
commitcfc05d9675436a157ea959a5fb06da60722234c7 (patch)
treedfd096db23b4c24f2be67e69276e7b10c9cc04d6 /newlib
parenta887211b0012ee3ce20e1327bb0a6ed49719edf5 (diff)
downloadnewlib-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')
-rw-r--r--newlib/ChangeLog12
-rw-r--r--newlib/libc/include/sys/config.h7
-rw-r--r--newlib/libc/include/sys/reent.h5
-rw-r--r--newlib/libc/include/sys/unistd.h18
-rw-r--r--newlib/libc/stdio/local.h4
-rw-r--r--newlib/libc/stdio/sscanf.c2
-rw-r--r--newlib/libc/stdio/stdio.c4
-rw-r--r--newlib/libc/syscalls/sysread.c2
-rw-r--r--newlib/libc/syscalls/syswrite.c2
9 files changed, 33 insertions, 23 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog
index 4d2f65b..1670737 100644
--- a/newlib/ChangeLog
+++ b/newlib/ChangeLog
@@ -1,3 +1,15 @@
+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.
+
2001-03-05 Jeff Johnston <jjohnstn@redhat.com>
* libc/time/mktime.c: Add L suffix to _SEC_IN_xxxx constants.
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__)
diff --git a/newlib/libc/stdio/local.h b/newlib/libc/stdio/local.h
index 24e02e8..dfe5e79 100644
--- a/newlib/libc/stdio/local.h
+++ b/newlib/libc/stdio/local.h
@@ -31,8 +31,8 @@ extern int _EXFUN(__svfscanf,(FILE *, _CONST char *,va_list));
extern FILE *_EXFUN(__sfp,(struct _reent *));
extern int _EXFUN(__sflags,(struct _reent *,_CONST char*, int*));
extern int _EXFUN(__srefill,(FILE *));
-extern int _EXFUN(__sread,(void *, char *, int));
-extern int _EXFUN(__swrite,(void *, char const *, int));
+extern _READ_WRITE_RETURN_TYPE _EXFUN(__sread,(void *, char *, int));
+extern _READ_WRITE_RETURN_TYPE _EXFUN(__swrite,(void *, char const *, int));
extern fpos_t _EXFUN(__sseek,(void *, fpos_t, int));
extern int _EXFUN(__sclose,(void *));
extern int _EXFUN(__stextmode,(int));
diff --git a/newlib/libc/stdio/sscanf.c b/newlib/libc/stdio/sscanf.c
index eb34423..5a403de 100644
--- a/newlib/libc/stdio/sscanf.c
+++ b/newlib/libc/stdio/sscanf.c
@@ -344,7 +344,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
/* | ARGSUSED */
/*SUPPRESS 590*/
static
-int
+_READ_WRITE_RETURN_TYPE
eofread (cookie, buf, len)
_PTR cookie;
char *buf;
diff --git a/newlib/libc/stdio/stdio.c b/newlib/libc/stdio/stdio.c
index ddebc8a..b0c759f 100644
--- a/newlib/libc/stdio/stdio.c
+++ b/newlib/libc/stdio/stdio.c
@@ -28,7 +28,7 @@
* These maintain the `known seek offset' for seek optimisation.
*/
-int
+_READ_WRITE_RETURN_TYPE
__sread (cookie, buf, n)
_PTR cookie;
char *buf;
@@ -59,7 +59,7 @@ __sread (cookie, buf, n)
return ret;
}
-int
+_READ_WRITE_RETURN_TYPE
__swrite (cookie, buf, n)
_PTR cookie;
char _CONST *buf;
diff --git a/newlib/libc/syscalls/sysread.c b/newlib/libc/syscalls/sysread.c
index 821a91a..bdb3932 100644
--- a/newlib/libc/syscalls/sysread.c
+++ b/newlib/libc/syscalls/sysread.c
@@ -3,7 +3,7 @@
#include <reent.h>
#include <unistd.h>
-int
+_READ_WRITE_RETURN_TYPE
read (fd, buf, cnt)
int fd;
void *buf;
diff --git a/newlib/libc/syscalls/syswrite.c b/newlib/libc/syscalls/syswrite.c
index e73028e..00fc8a3 100644
--- a/newlib/libc/syscalls/syswrite.c
+++ b/newlib/libc/syscalls/syswrite.c
@@ -3,7 +3,7 @@
#include <reent.h>
#include <unistd.h>
-int
+_READ_WRITE_RETURN_TYPE
write (fd, buf, cnt)
int fd;
const void *buf;