Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Sep 2002 09:30:03 -0700 (PDT)
From:      alo@louko.com (Antti Louko)
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: misc/41331: Pthread library open sets O_NONBLOCK flag and causes  unnecessary EAGAIN errors especially with /dev/stdout.
Message-ID:  <200209101630.g8AGU36d091105@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR misc/41331; it has been noted by GNATS.

From: alo@louko.com (Antti Louko)
To: archie@packetdesign.com
Cc: freebsd-gnats-submit@FreeBSD.org, deischen@freebsd.org
Subject: Re: misc/41331: Pthread library open sets O_NONBLOCK flag and causes 
 unnecessary EAGAIN errors especially with /dev/stdout.
Date: 10 Sep 2002 16:26:31 -0000

    Sender: archie@dellroad.org
    Date: Tue, 10 Sep 2002 08:26:40 -0700
    From: Archie Cobbs <archie@packetdesign.com>
    Organization: Packet Design
    X-Accept-Language: en
    CC: freebsd-gnats-submit@FreeBSD.org, deischen@freebsd.org
 
    Antti Louko wrote:
    > I just tried it in 4.6 Release and 4.6.2 and it still occurs. 
 
    I think this is a kernel bug, rather than a pthread bug.
 
    What's happening is that the file descriptor associated with
    /dev/stdout is "inheriting" the flags associated with file
    descriptor 0. This happens on both -stable and -current.
 
    This seems like broken behavior to me: flags should be associated
    with the file descriptor, not the underlying device or entity.
    But I don't know what the "official" semantics of /dev/stdout
    are supposed to be.
 
    The program below demonstrates the problem:
 
      $ cc -g -Wall -o flags flags.c
      $ ./flags 
      O_NONBLOCK is set
 
 But the O_NONBLOCK is not set in the kernel.  It is probably set in
 /usr/src/lib/libc_r/uthread/uthread_fd.c (which sets O_NONBLOCK flags
 for fds in range 0..2) or somewhere else in libc_r because it doesn't
 happen without thread library.  But someone who is familiar with the
 pthreads library should check what should happen.
 
 I don't feel competent to fix this.
 
 Regards,
 
 	Antti

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200209101630.g8AGU36d091105>