comments on proposed uthread_write.c changes

Dan Langille dan at langille.org
Mon Sep 8 12:38:33 PDT 2003


On 7 Sep 2003 at 19:40, Dan Langille wrote:

> On 7 Sep 2003 at 12:32, Daniel Eischen wrote:
> 
> > On Sun, 7 Sep 2003, Dan Langille wrote:
> > 
> > > A problem with pthreads and EOT has been identified.  See PR 56274.  It
> > > was suggested the solution was probably just a matter of changing one of
> > > the >0 tests to >=0 in uthread_write.c
> > > 
> > > Any comments on that?
> > 
> > I don't know that a return of 0 isn't valid for other devices.
> > If this is the case, a return of 0 for blocking writes may break
> > other applications.
> > 
> > The patch isn't quite correct (at least looking at -current srcs).
> > Lines 98-99 are:
> > 
> > 			if (blocking && ((n < 0 && (errno == EWOULDBLOCK ||
> > 			    errno == EAGAIN)) || (n >= 0 && num < nbytes))) {
> > 
> > This will get entered first if n == 0, and I don't think your
> > proposed patch would have any effect.  I think you would have
> > to change the "n >= 0" above to be "n > 0" in conjunction with
> > your patch.
> 
> Ahh thank you.  That explains why the test results with the original 
> patch did not differ from -STABLE or 5.1-RELEASE.  After adding your 
> suggestions, we have had success.

Oh I was wrong, very wrong.  The test code I ran had not been 
compiled with pthreads.  Kern found my mistake after he was unable to 
reproduce my [false] results.

It appears the problem is not with uthread_write.c... Or at least not 
in the areas we are changing.

Suggestions?
-- 
Dan Langille : http://www.langille.org/



More information about the freebsd-hackers mailing list