about summary refs log tree commit diff
path: root/rt/aio_misc.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-08-07 05:42:26 +0000
committerUlrich Drepper <drepper@redhat.com>1999-08-07 05:42:26 +0000
commit754549b3bed222fd15d748605143e5925296a7fc (patch)
treef70b7c0d1e05f12f31aa7f7ba2ff3fe9f823142d /rt/aio_misc.c
parent3ac3f38099a11fcd348fe4ef8d4868f87a13e435 (diff)
downloadglibc-754549b3bed222fd15d748605143e5925296a7fc.tar.gz
glibc-754549b3bed222fd15d748605143e5925296a7fc.tar.xz
glibc-754549b3bed222fd15d748605143e5925296a7fc.zip
Update.
	* rt/aio_misc.c (handle_fildes_io): Imitate the behaviour on other
	systems which allow using the functions also on non-seekable
	devices.
Diffstat (limited to 'rt/aio_misc.c')
-rw-r--r--rt/aio_misc.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/rt/aio_misc.c b/rt/aio_misc.c
index ba0c9d47cf..fb5fbf6985 100644
--- a/rt/aio_misc.c
+++ b/rt/aio_misc.c
@@ -435,6 +435,16 @@ handle_fildes_io (void *arg)
 					 (void *) aiocbp->aiocb.aio_buf,
 					 aiocbp->aiocb.aio_nbytes,
 					 aiocbp->aiocb.aio_offset));
+
+	  if (aiocbp->aiocb.__return_value == -1 && errno == ESPIPE)
+	    /* The Linux kernel is different from others.  It returns
+	       ESPIPE if using pread on a socket.  Other platforms
+	       simply ignore the offset parameter and behave like
+	       read.  */
+	    aiocbp->aiocb.__return_value =
+	      TEMP_FAILURE_RETRY (read (fildes,
+					(void *) aiocbp->aiocb64.aio_buf,
+					aiocbp->aiocb64.aio_nbytes));
 	}
       else if ((aiocbp->aiocb.aio_lio_opcode & 127) == LIO_WRITE)
 	{
@@ -450,6 +460,16 @@ handle_fildes_io (void *arg)
 					  (const void *) aiocbp->aiocb.aio_buf,
 					  aiocbp->aiocb.aio_nbytes,
 					  aiocbp->aiocb.aio_offset));
+
+	  if (aiocbp->aiocb.__return_value == -1 && errno == ESPIPE)
+	    /* The Linux kernel is different from others.  It returns
+	       ESPIPE if using pwrite on a socket.  Other platforms
+	       simply ignore the offset parameter and behave like
+	       write.  */
+	    aiocbp->aiocb.__return_value =
+	      TEMP_FAILURE_RETRY (write (fildes,
+					 (void *) aiocbp->aiocb64.aio_buf,
+					 aiocbp->aiocb64.aio_nbytes));
 	}
       else if (aiocbp->aiocb.aio_lio_opcode == LIO_DSYNC)
 	aiocbp->aiocb.__return_value = TEMP_FAILURE_RETRY (fdatasync (fildes));