X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=original%2Fman4%2Ftty_ioctl.4;h=eebafc366f9e02a9cd10e6c04a82263bf447f838;hb=361fd72f831aabd8a0aa6fe7bc4ef66ef4f89a1b;hp=2c5db8ba613be7568c04a246f19d87db87fe65dc;hpb=8fbe23d0114c8804c4cfb5b6c57f3ca09c8fee1d;p=linuxjm%2FLDP_man-pages.git diff --git a/original/man4/tty_ioctl.4 b/original/man4/tty_ioctl.4 index 2c5db8ba..eebafc36 100644 --- a/original/man4/tty_ioctl.4 +++ b/original/man4/tty_ioctl.4 @@ -1,8 +1,11 @@ .\" Copyright 2002 Walter Harms .\" and Andries Brouwer . -.\" Distributed under GPL. .\" -.TH TTY_IOCTL 4 2008-10-29 "Linux" "Linux Programmer's Manual" +.\" %%%LICENSE_START(GPL_NOVERSION_ONELINE) +.\" Distributed under GPL +.\" %%%LICENSE_END +.\" +.TH TTY_IOCTL 4 2013-11-12 "Linux" "Linux Programmer's Manual" .SH NAME tty_ioctl \- ioctls for terminals and serial lines .SH SYNOPSIS @@ -13,8 +16,10 @@ tty_ioctl \- ioctls for terminals and serial lines The .BR ioctl (2) call for terminals and serial ports accepts many possible command arguments. -Most require a third argument, of varying type, here called \fIargp\fP -or \fIarg\fP. +Most require a third argument, of varying type, here called +.I argp +or +.IR arg . .LP Use of .I ioctl @@ -22,7 +27,7 @@ makes for nonportable programs. Use the POSIX interface described in .BR termios (3) whenever possible. -.SS "Get and Set Terminal Attributes" +.SS Get and set terminal attributes .TP .BI "TCGETS struct termios *" argp Equivalent to @@ -56,18 +61,18 @@ The following four ioctls are just like .BR TCSETSW , .BR TCSETSF , except that they take a -.I "struct termio *" +.I "struct termio\ *" instead of a -.IR "struct termios *" . -.TP +.IR "struct termios\ *" . +.IP .BI "TCGETA struct termio *" argp -.TP +.IP .BI "TCSETA const struct termio *" argp -.TP +.IP .BI "TCSETAW const struct termio *" argp -.TP +.IP .BI "TCSETAF const struct termio *" argp -.SS "Locking the termios structure" +.SS Locking the termios structure The .I termios structure of a terminal can be locked. @@ -85,10 +90,10 @@ structure of the terminal. Sets the locking status of the .I termios structure of the terminal. -Only root (more precisely: a process with the +Only a process with the .BR CAP_SYS_ADMIN -capability) can do this. -.SS "Get and Set Window Size" +capability can do this. +.SS Get and set window size Window sizes are kept in the kernel, but not used by the kernel (except in the case of virtual consoles, where the kernel will update the window size when the size of the virtual console changes, @@ -120,7 +125,7 @@ When the window size changes, a .B SIGWINCH signal is sent to the foreground process group. -.SS "Sending a Break" +.SS Sending a break .TP .BI "TCSBRK int " arg Equivalent to @@ -168,7 +173,7 @@ Turn break on, that is, start sending zero bits. .TP .B "TIOCCBRK void" Turn break off, that is, stop sending zero bits. -.SS "Software flow control" +.SS Software flow control .TP .BI "TCXONC int " arg Equivalent to @@ -181,7 +186,7 @@ for the argument values .BR TCOON , .BR TCIOFF , .BR TCION . -.SS "Buffer count and flushing" +.SS Buffer count and flushing .TP .BI "FIONREAD int *" argp Get the number of bytes in the input buffer. @@ -203,11 +208,11 @@ for the argument values .BR TCIFLUSH , .BR TCOFLUSH , .BR TCIOFLUSH . -.SS "Faking input" +.SS Faking input .TP .BI "TIOCSTI const char *" argp Insert the given byte in the input queue. -.SS "Redirecting console output" +.SS Redirecting console output .TP .B "TIOCCONS void" Redirect output that would have gone to @@ -218,9 +223,9 @@ to the given terminal. If that was a pseudoterminal master, send it to the slave. In Linux before version 2.6.10, anybody can do this as long as the output was not redirected yet; -since version 2.6.10, only root (a process with the +since version 2.6.10, only a process with the .BR CAP_SYS_ADMIN -capability) may do this. +capability may do this. If output was redirected already .B EBUSY is returned, @@ -230,23 +235,27 @@ pointing at .I /dev/console or .IR /dev/tty0 . -.SS "Controlling terminal" +.SS Controlling terminal .TP .BI "TIOCSCTTY int " arg Make the given terminal the controlling terminal of the calling process. The calling process must be a session leader and not have a controlling terminal already. +For this case, +.I arg +should be specified as zero. + If this terminal is already the controlling terminal -of a different session group then the ioctl fails with +of a different session group, then the ioctl fails with .BR EPERM , -unless the caller is root (more precisely: has the +unless the caller has the .BR CAP_SYS_ADMIN -capability) and +capability and .I arg equals 1, in which case the terminal is stolen, and all processes that had it as controlling terminal lose it. .TP -.B TIOCNOTTY void +.B "TIOCNOTTY void" If the given terminal was the controlling terminal of the calling process, give up this controlling terminal. If the process was session leader, @@ -256,7 +265,7 @@ and .B SIGCONT to the foreground process group and all processes in the current session lose their controlling terminal. -.SS "Process group and session ID" +.SS Process group and session ID .TP .BI "TIOCGPGRP pid_t *" argp When successful, equivalent to @@ -277,7 +286,7 @@ This will fail with in case the terminal is not a master pseudoterminal and not our controlling terminal. Strange. -.SS "Exclusive mode" +.SS Exclusive mode .TP .B "TIOCEXCL void" Put the terminal into exclusive mode. @@ -286,20 +295,20 @@ No further operations on the terminal are permitted. (They will fail with .BR EBUSY , -except for root, that is, a process with the +except for a process with the .BR CAP_SYS_ADMIN capability.) .TP .B "TIOCNXCL void" Disable exclusive mode. -.SS "Line discipline" +.SS Line discipline .TP .BI "TIOCGETD int *" argp Get the line discipline of the terminal. .TP .BI "TIOCSETD const int *" argp Set the line discipline of the terminal. -.SS "Psuedoterminal ioctls" +.SS Pseudoterminal ioctls .TP .BI "TIOCPKT const int *" argp Enable (when @@ -346,7 +355,7 @@ The BSD ioctls .BR TIOCUCNTL , .B TIOCREMOTE have not been implemented under Linux. -.SS "Modem control" +.SS Modem control .TP .BI "TIOCMGET int *" argp get the status of modem bits. @@ -375,7 +384,7 @@ TIOCM_RNG RNG (ring) TIOCM_RI see TIOCM_RNG TIOCM_DSR DSR (data set ready) .fi -.SS "Marking a line as local" +.SS Marking a line as local .TP .BI "TIOCGSOFTCAR int *" argp ("Get software carrier flag") @@ -405,12 +414,12 @@ If is set, the line behaves as if DCD is always asserted. The software carrier flag is usually turned on for local devices, and is off for lines with modems. -.SS "Linux-specific" +.SS Linux-specific For the .B TIOCLINUX ioctl, see .BR console_ioctl (4). -.SS "Kernel debugging" +.SS Kernel debugging .B "#include " .TP .BI "TIOCTTYGSTRUCT struct tty_struct *" argp @@ -428,11 +437,11 @@ corresponding to .\" .TP .\" .BI "TIOCSSERIAL const struct serial_struct *" argp .\" Set serial info. -.SH "RETURN VALUE" +.SH RETURN VALUE The .BR ioctl (2) system call returns 0 on success. -On error it returns \-1 and sets +On error, it returns \-1 and sets .I errno appropriately. .SH ERRORS @@ -471,7 +480,7 @@ main(void) close(fd); } .fi -.SH "SEE ALSO" +.SH SEE ALSO .BR ioctl (2), .BR termios (3), .BR console_ioctl (4), @@ -490,3 +499,11 @@ main(void) .\" TIOCSERGETMULTI struct serial_multiport_struct * .\" TIOCSERSETMULTI const struct serial_multiport_struct * .\" TIOCGSERIAL, TIOCSSERIAL (see above) +.SH COLOPHON +This page is part of release 3.65 of the Linux +.I man-pages +project. +A description of the project, +and information about reporting bugs, +can be found at +\%http://www.kernel.org/doc/man\-pages/.