3 ms·
For more context: ioctl means "We made this object's API file-like, but there's something we need to do with this object which we can't express in terms of the
by cbd1984 11y ago
For more context:
ioctl means "We made this object's API file-like, but there's something we need to do with this object which we can't express in terms of the normal file operations."
Setting terminal options is a classic use of ioctls: You have a file descriptor which connects to a terminal or, more likely, a pseudo-terminal, and now you need to ask the user on that terminal for a password. By default, the low-level code will echo every character back to the user, so they can see what they just typed, but that's insecure for passwords, so you need an ioctl to tell the low-level terminal handling code to not echo.
Plan 9 removed some of these warts, but it's hard to see a fully, truly elegant way to handle something which is mostly-file-like but has some un-file-like attributes programs need to frob.