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

Fix Unix ioctl call and exception text in waitForChange #224

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rhulme
Copy link

@rhulme rhulme commented Jun 8, 2020

ioctl call TIOCMIWAIT expects the flags as an immediate parameter, not a pointer.

alextoind added a commit to alextoind/serial that referenced this pull request Jun 27, 2020
This issue was reported in wjwwood/serial#224.
@wjwwood
Copy link
Owner

wjwwood commented Jun 10, 2021

@rhulme can you point to any documentation on this? I can't find anything specific about this. The only thing I can find is this on the ioctl man page:

The third argument is an untyped pointer to memory. It's traditionally char *argp (from the days before void * was valid C), and will be so named for this discussion.

-- https://man7.org/linux/man-pages/man2/ioctl.2.html

@rhulme
Copy link
Author

rhulme commented Jun 13, 2021

@rhulme can you point to any documentation on this? I can't find anything specific about this. The only thing I can find is this on the ioctl man page:

The third argument is an untyped pointer to memory. It's traditionally char *argp (from the days before void * was valid C), and will be so named for this discussion.

-- https://man7.org/linux/man-pages/man2/ioctl.2.html

@wjwwood : ioctl is a variadic function. It's up to the function itself to decide how many parameters it expects after the fixed parameters (in this case two) and what type they are. So the same way printf decides how to interpret the parameters that come after the format string.

As ioctl is a general-purpose interface for pretty much any kind of driver, the number and meaning of the parameters will vary from driver to driver (or at least between classes of driver).

The commands and parameters for the TTY class are described here:

https://man7.org/linux/man-pages/man4/tty_ioctl.4.html

TIOCMIWAIT
Argument: int arg

@rhulme
Copy link
Author

rhulme commented Nov 20, 2022

Just pinging this as the PR is still marked as "awaiting feedback" but I provided feedback in June 2021.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants