Artifacts Associated With Ticket 558932ffffffffffffffffffffffffffffffffff
Ticket change [1921aec0a4] (rid 122767) by nobody on 2002-05-22 00:14:20:
- assignee initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
Allow read(n) to read one byte, i.e. a system call of read(2) asks for one byte. At the moment fconfigure(n) accepts a -buffersize argument but it has a minimum size of 10, perhaps this minimun could be 1 instead. It seems really bad not being able to do a read(fd, buf, 1) in tcl. If you do a "read $chan 1" a system call read is performed with the "buffersize" specified in fconfigure or some default (4k on Linux). So, if you do fconfigure $chan -buffersize 10 read $chan 1 a read(fd, buf, 10) system call is issued. So far, so good. However, you cannot specify a -buffersize of less than 10. Actually, fconfigure accepts it but no reads are ever issued. regards, john
- foundin initialized to: "None"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "nobody"
- subsystem initialized to: "25. Channel System"
- title initialized to: "read one byte: fconfigure -buffersize 1"
- type initialized to: "RFE"
Ticket change [402ee9c06d] (rid 121591) by hobbs on 2002-05-22 09:03:14:
- assignee changed to: "andreas_kupries"
- icomment:
Logged In: YES user_id=72656 I don't see why we need a minimum buffersize (well, at least 1 I guess).
- login: "hobbs"
- mimetype: "text/plain"
- username: "hobbs"
Ticket change [794e9f61f9] (rid 90104) by dkf on 2002-05-22 20:03:12:
- icomment:
Logged In: YES user_id=79902 read(2) isn't required to completely fill the buffer it is passed. Check the return code to the syscall to see how much was actually read in... This only matters when Tcl and some other software not sharing Tcl's I/O layer are competing for a channel that is producing more than each piece of software wants to read at a time. I think...
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [827ab58e5f] (rid 117243) by dgp on 2002-05-22 22:02:46:
- icomment:
Logged In: YES user_id=80530 Note there's a documented max limit on -buffersize of one million as well. What is the origin/purpose of these limits? How were these values chosen?
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [d9c1e7d551] (rid 107666) by nobody on 2002-05-23 07:14:22:
- 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"
- icomment:
Ticket change [9bb3a529ef] (rid 148452) by dgp on 2016-08-24 12:15:49:
- assignee changed to: "dgp"
- closedate changed to: "2457625.01099422"
- closer changed to: "dgp"
- comment changed to:
Allow read(n) to read one byte, i.e. a system call of read(2) asks for one byte. At the moment fconfigure(n) accepts a -buffersize argument but it has a minimum size of 10, perhaps this minimun could be 1 instead. It seems really bad not being able to do a read(fd, buf, 1) in tcl. If you do a "read $chan 1" a system call read is performed with the "buffersize" specified in fconfigure or some default (4k on Linux). So, if you do fconfigure $chan -buffersize 10 read $chan 1 a read(fd, buf, 10) system call is issued. So far, so good. However, you cannot specify a -buffersize of less than 10. Actually, fconfigure accepts it but no reads are ever issued. regards, john
- icomment:
This was fixed in 2005.
- login: "dgp"
- mimetype: "text/plain"
- resolution changed to: "Out of Date"
- severity changed to: "Minor"
- status changed to: "Closed"