serial icon indicating copy to clipboard operation
serial copied to clipboard

Fix Unix ioctl call and exception text in waitForChange

Open rhulme opened this issue 4 years ago • 3 comments

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

rhulme avatar Jun 08 '20 18:06 rhulme

@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 avatar Jun 10 '21 21:06 wjwwood

@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 avatar Jun 13 '21 14:06 rhulme

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

rhulme avatar Nov 20 '22 15:11 rhulme