console Special File

AIX Version 4 Files Reference

 console Special File

Purpose

Provides access to the system console.

Description

The /dev/console special file provides access to the device or file designated as the system console. This file can be designated as the console device by the person administering the system or a user with the appropriate permissions. The console character special file provides access to the console device driver. The console device driver in turn directs input and output to the device or file selected as the system console.

The system console is typically a terminal or display located near the system unit. It has two functions in the operating system. First, it provides access to the system when it is operating in a non-multiuser mode. (This would be the case during maintenance and diagnostic sessions.) A console login is also normally provided on this device for all operating system run levels.

Second, the system console displays messages for system errors and other problems requiring intervention. These messages are generated by the operating system and its various subsystems when starting or operating. The system console can also be redirected to a file or to the /dev/null special file for systems operating without a console device.

Console Driver Configuration Support

Console driver configuration support allows the system console to be assigned or reassigned to a specified device or file. Such support also provides query functions to determine the current and configured path names for the device or file designated as the console. This configuration support is used by the swcons, chcons, and lscons high-level system management commands. It is also used by the console configuration method at system startup.

The swcons (switch console) command can be used during system operation to switch the system console output to a different target temporarily. This command switches only system information, error, and intervention-required messages to the specified destination. The swcons command does not affect the operation of the system console device that provides a login through the getty command. The device or file specified when using the swcons command remains the target for console output until one of the following happens:

  • Another swcons command is issued.
  • The system is started again.
  • The console driver detects an error when accessing the designated device or file.

If an open or write error is detected on the device or file specified by the swcons command, the console device driver switches all output back to the device or file providing console support when the system started.

The chcons (change console) command can be used to switch the system console output to a different device or file for the next startup. This command does not affect the current console selection, but becomes effective when the system is started again.

When requested to activate a login on the console device, the getty program (which provides login support) uses the console configuration support to determine the path name of the targeted console device used at startup. This action ensures that the swcons command does not effect the console device being used for login.

Usage Considerations

The open, close, read, write, ioctl, select, and poll subroutines are supported by the console device driver and may be used with the /dev/console special file. These subroutines are redirected to the device or file serving as the current system console device by the console device driver.

open and close Subroutines

When an open subroutine call is issued to the console device driver, it is redirected to the device or file currently chosen as the console device. If the system console choice is a file, the file is opened with the append and create options when the first open of the dev/console file is received. Subsequent opens have no effect when the console selection is a file. However, the opens are then passed to the device driver supporting the device chosen as the console.

If the console selection has been temporarily switched using the swcons command and the first open of the new underlying device fails, the console device driver switches back to the console device or file with which the system was booted. This prevents important system messages from being lost.

An ext parameter passed using the openx subroutine is passed to the device driver supporting the console target or else ignored. (The latter is true if the console selection is a file.)

The close subroutine support is standard.

select, poll, and ioctl Subroutines

The select, poll, and ioctl subroutines are redirected to the current system console device when the console selection is not a file. If the selected console device is a file, the console device driver returns an error indicating that the subroutine is not supported.

An ext parameter passed to the ioctlx subroutine is then passed to the device driver supporting the console target, or else ignored. (The latter is true if the console selection is a file.)

read and write Subroutines

The write subroutine calls are redirected to the current console device or file. If the console selection has been temporarily switched using the swcons command, and the write to the targeted device or file is unsuccessful, the console device driver switches back to the console device or file from which the system was started and tries the write again. This prevents important system messages from being lost in case the temporary console target is unavailable or unsuccessful. The console device driver should stay connected to the original system device until another swcons command is issued.

If the current console selection is a device, it redirects the read subroutine call. If the current console selection is a file, the read call is rejected with an error (EACCES).

An ext parameter passed to the readx or writex subroutine is passed to the device driver supporting the console target, or else ignored. (The latter is true if the console selection is a file.)

Implementation Specifics

The console special file is part of Base Operating System (BOS) Runtime.

Files

/dev/nullProvides access to the null device.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值