From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fa528,28ea7b019fb285f0 X-Google-Attributes: gidfa528,public X-Google-ArrivalTime: 2002-04-02 05:42:50 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: Paul Eggert Newsgroups: comp.unix.tru64 Subject: Re: read(fd, buf, N) fails when N doesn't fit in 32 bits? Date: 02 Apr 2002 05:42:47 -0800 Organization: Twin Sun Inc, El Segundo, CA, USA Message-ID: <7wwuvqxlm0.fsf@sic.twinsun.com> Sender: eggert@sic.twinsun.com References: <200204012205.QAA0000012227@gskc01.stowers-institute.org> <200204020013.g320DUf08044@shade.twinsun.com> <7wzo0mwi2e.fsf@sic.twinsun.com> User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/21.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: newsabuse@supernews.com Xref: archiver1.google.com comp.unix.tru64:7179 joda@pdc.kth.se (Johan Danielsson) writes: > For obscure reasons, read doesn't accept large buffers: > > if (uap->count > INT_MAX) > return (EINVAL); Ouch. My first reaction was "this violates POSIX!" but I just re-read the POSIX spec for "read" and it says "If the value of nbyte is greater than {SSIZE_MAX}, the result is implementation-defined." So -- what is the value of SSIZE_MAX on Tru64? Does SSIZE_MAX == INT_MAX? If so, then Tru64 conforms to POSIX after all, and I should limit reads to at most SSIZE_MAX bytes. I should do this anyway, to stay within the letter of POSIX law. If SSIZE_MAX == INT_MAX, that would suffice to avoid this problem on Tru64. > A workaround using readv is probably the easiest route. Thanks, but that would cause porting problems on other hosts, alas. I think I'll limit myself to (2**31 - 1)-byte reads.