select (2) (amongst other things) tells me whether I can write to a fd of a file without blocking. However, does it guarentee me that I can write a full 4096 bytes without blocking?
Note I am interested in normal files on disk. Not sockets or the like.
In other words: does select signal when we can just write one single byte to a file fd without blocking, or does it signal when we can write n (4096, … ?) bytes to a file fd without blocking.
Whenever
select()indicates that your file is ready, you can try writing N bytes, for any N>0.write()will return the number of bytes actually written. If it equals N, you can write again. If it’s less than N, then the next write will block.Note Normal files on disk don’t block. Sockets, pipes and terminals do.