kern/147226: read(fd, buffer, len) returns -1 immediately, if len >=2147483648

Харитонов Евгений eugene.kharitonov at gmail.com
Tue Jun 1 10:00:16 UTC 2010


The following reply was made to PR kern/147226; it has been noted by GNATS.

From: =?UTF-8?B?0KXQsNGA0LjRgtC+0L3QvtCyINCV0LLQs9C10L3QuNC5?=
 <eugene.kharitonov at gmail.com>
To: Bruce Cran <bruce at cran.org.uk>
Cc: bug-followup at FreeBSD.org
Subject: Re: kern/147226: read(fd, buffer, len) returns -1 immediately,  if
 len &gt;=2147483648
Date: Tue, 01 Jun 2010 13:19:46 +0400

 To summarize:
 
 1) `man 2 read` on my  FreeBSD (64-bit) says that read accepts only len 
 <= INT_MAX (it's my fault that I missed this before creating the issue);
 2) `man 2 read` on my Linux system states that up to SSIZE_MAX must be 
 accepted;
 3) POSIX states the same as (2).
 
 In other words this behavior is correct from FreeBSD's point of view, 
 but FreeBSD does not meet standards here.
 Did I get it correctly?
 
 PS. It sounds pretty strange (at least for me) that 64-bit system cannot 
 read 2Gb at a time. Also, surprisingly read(fd, buff, size_t len) 
 doesn't work with "size_t  len" ( which is 8 bytes long ) greater than 
 "INT_MAX" (which is 4 bytes long).
 
 Regards,
 Eugene
 


More information about the freebsd-bugs mailing list