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.
This commit is contained in:
Jeff Johnston 2001-03-06 01:04:43 +00:00
parent a887211b00
commit cfc05d9675
9 changed files with 33 additions and 23 deletions

View File

@ -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.

View File

@ -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__ */

View File

@ -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));

View File

@ -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__)

View File

@ -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));

View File

@ -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;

View File

@ -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;

View File

@ -3,7 +3,7 @@
#include <reent.h>
#include <unistd.h>
int
_READ_WRITE_RETURN_TYPE
read (fd, buf, cnt)
int fd;
void *buf;

View File

@ -3,7 +3,7 @@
#include <reent.h>
#include <unistd.h>
int
_READ_WRITE_RETURN_TYPE
write (fd, buf, cnt)
int fd;
const void *buf;