lkml.org 
[lkml]   [1998]   [Aug]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: Out of ptys
Date
  root@chaos.analogic.com writes:
>
> > > open("/dev/ptyp2", O_RDWR) = 3
> > > ioctl(1, TCGETS, 0xbffff1dc) = -1 EINVAL (Invalid argument)
> > > ioctl(2, TCGETS, 0xbffff1d0) = -1 EINVAL (Invalid argument)
> > >
> > No, they are invalid because you don't have a stdout and stderr.
> > open() doesn't work the way you seem to think here.
>
> Well there was never a dup() of any kind, so there could not be a fd
> for stdout or stderr. I can see from the source that the idea was
> to open these devices until one could be found that did not fail.
>
Wrong. open() _always_ returns the first free fd. If it returns 3, then
0..2 are open, possibly to /dev/null or whatever. Most likely, your program
inherited them that way from the parent process.

--
Matthias Urlichs
noris network GmbH

-
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.altern.org/andrebalsa/doc/lkml-faq.html

\
 
 \ /
  Last update: 2005-03-22 13:44    [from the cache]
©2003-2011 Jasper Spaans