[OT] why send()/recv() instead of write()/read()

Marc Lehmann schmorp at schmorp.de
Wed Nov 3 23:01:03 CET 2010


On Wed, Nov 03, 2010 at 10:34:02PM +0100, Zsbán Ambrus <ambrus at math.bme.hu> wrote:
> Nah, I just mean it doesn't guarantee to automatically show a regular
> file as (readable and) writable, so that you could have generic code

You have to keep in mind that this makes no sense - there is no semantics you
can attach to a readable/writable event w.r.t. files.

It's like calling connect on a pipe.

> that can output something (eg. logs or errors or data) to either a
> regular file or a pipe (without blocking the whole program if the pipe
> is stuck for a moment), and doesn't have to check which kind of file
> it is. 

Libev also doesn't make it possible to connect() on a pipe or any other
nonsensible operation. If your program wants to rely on that, it's already
broken by design, whether libev would synthesize such events or not.

Again, keep in mind that there is no sensible semantics to "the file is
now writable", except maybe for disk-full cases.

> You've already said that libev doesn't do that though.

The operating systems don't do that, this is not a libev limitation in any
way.

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at schmorp.de
      -=====/_/_//_/\_,_/ /_/\_\



More information about the libev mailing list