Date: Tue, 10 Sep 2002 14:51:35 -0700 From: Terry Lambert <tlambert2@mindspring.com> To: Bakul Shah <bakul@bitblocks.com> Cc: Archie Cobbs <archie@dellroad.org>, freebsd-arch@FreeBSD.ORG Subject: Re: /dev/stdout behavior Message-ID: <3D7E6967.AC9D0F14@mindspring.com> References: <200209101717.NAA07504@wellington.cnchost.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Bakul Shah wrote: > > For example, if you use fcntl() to set flags on fd 0, and then open > > /dev/stdout, the new file descriptor you get back will have those > > same flags set. Run the program below to see an example. This is > > in agreement with the man page, which states that opening /dev/stdout > > is equivalent to dup(2)'ing fd 0. > > Careful reading of man stdout will reveal that opening > /dev/stdout is equivalent to dup()ing fd 1, not fd 0. > FreeBSD has a bug. The stdin and stdout fd's are not guaranteed to not share a struct file, so that's not correct. It's technically permitted to have the flag on the device or on the struct file, rather than the descriptor itself. In fact, the implementation pretty much demands it. -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3D7E6967.AC9D0F14>