Re: fsync() on unix domain sockets?

Richard B. Johnson (root@chaos.analogic.com)
Tue, 8 Apr 2003 21:10:01 -0400 (EDT)


On Tue, 8 Apr 2003, Dan Kegel wrote:

> Let's say someone had written a win32 emulator that
> ran in userspace, and was using unix domain sockets
> to emulate win32 named pipes. (Yes, this is how
> Wine does it at the moment, but it's a poor fit,
> and they're thinking of switching to emulating them 100%
> in userspace so they can get the semantics right.)
>

[SNIPPED...]

What problem are you attempting to fix? You will never find
any unflushed buffers in Unix Domain sockets because you need
an active reader before the write will succeed. The writer will
block until the reader has all the data. That's why they are
used for synchronization. Of course you don't know that the
reader has actually used the data, that's why you use semiphores
or other synchronizing elements. Unlike network sockets, where
the kernel just promises it will eventually get the data to a
connected socket, Unix domain sockets don't return control to
the writer until the reader has read the data.

Cheers,
Dick Johnson
Penguin : Linux version 2.4.20 on an i686 machine (797.90 BogoMips).
Why is the government concerned about the lunatic fringe? Think about it.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/