Re: Out of ptys

Gert Doering (gert@greenie.muc.de)
Tue, 25 Aug 1998 19:45:52 +0200 (MEST)


Richard Johnson wrote:

>On 25 Aug 1998, Matthias Urlichs wrote:
>> > > > open("/dev/ptyp2", O_RDWR) = 3
>> > > > ioctl(1, TCGETS, 0xbffff1dc) = -1 EINVAL (Invalid argument)
>> > > > ioctl(2, TCGETS, 0xbffff1d0) = -1 EINVAL (Invalid argument)
[..]

>Don't you love the way these replies start! Always with "wrong" or "no".

Must be something with the way you write e-mails. Only rarely happens
for me - see below for a possible reason.

>The "program" to which you refer is telnetd. The ioctls failed because
>there were no open fds 1 or 2, yet an open returned 3. Telnetd failed
>because this was unexpected behavior.

My man page for ioctl() says:

ioctl( int d, int request, ... )

[The "third" argument is traditionally char * argp, and
will be so named for this discussion]

...

ERRORS

EBADF d not a valid file descriptor.

ENOTTY d is not associated with a character special device.

ENOTTY The specified request does not apply to the kind of
object that the descriptor d references.

EINVAL request or argp is not valid

So, obviously, "1" and "2" *are* open and valid file descriptors, and
the behaviour seen (open() returning "3") is thus perfectly ok.

gert

-- 
email: gert@greenie.muc.de   fax: +49-89-3244814   http://www.leo.org/~doering

Murphy's Fifth Law: If anything just cannot go wrong, it will anyway.

- 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