From owner-freebsd-current Wed Nov 25 10:04:28 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id KAA25623 for freebsd-current-outgoing; Wed, 25 Nov 1998 10:04:28 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from highwind.com (hurricane.highwind.com [209.61.45.50]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id KAA25617 for ; Wed, 25 Nov 1998 10:04:26 -0800 (PST) (envelope-from info@highwind.com) Received: (from info@localhost) by highwind.com (8.8.6/8.8.6) id NAA02326; Wed, 25 Nov 1998 13:03:36 -0500 (EST) Date: Wed, 25 Nov 1998 13:03:36 -0500 (EST) Message-Id: <199811251803.NAA02326@highwind.com> From: HighWind Software Information To: mike@smith.net.au CC: current@FreeBSD.ORG In-reply-to: <199811251734.JAA01096@dingo.cdrom.com> (message from Mike Smith on Wed, 25 Nov 1998 09:34:33 -0800) Subject: Re: Resend Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Mike, > > I'm trying to track a problem where a "write()" to a socket > > sends the beginning of the data over and over. > > > > I'm looking at "sosend()" in uipc_socket.c, a comment says: > > > > > * Returns nonzero on error, timeout or signal; callers > > > * must check for short counts if EINTR/ERESTART are returned. > > > * Data and control buffers are freed on return. > > > > However, I don't see anywhere in the code where it returns > > EINTR/ERESTART. That is, if this code mistakenly loops when it gets > > interrupted or does a partial write(), it would result in the behavior > > I am seeing. > The sblock() macro can return this. Really??? #define sblock(sb, wf) ((sb)->sb_flags & SB_LOCK ? \ (((wf) == M_WAITOK) ? sb_lock(sb) : EWOULDBLOCK) : \ ((sb)->sb_flags |= SB_LOCK), 0) That doesn't look like it. Did I miss something? > You'll also get this behaviour if the socket is nonblocking and you > only make a partial write, but forget to update your buffer pointer/ > count before calling write() again. True. But, my reading of the libc_r write() code looks like it handles this perfectly. Maybe I missed something. On the outside, the descriptors are blocking, John Birrell's libc_r code loops and handles this correctly. I haven't been able to find any problems with that code. Maybe I missed something. It is in "lib/libc_r/uthread/uthread_write.c" -Rob To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message