fix to util_sock.c

Jeremy Allison jeremy at valinux.com
Sun Nov 12 18:52:05 GMT 2000


On Sun, Nov 12, 2000 at 09:56:57PM +0900, okuyamak at dd.iij4u.or.jp wrote:

> 2) Instead of calling read() even for usual cases, I changed
>    it to use recv().
> 
> 3) socket_read() have 'flags' option, which is passed to recv().
>    Also, when this function is called from read_socket_data()
>   and read_data(), option MSG_WAITALL is passed.

We actually used to use this instead of read() on sockets,
but one of the earlier versions of Solaris I recall has a
horrible bug in recv which causes this to fail. I think
FreeBSD at some point had a problem with this also.

This is why we moved back to using read() without the flag,
as we discovered many problems with using MSG_WAITALL and
recv().

Whilst these systems are still being used out there it is
safer to use read(), as when we tested this change for performance
it did not improve us noticably, and caused many users with
the broken systems many problems.

For that reason I can't accept the change as-is, but I'll
look at the other changes.

However, for performance fixes, rather than internal code
cleanup, I'd much prefer people to do actual profiling and
report "with this patch I see XX% speedup on these actions",
rather than guessing what will improve things. I've done that
myself in the past, and my guesses like that have usually
been wrong :-) :-). With the actual report we will have at
least an idea of what to expect the changes rather than a
theoretical speedup.

Cheers,

		Jeremy.




More information about the samba-technical mailing list