Can someone explain why wineserver passes it's UNIX stdin/out/err fd's to a
running wine program by socket-based FD transfer every time a wine application
wants to do an operation on it's idea of stdin/out/err?

This has some annoying effects:

* It's very difficult to redirect stdin/out/err on wine applications.

* The appropriate FD is passed _every_ time such an operation is issued (so if
  a lot of lines are being printed to stderr, say, a sendmsg/recvmsg pair is
  issued for every line).

* It costs a small fortune in context switches and message passing overhead.

To see what I mean, take a look at this "strace wine -- cl -?" excerpt...

write(3, "&\0\0\0", 4)                  = 4
recvmsg(3, {msg_name(0)=NULL, msg_iov(1)=[{"\0\0\0\0", 4}], msg_controllen=16, 
msg_control=0x406f68a4, , msg_flags=0}, 0) = 4
write(6, "\r\n", 2)                     = 2
close(6)                                = 0
write(3, "&\0\0\0", 4)                  = 4
recvmsg(3, {msg_name(0)=NULL, msg_iov(1)=[{"\0\0\0\0", 4}], msg_controllen=16, 
msg_control=0x406f68a4, , msg_flags=0}, 0) = 4
write(6, "                                "..., 44) = 44
close(6)                                = 0
write(3, "&\0\0\0", 4)                  = 4
recvmsg(3, {msg_name(0)=NULL, msg_iov(1)=[{"\0\0\0\0", 4}], msg_controllen=16, 
msg_control=0x406f68a4, , msg_flags=0}, 0) = 4
write(6, "\r\n", 2)                     = 2
close(6)                                = 0
write(3, "&\0\0\0", 4)                  = 4
recvmsg(3, {msg_name(0)=NULL, msg_iov(1)=[{"\0\0\0\0", 4}], msg_controllen=16, 
msg_control=0x406f68a0, , msg_flags=0}, 0) = 4
write(6, "(press <return> to continue)", 28) = 28
close(6)                                = 0

Every time it wants to write a line, it goes to wineserver (fd 3) and asks to
be sent a fd for stderr (fd 6).

David Howells

Reply via email to