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-03 16:37:14 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!arclight.uoregon.edu!enews.sgi.com!paloalto-snf1.gtei.net!news.gtei.net!news.compaq.com!news.cpqcorp.net!harris From: Bob Harris Newsgroups: comp.unix.tru64 Subject: Re: read(fd, buf, N) fails when N doesn't fit in 32 bits? References: <200204012205.QAA0000012227@gskc01.stowers-institute.org> <200204020013.g320DUf08044@shade.twinsun.com> <7wzo0mwi2e.fsf@sic.twinsun.com> <7wwuvqxlm0.fsf@sic.twinsun.com> User-Agent: MT-NewsWatcher/3.1 (PPC) Message-ID: Date: Wed, 03 Apr 2002 19:37:47 -0500 NNTP-Posting-Host: 16.140.32.31 X-Complaints-To: abuse@Compaq.com X-Trace: news.cpqcorp.net 1017880633 16.140.32.31 (Wed, 03 Apr 2002 16:37:13 PST) NNTP-Posting-Date: Wed, 03 Apr 2002 16:37:13 PST Organization: Compaq Computer Corporation Xref: archiver1.google.com comp.unix.tru64:7199 In article <7wwuvqxlm0.fsf@sic.twinsun.com>, Paul Eggert wrote: X joda@pdc.kth.se (Johan Danielsson) writes: X X > For obscure reasons, read doesn't accept large buffers: X > X > if (uap->count > INT_MAX) X > return (EINVAL); X X Ouch. X X My first reaction was "this violates POSIX!" but I just re-read the X POSIX spec for "read" and it says "If the value of nbyte is greater X than {SSIZE_MAX}, the result is implementation-defined." X X So -- what is the value of SSIZE_MAX on Tru64? Does SSIZE_MAX == X INT_MAX? If so, then Tru64 conforms to POSIX after all, and I should X limit reads to at most SSIZE_MAX bytes. I should do this anyway, to X stay within the letter of POSIX law. If SSIZE_MAX == INT_MAX, that X would suffice to avoid this problem on Tru64. X X > A workaround using readv is probably the easiest route. X X Thanks, but that would cause porting problems on other hosts, alas. I X think I'll limit myself to (2**31 - 1)-byte reads. SSIZE_MAX on Tru64 UNIX is LONG_MAX (aka a signed 64 bit value). I am _NOT_ a POSIX lawyer, but the wording only says what nbyte is if it is greater than SSIZE_MAX. It does not say that nbyte needs to be as large as SSIZE_MAX. I know this is cutting it rather thin, but an argument could be made along those lines. There are lots of loop holes in the POSIX standard, this could be an intentional loop hole, poor wording on the part of POSIS, or it could be an Oops on the part of Compaq. Your mileage may vary (mine always does :-) Bob Harris