idle (or inactivity) timeout in ash

Denys Vlasenko vda.linux at googlemail.com
Fri Feb 4 13:45:12 UTC 2011


On Thu, Feb 3, 2011 at 11:24 AM, Thomas Geulig <geulig at nentec.de> wrote:
> Thanks for the hints and explanations.
>
> Here is an updated patch.

Doesn't work as intended: needs additional <Enter> from the user after timeout.

# TMOUT=3 strace -tt -s99 -oLOG ./busybox ash
~/srcdevel/bbox/fix/busybox.t1 # <waiting ~10 seconds, nothing
happens> <pressing enter key>
timed out waiting for input: auto-logout
# _

LOG:
....
14:28:58.627959 rt_sigaction(SIGALRM, {0x8082d30, [ALRM],
SA_RESTORER|SA_RESTART, 0x80487fb}, {SIG_DFL, [], 0}, 8) = 0
14:28:58.628117 alarm(3)                = 0
...
14:28:58.651596 write(1, "~/srcdevel/bbox/fix/busybox.t1 # ", 33) = 33
14:28:58.673380 poll([{fd=0, events=POLLIN}], 1, 4294967295) = ?
ERESTART_RESTARTBLOCK (To be restarted)
14:29:01.628353 --- SIGALRM (Alarm clock) @ 0 (0) ---
^^^^^^^^^^^^^ 3 seconds passed
14:29:01.628462 sigreturn()             = -1 EINTR (Interrupted system call)
14:29:01.628632 poll([{fd=0, events=POLLIN}], 1, 4294967295) = 1
([{fd=0, revents=POLLIN}])
^^^^^^^^^^^^^ returns to poll which waits for input
14:29:08.852947 read(0, "\n", 1)        = 1
^^^^^^^^^^^^^ user pressed <Enter> (note timestamps!)
14:29:08.853149 write(1, "\n", 1)       = 1
14:29:08.853328 ioctl(0, SNDCTL_TMR_START or TCSETS, {B38400 opost
isig icanon echo ...}) = 0
14:29:08.853489 ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost
isig icanon echo ...}) = 0
14:29:08.853642 rt_sigaction(SIGWINCH, {SIG_DFL, [WINCH],
SA_RESTORER|SA_RESTART, 0x80487fb}, {0x80d62ad, [WINCH],
SA_RESTORER|SA_RESTART, 0x80487fb}, 8) = 0
14:29:08.853889 write(1, "\7timed out waiting for input:
auto-logout\n", 42) = 42
14:29:08.854075 ioctl(10, TIOCSPGRP, [3401]) = 0
14:29:08.854237 setpgid(0, 3401)        = 0
14:29:08.854386 close(10)               = 0
14:29:08.854528 _exit(0)                = ?

bash exits without waiting for line input to finish.

(I simplified patch a bit, see it in attachment)

-- 
vda
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1.patch
Type: application/octet-stream
Size: 1729 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20110204/1da01e92/attachment.obj>


More information about the busybox mailing list