Date: Sun, 17 Dec 2006 16:04:38 -0600 From: Dan Nelson <dnelson@allantgroup.com> To: Dieter <freebsd@sopwith.solgatos.com> Cc: freebsd-questions@freebsd.org Subject: Re: write(2) takes > 17 seconds even with O_NONBLOCK Message-ID: <20061217220438.GH43992@dan.emsphone.com> In-Reply-To: <200612172053.UAA01723@sopwith.solgatos.com> References: <200612172053.UAA01723@sopwith.solgatos.com>
next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Dec 17), Dieter said: > I've always thought that writing to a file descriptor with O_NONBLOCK > set was supposed to return quickly. Isn't that the whole point of > O_NONBLOCK ? > > I have a C program writing to stdout, which is set to O_NONBLOCK, and > the shell redirects stdout to a regular disk file. Dispite > O_NONBLOCK, my program reports that a write call took 17.701340 > seconds. "non-blocking" really only applies to sockets or pipes, and means "I have at least one free byte in my outbound buffer". Files don't have buffers and are always writable. There is no guarantee on how long the write will take, however. -- Dan Nelson dnelson@allantgroup.com
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20061217220438.GH43992>