I remember running into this a couple of years ago. I _THINK_ what I remember
finding out is that bash needed a file descriptor for its own internal use
for executing commands like "source myfile.sh". The use of FD 255 was an
attempt to get hold of a file descriptor that was not likely to collide with
file descriptors that a user might be using in their scripts. I dont remember
the exact details. Here is the code from jobs.c of the bash 1.14.7 sources:
/* Make sure that we are using the new line discipline. */
/* Get our controlling terminal. If job_control is set, or
interactive is set, then this is an interactive shell no
matter what. */
shell_tty = dup (fileno (stderr));
/* Find the highest unused file descriptor we can. */
{
int ignore, nds = getdtablesize ();
if (nds <= 0)
nds = 20;
else if (nds > 256)
nds = 256;
while (--nds > 3)
{
if (fcntl (nds, F_GETFD, &ignore) == -1)
break;
}
Jim
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/