Hi Jack,
This seems to be your exact problem:
https://stackoverflow.com/questions/57927360/how-to-fix-invalid-argument-for-ioctl-requests-to-block-device
Regards,
Henrik Morsing
------------------------------
Henrik Morsing
------------------------------
Original Message:
Sent: Wed October 23, 2024 02:19 AM
From: jack smith
Subject: MTIOCGET Invalid argument
Hi,
MTIOCGET doesn't work for me. The following program fails with "Invalid argument":
struct mtget smtget;
...
tape_fd = open("/dev/rmt0.1", O_RDONLY);
if (tape_fd == -1) {
perror("open");
exit(1);
}
rc = ioctl(tape_fd, MTIOCGET, &smtget);
if (!rc) {
perror("ioctl");
exit(1);
}
MTIOCTOP on the other hand works. However, sys/mtio.h has all the MTIOCGET stuff so what's the trick?