* Re: [d-kernel] о pppd, группах процессов, терминалах, /dev/pts и SIGHUP]
@ 2005-10-15 20:31 ` Artem
2005-10-17 16:26 ` Artem
2005-10-16 7:58 ` Artem
1 sibling, 1 reply; 3+ messages in thread
From: Artem @ 2005-10-15 20:31 UTC (permalink / raw)
To: devel-kernel
Доброго времени суток!
Subject:
Re: [d-kernel] о pppd, группах процессов, терминалах, /dev/pts и SIGHUP
From:
Sergey Vlasov <vsu@altlinux.ru>
Date:
Thu, 13 Oct 2005 14:04:32 +0400
To:
devel-kernel@altlinux.ru
>tty_vhangup() для slave вызывается при закрытии master-а. Т.е., при
>разрыве соединения slmodemd должен закрыть дескриптор, полученный при
>открытии /dev/ptmx. Перед закрытием нужно открыть /dev/ptmx ещё раз,
>получить новое имя slave и перенаправить ссылку /dev/ttySL* на него;
>после закрытия нужно переключиться на использование нового дескриптора
>вместо закрытого. (Если переоткрывать /dev/ptmx после закрытия
>предыдущего, в течение некоторого времени /dev/ttySL* будет указывать
>на несуществующий терминал, что нежелательно.)
>
>Да, права на /dev/ttySL* при этом будут каждый раз слетать - их тоже
>придётся переустанавливать.
>
>
Что ж. Подобное поведение реализовал, причем патч получился очень
коротким и элегантным. :-)
Но - опять возникли вопросы. В частности:
1. в коде slmodemd выполняется ряд проверок if (termios.c_cflag&HUPCL) и
termios.c_cflag&CLOCAL на основании которых принимается решение об hup-е
модема - например, если во время сеанса ppp просто закрыть kppp - то
отрабатывает это HUPCL ветвление - модем кладет трубку. Но в самом
slmodemd никаких установок флага HUPCL и CLOCAL нигде не осуществляется.
Единственная настройка termios в нем осуществляется сделующими строками:
cfmakeraw(&termios);
termios.c_cflag |= HUPCL | ~CLOCAL;
^^^^^^^^^^^^^^
cfsetispeed(&termios, B115200);
cfsetospeed(&termios, B115200);
ret = tcsetattr(pty, TCSANOW, &termios);
но согласно man termios, cfmakeraw не устанавливает флаги HUPCL и
CLOCAL. Кто его должен выставлять? slmodemd - это верно?
Может - имеет смысл добавить (помечено ^^^^^) подобную строку (в
оригинале, повторяю, она отсутствует)?
2.Погуглив, выяснил, что pppd "кладет модем" установкой-сбросом DTR. В
man termios на этот счет ничего не говорится. Как отследить его
(приветствуются ссылки на исходники/документацию)? :-)
Rgds, Artem.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [d-kernel] о pppd, группах процессов, терминалах, /dev/pts и SIGHUP]
2005-10-15 20:31 ` [d-kernel] о pppd, группах процессов, терминалах, /dev/pts и SIGHUP] Artem
@ 2005-10-16 7:58 ` Artem
1 sibling, 0 replies; 3+ messages in thread
From: Artem @ 2005-10-16 7:58 UTC (permalink / raw)
To: devel-kernel
Доброго времени суток!
Subject:
Re: [d-kernel] о pppd, группах процессов, терминалах, /dev/pts и SIGHUP
From:
Sergey Vlasov <vsu@altlinux.ru>
Date:
Thu, 13 Oct 2005 14:04:32 +0400
To:
devel-kernel@altlinux.ru
>tty_vhangup() для slave вызывается при закрытии master-а. Т.е., при
>разрыве соединения slmodemd должен закрыть дескриптор, полученный при
>открытии /dev/ptmx. Перед закрытием нужно открыть /dev/ptmx ещё раз,
>получить новое имя slave и перенаправить ссылку /dev/ttySL* на него;
>после закрытия нужно переключиться на использование нового дескриптора
>вместо закрытого. (Если переоткрывать /dev/ptmx после закрытия
>предыдущего, в течение некоторого времени /dev/ttySL* будет указывать
>на несуществующий терминал, что нежелательно.)
>
>Да, права на /dev/ttySL* при этом будут каждый раз слетать - их тоже
>придётся переустанавливать.
>
>
Что ж. Подобное поведение реализовал, причем патч получился очень
коротким и элегантным. :-)
Но - опять возникли вопросы. В частности:
1. в коде slmodemd выполняется ряд проверок if (termios.c_cflag&HUPCL) и
termios.c_cflag&CLOCAL на основании которых принимается решение об hup-е
модема - например, если во время сеанса ppp просто закрыть kppp - то
отрабатывает это HUPCL ветвление - модем кладет трубку. Но в самом
slmodemd никаких установок флага HUPCL и CLOCAL нигде не осуществляется.
Единственная настройка termios в нем осуществляется сделующими строками:
cfmakeraw(&termios);
termios.c_cflag |= HUPCL | ~CLOCAL;
^^^^^^^^^^^^^^
cfsetispeed(&termios, B115200);
cfsetospeed(&termios, B115200);
ret = tcsetattr(pty, TCSANOW, &termios);
но согласно man termios, cfmakeraw не устанавливает флаги HUPCL и
CLOCAL. Кто его должен выставлять? slmodemd - это верно?
Может - имеет смысл добавить (помечено ^^^^^) подобную строку (в
оригинале, повторяю, она отсутствует)?
2.Погуглив, выяснил, что pppd "кладет модем" установкой-сбросом DTR. В
man termios на этот счет ничего не говорится. Как отследить его
(приветствуются ссылки на исходники/документацию)? :-)
Rgds, Artem.
^ permalink raw reply [flat|nested] 3+ messages in thread