IOCTL(2) UNIX Programmer's Manual IOCTL(2) NAME ioctl - control device SYNOPSIS #include ioctl(d, request, argp) int d; unsigned long request; char *argp; DESCRIPTION _I_o_c_t_l performs a variety of functions on open descriptors. In particular, many operating characteristics of character special files (e.g. terminals) may be controlled with _i_o_c_t_l requests. The writeups of various devices in section 4 dis- cuss how _i_o_c_t_l applies to them. An ioctl _r_e_q_u_e_s_t has encoded in it whether the argument is an "in" parameter or "out" parameter, and the size of the argument _a_r_g_p in bytes. Macros and defines used in specify- ing an ioctl _r_e_q_u_e_s_t are located in the file <_s_y_s/_i_o_c_t_l._h>. RETURN VALUE If an error has occurred, a value of -1 is returned and _e_r_r_n_o is set to indicate the error. ERRORS _I_o_c_t_l will fail if one or more of the following are true: [EBADF] _D is not a valid descriptor. [ENOTTY] _D is not associated with a character special device. [ENOTTY] The specified request does not apply to the kind of object that the descriptor _d refer- ences. [EINVAL] _R_e_q_u_e_s_t or _a_r_g_p is not valid. SEE ALSO execve(2), fcntl(2), mt(4), tty(4), intro(4N) Printed 11/26/99 March 4, 1986 1