This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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: [patch, fortran] Large transfer support for IO library


On Wed, Sep 28, 2005 at 11:19:51PM +0300, Janne Blomqvist wrote:
> +  /* Requests between SSIZE_MAX and SIZE_MAX are undefined by SUS, in
> +     that case we do two writes.  */

You can't rely on doing this in exactly two writes.  Or transfers
less that SSIZE_MAX in exactly one write.  On some systems, signals
do not restart system calls.  So you need to stay in a loop like

	while (bytes_left > 0)
	  {
	    transfer = min (bytes_left, ssize_max);
	    transfer = write (..., transfer);
	    if (transfer < 0)
	      error;
	    bytes_left -= transfer;
	  }

Similarly for reads.


r~


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