A friend of mine posted a blog about read() calls and the maximum amount you can read. It got me interested too, so I did some tests as well.
First of all, I notice the read() manpage states (man 2 read):
If count is zero, read() returns zero and has no other results. If count is greater than SSIZE_MAX, the result is unspecified.
SSIZE_MAX on my Linux system is 2gig, or 2^31. I cannot read more than that. In fact, the largest buffer I can malloc is about 2934062847. Both malloc() and read() take types of size_t, type unsigned long, which is 4gig, or 2^32. But it seems read() cannot read more than 2^31. Hm, I know I can't use values greater than 2^32 on 32-bit systems, but I would expect read() to do up to 2^32 and not only 2^31.
No Comments/Pingbacks for this post yet...
An ERROR has occured!
Here you might send email-notification to webmaster or something like that.