Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Sep 2002 01:10:05 -0700 (PDT)
From:      Peter Pentchev <roam@ringlet.net>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: misc/42943: fd 0,1,2 should not be set to nonblock in _thread_fd_table_init()
Message-ID:  <200209190810.g8J8A52S061666@freefall.freebsd.org>

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

From: Peter Pentchev <roam@ringlet.net>
To: Gregory Bond <gnb@itga.com.au>
Cc: bug-followup@FreeBSD.org
Subject: Re: misc/42943: fd 0,1,2 should not be set to nonblock in _thread_fd_table_init()
Date: Thu, 19 Sep 2002 11:07:19 +0300

 On Wed, Sep 18, 2002 at 09:50:03PM -0700, Gregory Bond wrote:
 [the PR submitter, pqf, wrote:]
 >  > parend process call dup2() to make fd 0 be a unix domain socket
 >  > parent process fork() muti-thread(pthread) child process
 >  > child process set fd 0 to nonblock in _thread_fd_table_init()
 >  > fd 0 is shared between parent process and child process, so the parent proces
 >  > s's fd 0 is now nonblock, but the parent process DO NOT know what happen beca
 >  > use it DID NOT do anything to fd 0...
 >  
 >  I would argue this is a bug in the (parent) program - if you are going to 
 >  share file descriptors, you'd better make sure you understand what the other 
 >  program is going to do to them!
 
 I fully agree.  If the thread library did not set fd's 0, 1, 2 to
 non-blocking mode, then any attempt of a thread to read/write to them
 would, well, block - blocking the whole application along the way.
 
 G'luck,
 Peter
 
 -- 
 Peter Pentchev	roam@ringlet.net	roam@FreeBSD.org
 PGP key:	http://people.FreeBSD.org/~roam/roam.key.asc
 Key fingerprint	FDBA FD79 C26F 3C51 C95E  DF9E ED18 B68D 1619 4553
 because I didn't think of a good beginning of it.

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?200209190810.g8J8A52S061666>