TIOCCONS - redirecting console output
Contents
Description
Redirect output that would have gone to /dev/console or /dev/tty0 to the given terminal. If that was a
pseudoterminal master, send it to the slave.
Only a process with the CAP_SYS_ADMIN capability may do this.
If output was redirected already, then EBUSY is returned, but redirection can be stopped by using this
ioctl with fd pointing at /dev/console or /dev/tty0.
Errors
EBUSY Output was redirected already.
EPERM Insufficient permission.
History
Before Linux 2.6.10, anybody can do this as long as the output was not redirected yet; CAP_SYS_ADMIN was
not necessary.
Library
Standard C library (libc, -lc)
Name
TIOCCONS - redirecting console output
Return Value
On success, 0 is returned. On error, -1 is returned, and errno is set to indicate the error.
See Also
ioctl(2), ioctl_tty(2)
Linux man-pages 6.9.1 2024-06-13 TIOCCONS(2const)
Synopsis
#include<asm/termbits.h> /* Definition of TIOCCONS */
#include<sys/ioctl.h>intioctl(intfd,TIOCCONS);
