Hello Peter,
this is not what I expected. I did the same as you again to be sure I was not missing something. but I get the same bad result (see below)
Are you using qemu-arm as static bin or qemu-arm as dynamic bin?
I also tested it on an another machine with another Kernel version, same result.
So, what is the difference between your environment and mine?
I send you my binary, so that you can test it directly on your machine. If it works, the issue comes within the compile phase.
Thank you for your support, again.
Best regards
Jon
$#/home/test_qemu_timer/src# arm-linux-gnueabihf-gcc -O2 -o timertest testTimer.cpp -static -pthread -lrt
testTimer.cpp: In function ‘void sig_alarm(int, siginfo_t*, void*)’:
testTimer.cpp:105:35: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘timer_t’ {aka ‘void
’} [-Wformat=]
105 | printf("signal from alarm %d %d %X\n", info->si_value.sival_int, m_tid[info->si_value.sival_int], info->si_value.sival_ptr);
| ~^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| int timer_t {aka void*}
| %p
testTimer.cpp:105:38: warning: format ‘%X’ expects argument of type ‘unsigned int’, but argument 4 has type ‘void*’ [-Wformat=]
105 | printf("signal from alarm %d %d %X\n", info->si_value.sival_int, m_tid[info->si_value.sival_int], info->si_value.sival_ptr);
| ~^ ~~~~~~~~~~~~~~~~~~~~~~~~
| |
|
| unsigned int
void*
| %p
testTimer.cpp: In function ‘void create_alarm(int, int)’:
testTimer.cpp:131:30: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘timer_t’ {aka ‘void
’} [-Wformat=]
131 | printf("Create timer %d %d\n", m_iNr, tid);
| ~^ ~~~
| | |
| int timer_t {aka void*}
| %p
testTimer.cpp: In function ‘void delete_alarm(int)’:
testTimer.cpp:143:30: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘timer_t’ {aka ‘void
’} [-Wformat=]
143 | printf("Remove timer %d %d\n", nr, m_tid[nr]);
| ~^ ~~~~~~~~~
| | |
| int timer_t {aka void*}
| %p
$#/home/test_qemu_timer/src# ls -l
total 764
-rw-r--r-- 1 root root 116 Jul 15 18:16 CMakeLists.txt
-rw-r--r-- 1 root root 4269 Jul 6 00:12 testTimer.cpp
-rwxr-xr-x 1 root root 766532 Jul 19 13:31 timertest
$/home/jon/test_qemu_timer/src# qemu-arm-static_ -version
qemu-arm version 5.2.0 (Debian 1:5.2+dfsg-9ubuntu3.3)
Copyright (c) 2003-2020 Fabrice Bellard and the QEMU Project developers
$#/home/test_qemu_timer/src# qemu-arm-static_ -L ../ timertest
Create timer 0 212795392
Create timer 1 212795392
Create timer 2 212795393
Create timer 3 212795394
Create timer 4 212795395
thread0: started
thread0: saw 0 alarms from 0
thread1: started
thread2: started
thread3: started
thread4: started
thread5: started
thread6: started
thread7: started
thread8: started
thread9: started
signal from alarm 0 212795392 0
signal from alarm 2 212795393 2
signal from alarm 4 212795395 4
signal from alarm 0 212795392 0
signal from alarm 1 212795392 1
signal from alarm 3 212795394 3
signal from alarm 2 212795393 2
signal from alarm 4 212795395 4
signal from alarm 0 212795392 0
signal from alarm 2 212795393 2
signal from alarm 4 212795395 4
Remove timer 0 212795392
signal from alarm 0 0 0
Error, already deleted
signal from alarm 2 212795393 2
signal from alarm 3 212795394 3
signal from alarm 4 212795395 4
signal from alarm 0 0 0
Error, already deleted
signal from alarm 2 212795393 2
signal from alarm 4 212795395 4
signal from alarm 0 0 0
Error, already deleted
signal from alarm 2 212795393 2
signal from alarm 4 212795395 4
signal from alarm 3 212795394 3
signal from alarm 0 0 0
Error, already deleted
signal from alarm 2 212795393 2
Remove timer 1 212795392
signal from alarm 4 212795395 4
^C
$#/home/test_qemu_timer/src# qemu-arm-static_ timertest
Create timer 0 212795392
Create timer 1 212795392
Create timer 2 212795393
Create timer 3 212795394
Create timer 4 212795395
thread0: started
thread0: saw 0 alarms from 0
thread1: started
thread2: started
thread3: started
thread4: started
thread5: started
thread6: started
thread7: started
thread8: started
thread9: started
signal from alarm 0 212795392 0
signal from alarm 2 212795393 2
signal from alarm 4 212795395 4
signal from alarm 0 212795392 0
signal from alarm 1 212795392 1
signal from alarm 4 212795395 4
signal from alarm 3 212795394 3
signal from alarm 2 212795393 2
signal from alarm 0 212795392 0
signal from alarm 2 212795393 2
signal from alarm 4 212795395 4
Remove timer 0 212795392
signal from alarm 0 0 0
signal from alarm 2 212795393 2
signal from alarm 4 212795395 4
Error, already deleted
signal from alarm 3 212795394 3
signal from alarm 0 0 0
Error, already deleted
signal from alarm 2 212795393 2
signal from alarm 4 212795395 4
signal from alarm 0 0 0
Error, already deleted
signal from alarm 4 212795395 4
signal from alarm 3 212795394 3
signal from alarm 2 212795393 2
signal from alarm 0 0 0
Error, already deleted
signal from alarm 2 212795393 2
Remove timer 1 212795392
signal from alarm 4 212795395 4
signal from alarm 2 212795393 2
signal from alarm 3 212795394 3
signal from alarm 4 212795395 4
signal from alarm 2 212795393 2
signal from alarm 4 212795395 4