Re: Bash uses fd 255?

Andreas Schwab (schwab@issan.informatik.uni-dortmund.de)
25 Mar 1998 17:07:16 +0100


Bill Hawes <whawes@star.net> writes:

|> I'm working on a patch to provide an expandable fd array and have run into an
|> odd problem, apparently in bash. For some reason the shell is using the
|> sys_dupfd2 call to move fd 3 to fd 255, so that it ends up with fds 0, 1, 2, and
|> 255. This of course forces my patch to expand the fd array even though only four
|> descriptors are in use.

|> Can anyone explain why this is being done?

Fd 255 is used internally as a connection to the tty, so that it doesn't
interfere with the use of exec to relocate fds. Bash also allocates high
fds when handling a process substitution `<(foo)', for the same reason.

-- 
Andreas Schwab                                      "And now for something
schwab@issan.informatik.uni-dortmund.de              completely different"
schwab@gnu.org

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu