about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2009-02-05 00:21:43 +0000
committerUlrich Drepper <drepper@redhat.com>2009-02-05 00:21:43 +0000
commita71433e7fd0263a1dbac7a9b88067e4830382486 (patch)
tree7e19d61caa3a7f16c63ac637fc23d32a2f61e4f6
parent82f2e9c6bd8a02b6b5d90239f0f683407a5a7d10 (diff)
downloadglibc-a71433e7fd0263a1dbac7a9b88067e4830382486.tar.gz
glibc-a71433e7fd0263a1dbac7a9b88067e4830382486.tar.xz
glibc-a71433e7fd0263a1dbac7a9b88067e4830382486.zip
* sysdeps/unix/sysv/linux/sparc/bits/siginfo.h (struct sigevent):
	Add _tid slot to maintain consistency with kernel.
-rw-r--r--ChangeLog5
-rw-r--r--libio/wfileops.c24
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/siginfo.h4
3 files changed, 31 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 59fb6a1e25..54e96abc8d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-11-17  Nathan Sidwell  <nathan@codesourcery.com>
+
+	* sysdeps/unix/sysv/linux/sparc/bits/siginfo.h (struct sigevent):
+	Add _tid slot to maintain consistency with kernel.
+
 2009-02-04  Ulrich Drepper  <drepper@redhat.com>
 
 	* libio/wfileops.c (_IO_wfile_underflow): Fix handling of
diff --git a/libio/wfileops.c b/libio/wfileops.c
index c5f0eaf6a7..57ed786a8f 100644
--- a/libio/wfileops.c
+++ b/libio/wfileops.c
@@ -297,14 +297,34 @@ _IO_wfile_underflow (fp)
 
       if (naccbuf == 0)
 	{
+	  if (fp->_IO_read_base < fp->_IO_read_ptr)
+	    {
+	      /* Partially used the buffer for some input data that
+		 produces no output.  */
+	      size_t avail = fp->_IO_read_end - fp->_IO_read_ptr;
+	      memmove (fp->_IO_read_base, fp->_IO_read_ptr, avail);
+	      fp->_IO_read_ptr = fp->_IO_read_base;
+	      fp->_IO_read_end -= avail;
+	      goto again;
+	    }
 	  naccbuf = fp->_IO_read_end - fp->_IO_read_ptr;
 	  if (naccbuf >= sizeof (accbuf))
 	    goto out_eilseq;
 
 	  memcpy (accbuf, fp->_IO_read_ptr, naccbuf);
 	}
-      else if (naccbuf == sizeof (accbuf))
-	goto out_eilseq;
+      else
+	{
+	  size_t used = read_ptr_copy - accbuf;
+	  if (used > 0)
+	    {
+	      memmove (accbuf, read_ptr_copy, naccbuf - used);
+	      naccbuf -= used;
+	    }
+
+	  if (naccbuf == sizeof (accbuf))
+	    goto out_eilseq;
+	}
 
       fp->_IO_read_ptr = fp->_IO_read_end = fp->_IO_read_base;
 
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/siginfo.h b/sysdeps/unix/sysv/linux/sparc/bits/siginfo.h
index 7ff1971c2a..c0f98f6072 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/siginfo.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/siginfo.h
@@ -289,6 +289,10 @@ typedef struct sigevent
       {
 	int _pad[__SIGEV_PAD_SIZE];
 
+	/* When SIGEV_SIGNAL and SIGEV_THREAD_ID set, LWP ID of the
+	   thread to receive the signal.  */
+	__pid_t _tid;
+
 	struct
 	  {
 	    void (*_function) (sigval_t);	/* Function to start.  */