#
0f6f5adb |
|
18-Oct-2021 |
Adrien Destugues <pulkomandy@pulkomandy.tk> |
generic/tty: restore lock sharing between master and slave TTYs The code in this module was derived from the one in driver/tty. However, the driver uses a shared lock between the master and slave side of a TTY, and this was changed to use two separate locks. The approach with two locks does not work. It seems the change was unfinished and the second TTY was never locked. But attempting to lock it will result in lock inversion problems, unless we do complicated things (try to find which of the two TTY is the master side, and lock that first, for example). It is simpler to restore the shared lock as used in the driver. To set up the shared lock, I modified the tty_create function to take a pointer to the master TTY when creating the slave. Maybe it makes more sense to create both sides in the same call, create_tty_pair? However, this does not work as easily as I wanted, because there is some recursion going on: at least in one case, the tty_control function is calling the driver's tty_service function, which in turns attempts to call back into tty_control for the "other side" TTY. To handle this case, replace the mutex with a recursive_lock. Fixes #17091, where the root problem was access to other_tty->select_pool without locking. This was also made unconvenient to debug because select_pool objects are self-deleting, when the last item in the pool is removed. As a result, the code accessing it without log would suddenly find out that the data it was accessing had been freed and erased. This also makes the TTY code in driver/tty and generic/tty a bit more similar than it was before, and brings us one step closer to merging the two together. There are still two main differences and I don't know enough about TTY to decide if they are important, and which version should be kept: - The driver has extra code for "background" read and write. I don't know what this is used for. - The driver has a single "settings" instance shared by a master and slave TTY, while the module has two separate instances, but seems to copy one to the other. I'm not sure which approach is correct. Change-Id: Ie2daddd027859ce32ba395af76b4f109f8b984b0 Reviewed-on: https://review.haiku-os.org/c/haiku/+/4604 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
|
#
91bcf08e |
|
07-Dec-2010 |
Michael Lotz <mmlr@mlotz.ch> |
Adding a generic tty module based largely on the tty driver. This has a new API and doesn't come with BeOS backwards compatibility. It also has the BeOS compatibility ioctl ops removed and such. I've actually made this back in april, so I don't really remember any more details. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39760 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
16c5a72847d78da6bb6f81e6968bbabc59ea637c |
|
13-Jun-2011 |
Michael Lotz <mmlr@mlotz.ch> |
* Seperate out the tty_close_cookie from tty_destory_cookie and make the former available as a module function as well. * Remove some unneeded resetting from tty_destroy_cookie. * Move the public module functions to the public API section of the file and order them by their declaration order in the module info. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42154 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
91bcf08ee50af0da44d5d8631477e7c08c5e0255 |
|
07-Dec-2010 |
Michael Lotz <mmlr@mlotz.ch> |
Adding a generic tty module based largely on the tty driver. This has a new API and doesn't come with BeOS backwards compatibility. It also has the BeOS compatibility ioctl ops removed and such. I've actually made this back in april, so I don't really remember any more details. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39760 a95241bf-73f2-0310-859d-f6bbb57e9c96
|