Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8082

Other • 'ioctl(file_desc, IOCTL_SET_MSG, message);' return -1.

$
0
0
My host is Ubuntu 24.04.2 LTS running Buildroot master branch; my target is rpi3mb running rpioslite32bit. I successfully built my own ioctl.ko as a Buildroot external kernel module; had no problem of building an IOCTL app. Both building processes are using output/host/opt/ext-toolchain/bin/arm-buildroot-linux-gnueabihf-gcc; based on the /home/tclee/buildroot/output/build/linux-custom kernel source tree.

On my target system, I scp-downoladed my ioctl.ko and my app into an local ioctl folder. After that, I ran the following command to kick off the app debugging, with no problems:
# gdbserver /dev/ttyAMA0 a.out

On my host system, I ran commands as s error tclee@tclee-Latitude-E6230:~/programming/lkmpg/examples/other$ sudo /home/tclee/buildroot/output/host/bin/arm-buildroot-linux-gnueabihf-gdb a.out

<gdb> target remote de/ttyUSB0

The second command had no issues of 'Reading /lib/libc.so.6 from remote target.'.

Then I set breakpoint at the line of 'ret_val = ioctl(file_desc, IOCTL_SET_MSG, message);' ran the gdb continue command. This command ends up with the error message as shown on the subject line.

I hope the rpi forum members can tell me the cause of ioctl(...) failure.

FYI, I also ran the same commands sequence in my host system. But this error did not occure.

Thanks...

Statistics: Posted by tommyclee — Fri Aug 08, 2025 6:07 pm



Viewing all articles
Browse latest Browse all 8082

Trending Articles