From 533b4e664428a0ddd218eb62f0dc78f0a87ff079 Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Thu, 27 Jun 2002 22:48:05 +0000 Subject: 2002-06-27 Jeff Johnston * libc/include/sys/_types.h: Define _ssize_t as int if int is 32-bits, otherwise define it as long. * libc/include/sys/types.h: Include <_ansi.h> and and define ssize_t as _ssize_t. * libc/reent/readr.c: Change return type to _ssize_t. * libc/reent/writer.c: Ditto. * libc/sys/linux/Makefile.am: Add aio.c. * libc/sys/linux/Makefile.in: Regenerated. * libc/sys/linux/aio.c: New file. * libc/sys/linux/sys/cdefs.h: Add __restrict_arr definition. * libm/common/fdlibm.h: Undef __P before defining it. --- newlib/libc/include/sys/_types.h | 5 +++ newlib/libc/include/sys/types.h | 5 ++- newlib/libc/reent/readr.c | 12 +++---- newlib/libc/reent/writer.c | 12 +++---- newlib/libc/sys/linux/Makefile.am | 1 + newlib/libc/sys/linux/Makefile.in | 22 +++++++------ newlib/libc/sys/linux/aio.c | 67 +++++++++++++++++++++++++++++++++++++++ newlib/libc/sys/linux/sys/cdefs.h | 2 ++ 8 files changed, 103 insertions(+), 23 deletions(-) create mode 100644 newlib/libc/sys/linux/aio.c (limited to 'newlib/libc') diff --git a/newlib/libc/include/sys/_types.h b/newlib/libc/include/sys/_types.h index 8186f2d9d..a2f6e3929 100644 --- a/newlib/libc/include/sys/_types.h +++ b/newlib/libc/include/sys/_types.h @@ -10,6 +10,11 @@ #define _SYS__TYPES_H typedef long _off_t; + +#if defined(__INT_MAX__) && __INT_MAX__ == 2147483647 +typedef int _ssize_t; +#else typedef long _ssize_t; +#endif #endif /* _SYS__TYPES_H */ diff --git a/newlib/libc/include/sys/types.h b/newlib/libc/include/sys/types.h index 13e12a9df..c562a23b4 100644 --- a/newlib/libc/include/sys/types.h +++ b/newlib/libc/include/sys/types.h @@ -18,6 +18,9 @@ #ifndef _SYS_TYPES_H #define _SYS_TYPES_H +#include <_ansi.h> +#include + #if defined (_WIN32) || defined (__CYGWIN__) #define __MS_types__ #endif @@ -158,7 +161,7 @@ typedef unsigned short gid_t; typedef int pid_t; typedef long key_t; -typedef long ssize_t; +typedef _ssize_t ssize_t; #ifdef __MS_types__ typedef char * addr_t; diff --git a/newlib/libc/reent/readr.c b/newlib/libc/reent/readr.c index e3deca9a7..b05cbe2ab 100644 --- a/newlib/libc/reent/readr.c +++ b/newlib/libc/reent/readr.c @@ -28,12 +28,12 @@ INDEX ANSI_SYNOPSIS #include - long _read_r(struct _reent *<[ptr]>, - int <[fd]>, void *<[buf]>, size_t <[cnt]>); + _ssize_t _read_r(struct _reent *<[ptr]>, + int <[fd]>, void *<[buf]>, size_t <[cnt]>); TRAD_SYNOPSIS #include - long _read_r(<[ptr]>, <[fd]>, <[buf]>, <[cnt]>) + _ssize_t _read_r(<[ptr]>, <[fd]>, <[buf]>, <[cnt]>) struct _reent *<[ptr]>; int <[fd]>; char *<[buf]>; @@ -45,17 +45,17 @@ DESCRIPTION <>. */ -long +_ssize_t _read_r (ptr, fd, buf, cnt) struct _reent *ptr; int fd; _PTR buf; size_t cnt; { - long ret; + _ssize_t ret; errno = 0; - if ((ret = _read (fd, buf, cnt)) == -1 && errno != 0) + if ((ret = (_ssize_t)_read (fd, buf, cnt)) == -1 && errno != 0) ptr->_errno = errno; return ret; } diff --git a/newlib/libc/reent/writer.c b/newlib/libc/reent/writer.c index ac10286e8..7ede74fcc 100644 --- a/newlib/libc/reent/writer.c +++ b/newlib/libc/reent/writer.c @@ -28,12 +28,12 @@ INDEX ANSI_SYNOPSIS #include - long _write_r(struct _reent *<[ptr]>, - int <[fd]>, const void *<[buf]>, size_t <[cnt]>); + _ssize_t _write_r(struct _reent *<[ptr]>, + int <[fd]>, const void *<[buf]>, size_t <[cnt]>); TRAD_SYNOPSIS #include - long _write_r(<[ptr]>, <[fd]>, <[buf]>, <[cnt]>) + _ssize_t _write_r(<[ptr]>, <[fd]>, <[buf]>, <[cnt]>) struct _reent *<[ptr]>; int <[fd]>; char *<[buf]>; @@ -45,17 +45,17 @@ DESCRIPTION <>. */ -long +_ssize_t _write_r (ptr, fd, buf, cnt) struct _reent *ptr; int fd; _CONST _PTR buf; size_t cnt; { - long ret; + _ssize_t ret; errno = 0; - if ((ret = _write (fd, buf, cnt)) == -1 && errno != 0) + if ((ret = (_ssize_t)_write (fd, buf, cnt)) == -1 && errno != 0) ptr->_errno = errno; return ret; } diff --git a/newlib/libc/sys/linux/Makefile.am b/newlib/libc/sys/linux/Makefile.am index a21963ca6..6f05fc881 100644 --- a/newlib/libc/sys/linux/Makefile.am +++ b/newlib/libc/sys/linux/Makefile.am @@ -10,6 +10,7 @@ SUBLIBS = \ $(LINUX_MACH_LIB) LIB_SOURCES = \ + aio.c \ brk.c \ cfspeed.c \ clock_getres.c \ diff --git a/newlib/libc/sys/linux/Makefile.in b/newlib/libc/sys/linux/Makefile.in index f740b67a1..4b7df11c6 100644 --- a/newlib/libc/sys/linux/Makefile.in +++ b/newlib/libc/sys/linux/Makefile.in @@ -107,6 +107,7 @@ SUBLIBS = \ LIB_SOURCES = \ + aio.c \ brk.c \ cfspeed.c \ clock_getres.c \ @@ -208,15 +209,16 @@ LIBRARIES = $(noinst_LIBRARIES) DEFS = @DEFS@ -I. -I$(srcdir) CPPFLAGS = @CPPFLAGS@ LIBS = @LIBS@ -@USE_LIBTOOL_FALSE@lib_a_OBJECTS = brk.$(OBJEXT) cfspeed.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@clock_getres.$(OBJEXT) clock_gettime.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@clock_settime.$(OBJEXT) flockfile.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@ftok.$(OBJEXT) funlockfile.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@getdate.$(OBJEXT) getdate_err.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@gethostname.$(OBJEXT) getoptlong.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@getreent.$(OBJEXT) ids.$(OBJEXT) inode.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@io.$(OBJEXT) io64.$(OBJEXT) ipc.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@linux.$(OBJEXT) mmap.$(OBJEXT) mq_close.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@lib_a_OBJECTS = aio.$(OBJEXT) brk.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@cfspeed.$(OBJEXT) clock_getres.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@clock_gettime.$(OBJEXT) clock_settime.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@flockfile.$(OBJEXT) ftok.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@funlockfile.$(OBJEXT) getdate.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@getdate_err.$(OBJEXT) gethostname.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@getoptlong.$(OBJEXT) getreent.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@ids.$(OBJEXT) inode.$(OBJEXT) io.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@io64.$(OBJEXT) ipc.$(OBJEXT) linux.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@mmap.$(OBJEXT) mq_close.$(OBJEXT) \ @USE_LIBTOOL_FALSE@mq_getattr.$(OBJEXT) mq_notify.$(OBJEXT) \ @USE_LIBTOOL_FALSE@mq_open.$(OBJEXT) mq_receive.$(OBJEXT) \ @USE_LIBTOOL_FALSE@mq_send.$(OBJEXT) mq_setattr.$(OBJEXT) \ @@ -238,7 +240,7 @@ LIBS = @LIBS@ @USE_LIBTOOL_FALSE@usleep.$(OBJEXT) wait.$(OBJEXT) LTLIBRARIES = $(noinst_LTLIBRARIES) -@USE_LIBTOOL_TRUE@liblinux_la_OBJECTS = brk.lo cfspeed.lo \ +@USE_LIBTOOL_TRUE@liblinux_la_OBJECTS = aio.lo brk.lo cfspeed.lo \ @USE_LIBTOOL_TRUE@clock_getres.lo clock_gettime.lo clock_settime.lo \ @USE_LIBTOOL_TRUE@flockfile.lo ftok.lo funlockfile.lo getdate.lo \ @USE_LIBTOOL_TRUE@getdate_err.lo gethostname.lo getoptlong.lo \ diff --git a/newlib/libc/sys/linux/aio.c b/newlib/libc/sys/linux/aio.c new file mode 100644 index 000000000..7351a0342 --- /dev/null +++ b/newlib/libc/sys/linux/aio.c @@ -0,0 +1,67 @@ +/* libc/sys/linux/aio.c - asychronous I/O */ + +/* Copyright 2002, Red Hat Inc. */ + +/* Currently asynchronous I/O is not implemented. */ + +#include +#include +#include + +int +aio_cancel (int fd, struct aiocb *cb) +{ + errno = ENOSYS; + return -1; +} + +int +aio_error (const struct aiocb *cb) +{ + errno = ENOSYS; + return -1; +} + +int +aio_fsync (int op, struct aiocb *cb) +{ + errno = ENOSYS; + return -1; +} + +int +aio_read (struct aiocb *cb) +{ + errno = ENOSYS; + return -1; +} + +ssize_t +aio_return (struct aiocb *cb) +{ + errno = ENOSYS; + return -1; +} + +int +aio_suspend (const struct aiocb *const list[], int nent, + const struct timespec *timeout) +{ + errno = ENOSYS; + return -1; +} + +int +aio_write (struct aiocb *cb) +{ + errno = ENOSYS; + return -1; +} + +int +lio_listio (int mode, struct aiocb * const list[], int nent, + struct sigevent *sig) +{ + errno = ENOSYS; + return -1; +} diff --git a/newlib/libc/sys/linux/sys/cdefs.h b/newlib/libc/sys/linux/sys/cdefs.h index f0b6a27b4..1108a7dab 100644 --- a/newlib/libc/sys/linux/sys/cdefs.h +++ b/newlib/libc/sys/linux/sys/cdefs.h @@ -65,6 +65,7 @@ #define __attribute_pure__ #define __attribute_format_strfmon__(a,b) #define __flexarr [0] +#define __restrict_arr #ifdef __cplusplus # define __BEGIN_DECLS extern "C" { @@ -80,6 +81,7 @@ # define __ptrvalue /* nothing */ #endif + #ifdef __GNUC__ #define __strong_reference(sym,aliassym) \ extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym))); -- cgit v1.2.3