SDL test hangs at VT_WAITACTIVE

Hi,

I’ve cross-compiled the SDL-1.2.13 library for cris architecture. My embedded
platform uses no keyboard and has touchscreen (mouse) input interface that is
supported by the tslib library (working out of the box).
The test seem to run fine (platform has only 320x240x8bpp LCD) and input from
touchscreen is working.
The problem arises if I kill the test application and the try to re-run it. With
testpalette for example when I try to start the application another time (after
first instance was killed by killall -9 testpalette), the application hangs and
no output is seen on the LCD - note that the system is still running (eg login
with another telnet session).

I’ve managed to capture the strace output of ‘strace testpalette’. Below is the
last few lines before the ‘hang’ of the application:


ioctl(4, KDGKBENT, 0x9fda9414) = 0
ioctl(4, KDGKBENT, 0x9fda9414) = 0
ioctl(4, KDGKBENT, 0x9fda9414) = 0
ioctl(4, KDGKBENT, 0x9fda9414) = 0
ioctl(4, KDGKBENT, 0x9fda9414) = 0
ioctl(4, KDGKBENT, 0x9fda9414) = 0
ioctl(4, KDGKBENT, 0x9fda9414) = 0
access("/dev/gpmdata", F_OK) = -1 ENOENT (No such file or directory)
open("/dev/input/mice", O_RDWR) = -1 ENOENT (No such file or directory)
open("/dev/input/mice", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/dev/usbmouse", O_RDWR) = -1 ENOENT (No such file or directory)
open("/dev/usbmouse", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/dev/psaux", O_RDWR) = -1 ENOENT (No such file or directory)
open("/dev/psaux", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/dev/adbmouse", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/dev/mouse", O_RDONLY) = -1 ENOENT (No such file or directory)
rt_sigaction(SIGINT, {SIG_DFL}, {SIG_DFL}, 8) = 0
rt_sigaction(SIGINT, {SIG_DFL}, {SIG_DFL}, 8) = 0
rt_sigaction(SIGTERM, {SIG_DFL}, {SIG_DFL}, 8) = 0
rt_sigaction(SIGTERM, {SIG_DFL}, {SIG_DFL}, 8) = 0
rt_sigaction(SIGINT, {0x35575fe4, [INT], SA_RESTART}, {SIG_DFL}, 8) = 0
rt_sigaction(SIGTERM, {0x35575fe4, [TERM], SA_RESTART}, {SIG_DFL}, 8) = 0
gettimeofday({1444, 657478}, NULL) = 0
rt_sigaction(SIGSEGV, NULL, {SIG_DFL}, 8) = 0
rt_sigaction(SIGSEGV, {0x355ed658, [], 0}, NULL, 8) = 0
rt_sigaction(SIGBUS, NULL, {SIG_DFL}, 8) = 0
rt_sigaction(SIGBUS, {0x355ed658, [], 0}, NULL, 8) = 0
rt_sigaction(SIGFPE, NULL, {SIG_DFL}, 8) = 0
rt_sigaction(SIGFPE, {0x355ed658, [], 0}, NULL, 8) = 0
rt_sigaction(SIGQUIT, NULL, {SIG_DFL}, 8) = 0
rt_sigaction(SIGQUIT, {0x355ed658, [], 0}, NULL, 8) = 0
rt_sigaction(SIGALRM, NULL, {SIG_DFL}, 8) = 0
rt_sigaction(SIGALRM, {SIG_IGN}, NULL, 8) = 0
ioctl(4, VT_GETSTATE, 0x9fda945d) = 0
ioctl(4, VIDIOC_G_COMP or VT_ACTIVATE, 0x1) = 0
ioctl(4, VIDIOC_S_COMP or VT_WAITACTIVE <<<— HANG!!!

Now if try to send a HUP or another signal to the application the result is:

, 0x1) = ? ERESTARTNOHAND (To be restarted)
— SIGHUP (Hangup) @ 0 (0) —
+++ killed by SIGHUP +++
Process 847 detached

When sending a TERM signal the result is:
ioctl(4, KDGKBENT, 0x9fd65414) = 0
ioctl(4, KDGKBENT, 0x9fd65414) = 0
ioctl(4, KDGKBENT, 0x9fd65414) = 0
ioctl(4, KDGKBENT, 0x9fd65414) = 0
ioctl(4, KDGKBENT, 0x9fd65414) = 0
ioctl(4, KDGKBENT, 0x9fd65414) = 0
ioctl(4, KDGKBENT, 0x9fd65414) = 0
ioctl(4, KDGKBENT, 0x9fd65414) = 0
ioctl(4, KDGKBENT, 0x9fd65414) = 0
ioctl(4, KDGKBENT, 0x9fd65414) = 0
ioctl(4, KDGKBENT, 0x9fd65414) = 0
ioctl(4, KDGKBENT, 0x9fd65414) = 0
ioctl(4, KDGKBENT, 0x9fd65414) = 0
ioctl(4, KDGKBENT, 0x9fd65414) = 0
access("/dev/gpmdata", F_OK) = -1 ENOENT (No such file or directory)
open("/dev/input/mice", O_RDWR) = -1 ENOENT (No such file or directory)
open("/dev/input/mice", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/dev/usbmouse", O_RDWR) = -1 ENOENT (No such file or directory)
open("/dev/usbmouse", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/dev/psaux", O_RDWR) = -1 ENOENT (No such file or directory)
open("/dev/psaux", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/dev/adbmouse", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/dev/mouse", O_RDONLY) = -1 ENOENT (No such file or directory)
rt_sigaction(SIGINT, {SIG_DFL}, {SIG_DFL}, 8) = 0
rt_sigaction(SIGINT, {SIG_DFL}, {SIG_DFL}, 8) = 0
rt_sigaction(SIGTERM, {SIG_DFL}, {SIG_DFL}, 8) = 0
rt_sigaction(SIGTERM, {SIG_DFL}, {SIG_DFL}, 8) = 0
rt_sigaction(SIGINT, {0x35575fe4, [INT], SA_RESTART}, {SIG_DFL}, 8) = 0
rt_sigaction(SIGTERM, {0x35575fe4, [TERM], SA_RESTART}, {SIG_DFL}, 8) = 0
gettimeofday({2698, 16008}, NULL) = 0
rt_sigaction(SIGSEGV, NULL, {SIG_DFL}, 8) = 0
rt_sigaction(SIGSEGV, {0x355ed658, [], 0}, NULL, 8) = 0
rt_sigaction(SIGBUS, NULL, {SIG_DFL}, 8) = 0
rt_sigaction(SIGBUS, {0x355ed658, [], 0}, NULL, 8) = 0
rt_sigaction(SIGFPE, NULL, {SIG_DFL}, 8) = 0
rt_sigaction(SIGFPE, {0x355ed658, [], 0}, NULL, 8) = 0
rt_sigaction(SIGQUIT, NULL, {SIG_DFL}, 8) = 0
rt_sigaction(SIGQUIT, {0x355ed658, [], 0}, NULL, 8) = 0
rt_sigaction(SIGALRM, NULL, {SIG_DFL}, 8) = 0
rt_sigaction(SIGALRM, {SIG_IGN}, NULL, 8) = 0
ioctl(4, VT_GETSTATE, 0x9fd6545d) = 0
ioctl(4, VIDIOC_G_COMP or VT_ACTIVATE, 0x1) = 0
ioctl(4, VIDIOC_S_COMP or VT_WAITACTIVE, <<<— HANG!!!

0x1) = ? ERESTARTNOHAND (To be restarted)
— SIGTERM (Terminated) @ 0 (0) —
rt_sigaction(SIGTERM, {0x35575fe4, [TERM], SA_RESTART}, {0x35575fe4, [TERM],
SA_RESTART}, 8) = 0
sigreturn() = ? (mask now [])
ioctl(4, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo …}) = 0
ioctl(4, KDGKBMODE, 0x864f8) = 0
ioctl(4, SNDCTL_TMR_CONTINUE or TCSETSF, {B38400 opost -isig -icanon -echo …}) = 0
ioctl(4, KDSKBMODE, 0x2) = 0
ioctl(4, KDSETMODE, 0x1) = 0
ioctl(4, VIDIOC_S_FBUF or VT_LOCKSWITCH, 0x1) = 0
ioctl(3, FBIOPUTCMAP, 0x9fd65474) = 0
ioctl(3, FBIOGET_VSCREENINFO, 0x9fd654c4) = 0
ioctl(3, FBIOGET_FSCREENINFO, 0x9fd65564) = 0
ioctl(3, FBIOGETCMAP, 0x9fd64e64) = 0
brk(0x8a000) = 0x8a000
ioctl(3, FBIOPUTCMAP, 0x9fd64fa4) = 0
brk(0x9c000) = 0x9c000
open(“sail.bmp”, O_RDONLY) = 5
ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, 0x9fd65554) = -1 ENOTTY (Inappropriate
ioctl for device)
brk(0x9e000) = 0x9e000
_llseek(5, 0, [0], SEEK_CUR) = 0
_llseek(5, 0, [0], SEEK_CUR) = 0
read(5, “BM”, 2) = 2
read(5, “\362=\0\0”, 4) = 4

read(5, “AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA”…, 148) = 148
read(5, “AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA”…, 148) = 148
read(5, “AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA”…, 148) = 148
read(5, “AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA”…, 148) = 148
read(5, “AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA”…, 148) = 148
close(5) = 0
brk(0xa4000) = 0xa4000
ioctl(3, FBIOPUTCMAP, 0x9fd64ba4) = 0
brk(0xb8000) = 0xb8000
gettimeofday({2814, 923746}, NULL) = 0
select(5, [4], NULL, NULL, {0, 0}) = 0 (Timeout)
select(5, [4], NULL, NULL, {0, 0}) = 0 (Timeout)
brk(0xbe000) = 0xbe000
ioctl(3, FBIOPUTCMAP, 0x9fd64ba4) = 0
gettimeofday({2815, 109508}, NULL) = 0
write(1, “1 frames, 5.38 fps\n”, 191 frames, 5.38 fps
) = 19
rt_sigaction(SIGINT, {SIG_DFL}, {0x35575fe4, [INT], SA_RESTART}, 8) = 0
rt_sigaction(SIGTERM, {SIG_DFL}, {0x35575fe4, [TERM], SA_RESTART}, 8) = 0
munmap(0x356ee000, 81920) = 0
ioctl(3, FBIOPUTCMAP, 0x9fd655b0) = 0
ioctl(3, FBIOPUT_VSCREENINFO, 0x86444) = 0
close(3) = 0
ioctl(4, KDSETMODE, 0) = 0
ioctl(4, KDSKBMODE, 0x3) = 0
ioctl(4, SNDCTL_TMR_CONTINUE or TCSETSF, {B38400 opost isig icanon echo …}) = 0
ioctl(4, VT_UNLOCKSWITCH, 0x1) = 0
ioctl(4, VIDIOC_G_COMP or VT_ACTIVATE, 0x2) = 0
close(4) = 0
rt_sigaction(SIGSEGV, NULL, {0x355ed658, [], 0}, 8) = 0
rt_sigaction(SIGSEGV, {SIG_DFL}, NULL, 8) = 0
rt_sigaction(SIGBUS, NULL, {0x355ed658, [], 0}, 8) = 0
rt_sigaction(SIGBUS, {SIG_DFL}, NULL, 8) = 0
rt_sigaction(SIGFPE, NULL, {0x355ed658, [], 0}, 8) = 0
rt_sigaction(SIGFPE, {SIG_DFL}, NULL, 8) = 0
rt_sigaction(SIGQUIT, NULL, {0x355ed658, [], 0}, 8) = 0
rt_sigaction(SIGQUIT, {SIG_DFL}, NULL, 8) = 0
_exit(0) = ?
Process 859 detached

Let me just say that before the actual hang the line
ioctl(4, KDGKBENT, 0x9fda9414) = 0
is printed thousand and more times in strace output…

IHMO, that fact that I don’t have any keyboard attached should not make any
problems, I just want to check that with you - OTOH the KDGKBENT ioctl seems to
be taking a lot of time (iterations) to figure out that keyboard is not there.

What can be done about the VT_WAITACTIVE ioctl that seems to cause the hang?

Thank you,
Hinko–
?ETRTA POT, d.o.o., Kranj
Planina 3
4000 Kranj
Slovenia, Europe
Tel. +386 (0) 4 280 66 03
E-mail: @Hinko_Kocevar
Http: www.cetrtapot.si

What can be done about the VT_WAITACTIVE ioctl that seems to cause the
hang?

For the archives.
If signal handler for eg. SIGTERM signal is installed that looks like this:

void sigproc (int sig);

void sigproc (int sig)
{
SDL_Quit();
exit(1);
}

int main ()
{

signal(SIGTERM, sigproc);

}

Then killing a SDL app with “kill -15 pid” gracefully terminates the app, and
subsequent invocations of the SDL app succeed.–
?ETRTA POT, d.o.o., Kranj
Planina 3
4000 Kranj
Slovenia, Europe
Tel. +386 (0) 4 280 66 03
E-mail: @Hinko_Kocevar
Http: www.cetrtapot.si