This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [HEADSUP] Change to __sFile structure (was Re: [PATCH] Do not break buffers in fvwrite for unbuffered files)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 10/23/2013 12:05 PM, Corinna Vinschen wrote:
> On Oct 21 13:35, Corinna wrote:
>> Here's my Proposal:
>> 
>> We introduce a new define called _READ_WRITE_BUFSIZE_TYPE.  It is
>> used as the type of the `count' parameter for the _read and
>> _write methods in struct __sFILE.  It's set to int by default for
>> backward compatibility. Interested targets can set it to the more
>> correct size_t in include/sys/config.h.

I've noticed another detail in fvwrite.h: while in struct __siov the
buffer length is (correctly) a size_t, the field uio_resid in struct
__suio, which is meant to be the sum of the size of all buffers is
still an int. This breaks fwrite() of > 2GByte buffers.

Attached is a patch that simply makes uio_resid a size_t. Since
fvwrite.h is a private header, I don't think there's any binary
compatibility issue.


2013-10-31  Terraneo Federico  <fede.tft@hotmail.it>


	* libc/stdio/fvwrite.h: change type of uio_resid from int
	 to size_t to fix fwrite() of > 2GByte buffers
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJScimNAAoJECkLFtN5Xr9fbVwH/A8KfS8WTJvsJwFT4tDm6P8x
OeGkQtHcbYQDLheg4HHkTvrsNt5IsZAFDtBnDWjfQ9+r/SMYx64CxZWFozRiGgMA
xYomzYzx7pSAH9MfjvpWXKSK/x95ICLikfhVmuZWFHG9/ysCvBty2k7L2HJiBihv
RFrE5EDqcSeRpVGMFoqqJmBgAdqQ3wAQ0TpQTA4R7YlpJF29B3ltPdJVstNwQYVE
WcQj4ijwfJ9EWpA9662OIKGVQWwucbmTuklNkTQWSWoqoKe/27r5VRBSBsVb+SBS
gfBWm/buzaXpLfZCSkz+8OpTubfhq/wkfUz1m9tfjbEgBrtyslhVRtjTizY362w=
=I+Qc
-----END PGP SIGNATURE-----
diff -ruN a/newlib/libc/stdio/fvwrite.h b/newlib/libc/stdio/fvwrite.h
--- a/newlib/libc/stdio/fvwrite.h	2007-03-15 19:40:48.000000000 +0100
+++ b/newlib/libc/stdio/fvwrite.h	2013-10-31 09:33:43.917907668 +0100
@@ -28,7 +28,7 @@
 struct __suio {
 	struct	__siov *uio_iov;
 	int	uio_iovcnt;
-	int	uio_resid;
+	size_t	uio_resid;
 };
 
 

Attachment: uio_resid.patch.sig
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]