>>160
there exists an abelson such that it smells bad
Name:
Anonymous2013-03-07 15:59
The same should apply to read(1), it should use the same 8k buffer and write it out whenever it fills up. The only important guarantee regarding read(1) is that when it encounters newline, it doesn't read past it, calls write and returns immediately. read -m should, on a sane OS, be in all respects identical to cat, and therefore shouldn't exist.
No, the difference is that cat calls read(fd, buffer, sizeof buffer), while read(1) calls read(fd, &c, 1). This is the difference between cat and read -m. The operating system has no notion of a line. The terminal device, on the other hand, might have.
Of course, read(1) could use a fixed buffer and write as soon as it's full, instead of dynamically resizing it. That's true.
Name:
Anonymous2013-03-08 4:57
No, the difference is that cat calls read(fd, buffer, sizeof buffer), while read(1) calls read(fd, &c, 1). This is the difference between cat and read -m.
The difference should be in observable behaviour. That's the point of discussing whether or not differently implemented operations are equal.
There's no difference in observable behaviour between cat and read -m on a sane OS.