can't read open unix domain socket

rdm@tad.micro.umn.edu
3 Jul 1996 22:01:52 -0000


open("t", O_RDONLY) = 3
fstat(3, {st_mode=S_IFSOCK|0755, st_size=0, ...}) = 0
read(3, 0x8007000, 4096) = -1 ERRNO_22 (Invalid argument)

I'm having trouble understanding exactly what's happening here, both from
a philosophical, and from a mechanical viewpoint.

I'm guessing that when I open a unix domain socket, the file operations
are inherited from the file system, and that when I try to read, the
filesystem code (ext2, in this case) figures out it can't deal with the
socket...

Wouldn't it make sense to have the semantics of open(); read(); be
the same as socket(); connect(); read(); ? I think this means
constructing some fileops for the socket...

Then again, maybe not?

Can someone with some familiarity in this area point me in the right
direction?

[Aside: I'm trying to build a mechanism where I can create a document
that will be constructed over some period of time, and post a reference
to it before it's ready. Thus, I was thinking of having a unix domain
socket to provide something like tail -f till the document is constructed
then moving the buffer file into place over top the socket once everything
is stable. Unfortunately, at the moment, it looks like I'll have to hack
everything which would read from the file to use open/fstat/connect/etc.]