Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an ioctl example #294

Merged
merged 1 commit into from
Sep 7, 2024
Merged

Add an ioctl example #294

merged 1 commit into from
Sep 7, 2024

Conversation

colinmarc
Copy link
Contributor

This matches libfuse's example:

https://github.com/libfuse/libfuse/blob/d30247c36dadd386b994cd47ad84351ae68cc94c/example/ioctl.c

Unfortunately, it doesn't work at present. After mounting at /tmp/foobar, you can test it by compiling libfuse's ioctl client:

git clone https://github.com/libfuse/libfuse
cd libfuse/example
gcc -Wall ioctl_client.c `pkg-config fuse3 --cflags --libs` -o ioctl_client
./ioctl_client /tmp/foobar/fioc

This example returns ENOTTY without ever hitting the ioctl handler:

openat(AT_FDCWD, "/tmp/foobar/fioc", O_RDWR) = 3
ioctl(3, _IOC(_IOC_READ, 0x45, 0, 0x8), 0x7fffaf4404b0) = -1 ENOTTY (Inappropriate ioctl for device)

Whereas the libfuse example works:

ioctl(3, _IOC(_IOC_READ, 0x45, 0, 0x8), 0x7ffdb6c5b970) = 0

I'm happy to do the work for a fix, but I haven't been able to figure out where the bug is yet :)

@colinmarc
Copy link
Contributor Author

Ok, figured it out. I needed --features abi-7-11 and to generate the ioctl codes correctly.

@cberner cberner merged commit 7f338a9 into cberner:master Sep 7, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants