At some point during my C programming adventures on Linux, I encountered flags (possibly ioctl/fcntl?), that make reads and writes on a file descriptor uninterruptible.
Unfortunately I cannot recall how to do this, or where I read it. Can anyone shed some light?
Update0
To refine my query, I’m after the same blocking and guarantees that fwrite() and fread() provide, sans userspace buffering.
You can avoid
EINTRfromread()andwrite()by ensuring all your signal handlers are installed with theSA_RESTARTflag ofsigaction().However this does not protect you from short reads / writes. This is only possible by putting the
read()/write()into a loop (it does not require an additional buffer beyond the one that must already be supplied to theread()/write()call.)Such a loop would look like: