[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [bluetooth-dev] pid check when closing "bug"



If you try cat /dev/ttyBT0 and the line is busy or if the stack isn't 
initialized you will see that bt_close is called after failing to open
ttyBT. Apparantly this is correct behaviour but I agree it shouldn't do
close if it didn't get a proper file descriptor...

Anyone on the list that knows how it works ?
 
/M

> -----Original Message-----
> From: david LIBAULT [mailto:david.libault@xxxxxxx.fr]
> Sent: den 1 augusti 2001 12:11
> To: Mattias Ågren
> Cc: bluetooth-dev@xxxxxxx.com
> Subject: Re: [bluetooth-dev] pid check when closing "bug"
> 
> 
> Le Mercredi 01 Août 2001 12:08, Mattias Ågren a écrit :
> > Isn't that what it does ? ... it returns what bt_register_tty says,
> > bt_register_tty checks if it is already opened and returns 
> error back if
> > busy However, the app will still call bt_close after the 
> failed open.... i
> > haven't spent too much time on this and I'm sure there is a better
> > solution, feel free to suggest it !
> > /M
> 
> If the open fails the application should not receive a valid 
> file descriptor, 
> this application will then not be able to close the device. 
> Am I wrong ?
> 
> David.
> 
> >
> > > -----Original Message-----
> > > From: david LIBAULT [mailto:david.libault@xxxxxxx.fr]
> > > Sent: den 1 augusti 2001 11:32
> > > To: Mattias Ågren
> > > Cc: bluetooth-dev@xxxxxxx.com
> > > Subject: Re: [bluetooth-dev] pid check when closing "bug"
> > >
> > >
> > > How about having a flag in bluetooth.c that says that the
> > > ttyx is opened, and
> > > bt_open() checks this flags before registering...
> > >
> > > Le Mercredi 01 Août 2001 11:24, Mattias Ågren a écrit :
> > > > yes, that is a problem, do you have a solution that 
> still works when
> > > > someone tries to open a busy tty ?
> > > > /Mattias
> > > >
> > > > > -----Original Message-----
> > > > > From: david LIBAULT [mailto:david.libault@xxxxxxx.fr]
> > > > > Sent: den 1 augusti 2001 11:13
> > > > > To: Mattias Ågren
> > > > > Cc: bluetooth-dev@xxxxxxx.com
> > > > > Subject: Re: [bluetooth-dev] pid check when closing "bug"
> > > > >
> > > > > > > Remark on this last modification :
> > > > > > >
> > > > > > > Why should the pid be the same ? On my 
> application, this test
> > > > > > > fails causing
> > > > > > > the kernel to crash when the tty is tried to be opened...
> > > > > >
> > > > > > Not on mine ;) Can you describe in detail what goes wrong ?
> > > > >
> > > > > Yes, I can now.
> > > > > The ttyBTx port is opened by pppd (in my example, the pppd
> > > > > pid is 46). If
> > > > > your system has a /etc/ppp/ip-down script, this script is
> > > > > launched when the
> > > > > ppp connection terminates :
> > > > >
> > > > > Script /etc/ppp/ip-down started (pid 50)
> > > > > ...
> > > > > BT (driver) Unregistering tty on line 0
> > > > > BT (driver) bt_unregister_tty invalid pid.
> > > > > Current : 50 session : 46
> > > > >
> > > > > Script /etc/ppp/ip-down finished (pid 50)
> > > > >
> > > > > So in this case the ttyBTx port is opened with one pid and
> > > > > closed with
> > > > > another one, and my script doesn't open or close any port...
> > > > >
> > > > > > brgds
> > > > > > /Mattias
> > > >
> > > > -
> > > > To unsubscribe from this list: send the line "unsubscribe
> > >
> > > bluetooth-dev" in
> > >
> > > > the body of a message to majordomo@xxxxxxx.com
> >
> > -
> > To unsubscribe from this list: send the line "unsubscribe 
> bluetooth-dev" in
> > the body of a message to majordomo@xxxxxxx.com
> 
-
To unsubscribe from this list: send the line "unsubscribe bluetooth-dev" in
the body of a message to majordomo@xxxxxxx.com