Overview
| Artifact ID: | d9c1e7d5514feefda1556b5e8aec512a16a1d1ed |
|---|---|
| Ticket: | 558932ffffffffffffffffffffffffffffffffff
read one byte: fconfigure -buffersize 1 |
| User & Date: | nobody on 2002-05-23 07:14:22 |
Changes
- icomment:
Logged In: NO I understand read(2)'s behaviour is dependent on the type of file descriptor you are reading (file, pipe, etc.) and, for that matter, the OS, too. However, there are situtations where a real read(2) of one byte is required and, anyway, it's pretty odd not being able to do it. > I have to admit it was/is my belief too that [read] with an explicit > size allocates a buffer with that size and reads it in as less > iterations as possible. Seems that I have to recheck this. Try this while running strace on tclsh: set c [open /dev/zero] fconfigure $c -buffersize 10 -buffering none read $c 1 and you will see a read(fd, buf, 10) being issued. Now do the same with: set c [open /dev/zero] fconfigure $c -buffersize 1 -buffering none read $c 1 and no read(2) gets executed at all! Now that's kind of ok because it explicitly says the smallest buffersize is 10. I believe there should be no bounds on buffersize. I could accept begrudgingly an upper limit but a random lower limit of 10 is really wierd. regards, john
- login: "nobody"
- mimetype: "text/plain"
- username: "nobody"