CONSOLE_IOCTL(4) Linux Programmer’s Manual CONSOLE_IOCTL(4) 名前 console ioctl - コンソール端末と仮想コンソールの ioctl 説明 次 のような Linux 固有の ioctl(2) がサポートされている。それぞれ3番目の 引数が必要である、ここでは argp とする。 KDGETLED LED の状態を取得する。 argp は char のポインターである 。 *argp の下位 3 ビットに以下のように LED の状態がセットされる。 LED_CAP 0x04 キャピタルロックが点灯 LEC_NUM 0x02 ナンバーロックが点灯 LED_SCR 0x01 スクロールロックが点灯 KDSETLED LED を点灯させる。LEDは argp の下位 3 ビットに従い点灯される。し かし、より高位のビットがセットされている時には、キャピタルロック 、ナンバーロック、スクロールロックのキーボード機能の状態を表示す る LED は通常状態に戻る。 カーネル 1.1.54 以前は、LED はそれぞれのキーボードフラグの状態を反映 す る だけで、KDGETLED/KDSETLED もキーボードフラグを変更するだけであった。 カーネルl 1.1.54 からは LED に任意の表示をする事ができるようになった が 、 デフォルトではキーボードフラグを表示する。次に示す 2 つの ioctl はキ ーボードフラグにアクセスするのに用いられる。 KDGKBLED キャピタルロック、ナンバーロック、スクロールロックの(LED の表 示 で はなく)キーボードフラグを得る。 argp はフラグの状態がセットさ れる文字変数を指す。 (0x7)でマスクして得られる下位 3 ビットが 現 在のフラグの状態を示し、 (0x70)でマスクして得られる次の 3 ビット がデフォルトのフラグの状態を示す。(カーネル 1.1.54以降) KDSKBLED キャピタルロック、ナンバーロック、スクロールロックの(LED の表 示 ではなく) キーボードフラグをセットする。 argp がセットしたいフラ グである。 (0x7)でマスクして得られる下位 3 ビットがフラグの状 態 で 、(0x70)でマスクして得られる次の 3 ビットがデフォルトのフラグ の状態である。(カーネル 1.1.54以降) KDGKBTYPE キーボードの種類を得る。これは値 0x02 と定義されている KB_101 を 返す。 KDADDIO I/Oポートを有効な物として加える。これは ioperm(arg,1,1) と等価で ある。 KDDELIO I/Oポートを有効な物から外す。これは ioperm(arg,1,0) と等価である 。 KDENABIO ビ デ オ ボ ー ド へ の I/O を可能にする。これは ioperm(0x3b4, 0x3df-0x3b4+1, 1) と等価である。 KDDISABIO ビデオボードへの I/O を不可能に す る 。 こ れ は ioperm(0x3b4, 0x3df-0x3b4+1, 0) と等価である。 KDSETMODE テ キスト/グラフィクスモードを設定する。 argp は次のうちのどれか : KD_TEXT 0x00 KD_GRAPHICS 0x01 KDGETMODE テキスト/グラフィクスモードを取得する。 argp が指す long 型変 数 に上述の値のどちらかがセットされる。 KDMKTONE 指定された長さのトーンを発生する。 argp の下位 16 ビットはクロッ クサイクルを単位にして周期を指定し、上位 16 ビットが msec の単位 で表した、(トーンを発生させる)時間を指定する。トーンを発生させる 時間がゼロのときは、サウンドはオフになる。制御は直ちに戻る。例え ば 、argp = (125<<16) + 0x637 とすれば、通常 ctrl-G を押した時に 発生する音になる。 (カーネル 0.99pl1 以降;この機能は カ ー ネ ル 2.1.49 から 2.1.50 ではバグのため動作しない) KIOCSOUND 音の発生の開始や停止を行う。 argp の下位 16 ビットはクロックサイ クルを単位として周期を示す。 (つまり argp = 1193180/周 波 数) 。 argp = 0 の場合、サウンドはオフになる。どちらの場合でも、ただち に制御は戻る。 GIO_CMAP 現在のデフォルトのカラーマップをカーネルより取得する。 PIO_CMAP デフォルトのテキストモードのカラーマップを変更する。 argp が指す 48 バイトの配列中には、16 の可能なスクリーンの色を、赤、緑、青の 順に 0 をオフ、255を最大強度とした値として納める。デフォルトの色 は順に、黒、濃い赤、濃い緑、茶、濃い青、濃い紫、濃いシアン、明る い灰色、濃い灰色、明るい赤、明るい緑、黄、明るい青、明るい紫、明 るいシアン、白である。(カーネル 1.3.3以降) GIO_FONT 拡 張 さ れた形式で 256 文字のスクリーンフォントを得る。 argp は 8192 バイトの配列を指す。現在ロードされているフォントが 512 文字 のフォントであるか、コンソールがテキストモードでない時には失敗し EINVAL のエラーコードを返す。 GIO_FONTX スクリーンフォントとそれに関連した情報を取得する。 argp は構造体 consolefontdesc (PIO_FONTX を参照のこと)を指す。関数呼び出しのと きには、charcount には、chardata が指すバッファにおさまる最大 の 文 字 数をセットしなければならない。関数呼び出しから戻った時には charcount と charheight には、現在ロードされているフォントの該当 するデータが収められている。配列 chardata には、最初に charcount にいれた値によってフォントを収めるのに十分なスペースがあるとわか ればフォントデータが収められる。そうでない時には、バッファは変更 されず、 errno に ENOMEM がセットされる(カーネル 1.3.1 以降)。 PIO_FONT 256 文字のフォントをセットする。EGA/VGA キャラクタージェネレータ ー (character generator) にフォントをロードする。 argp は、8192 バイト(一文字 32 バイト)のマップを指す。マップのうち、最初 の N のみが 8xN のフォントのために用いられる(0 < N <= 32)。この呼び出 しをすると Unicode のマッピングが無効になる。 PIO_FONTX スクリーンフォントと、それに関連するレンダリング情報をセットする 。 argp は、以下の構造体を指す。 struct consolefontdesc { unsigned short charcount; /* フォントの文字数 (256 または 512) */ unsigned short charheight; /* 一文字の走査線の数 (1-32) */ char *chardata; /* 展開されたフォントデータ */ }; 必 要ならスクリーンは適当にサイズ変更され、SIGWINCH が適切なプロ セスに送られる。このコールにより Unicode のマッピングが無効に な る。 PIO_FONTRESET ス クリーンフォント、サイズ、 Unicode マッピングをブート時のデフ ォルト値にリセットする。argp は用いられないが、将来のバージョ ン の Linux との互換性を保つために NULL にセットすべきである。 GIO_SCRNMAP ス ク リ ー ン マ ッ ピングをカーネルより取得する。argp はサイズ E_TABSZ の領域を指す。その領域には各キャラクターを表示するのに用 いられるフォントの位置がロードされている。この呼び出しは現在ロー ドされているフォントが 256 文字よりも多い時には無意味な情報を 返 す事が多い。 GIO_UNISCRNMAP フ ル Unicode スクリーンマッピングをカーネルより取得する。 argp はサイズ E_TABSZ*sizeof(unsigned short) の領域を指す。その領域に は 各キャラクターを示す Unicode がロードされている。 U+F000 に始 まる Unicode の特別な集合は、「フォント直接な(direct to font) 」 マッピングを示すのに用いられる(カーネル 1.3.1 以降)。 PIO_SCRNMAP 「 ユーザー定義可能な(user definable)」(4番目の)テーブルをカーネ ルにロードする。そのテーブルは各バイトをスクリーンシンボルにマッ ピングする。 argp はサイズE_TABSZの領域を指す。 PIO_UNISCRNMAP 「 ユーザー定義可能な」(4番目の)テーブルをカーネルにロードする。 そのテーブルは各バイトをユニコードにマッピングし、その後、現在ロ ードされているユニコードからフォントへのマップに従いスクリーンシ ンボルに変換される。 U+F000 に始まるユニコードは直接フォントシン ボルにマッピングするのに使える(カーネル 1.3.1 以降) GIO_UNIMAP Unicode からフォントへのマッピングをカーネルから取得する。 argp は、 struct unimapdesc { unsigned short entry_ct; struct unipair *entries; }; という構造体を指す。ここで entries は、 struct unipair { unsigned short unicode; unsigned short fontpos; }; という構造体の配列へのポインターである。 (カーネル 1.1.92 以降) PIO_UNIMAP Unicode からフォントへのマッピングをカーネルにセットす る 。argp は 構 造 体 struct unimapdesc へのポインターである。(カーネル 1.1.92 以降) PIO_UNIMAPCLR テーブルをクリアし、その事をハシュアルゴリズムに伝える。 argpは struct unimapinit { unsigned short advised_hashsize; /* 0 if no opinion */ unsigned short advised_hashstep; /* 0 if no opinion */ unsigned short advised_hashlevel; /* 0 if no opinion */ }; という構造体を指すポインターである。 (カーネル 1.1.92 以降) KDGKBMODE 現在のキーボードモードを取得する。argp の指す long 型変数が、 次 のうちのどれかに設定される。 K_RAW 0x00 K_XLATE 0x01 K_MEDIUMRAW 0x02 K_UNICODE 0x03 KDSKBMODE 現在のキーボードモードを設定する。 argp は上記の値のうちのどれか に等しい long にする。 KDGKBMETA メタキーハンドリングモード(meta key handling mode)を取得す る 。 argp が指す long 型変数は、次のうちのどれかに設定される。 K_METABIT 0x03 set high order bit K_ESCPREFIX 0x04 escape prefix KDSKBMETA メタキーハンドリングモードを設定する。 argp は上記の値のどれかに 等しい long にする。 KDGKBENT キーコードをアクションコードに変換するキー変換表のエントリーの一 つを取得する。 argp は、 struct kbentry { unsigned char kb_table; unsigned char kb_index; unsigned short kb_value; }; へのポインターである。最初の2つの要素、kb_table には選択するキー テーブル (0 <= kb_table < MAX_NR_KEYMAPS)、kb_index にはキーコー ド(0 <= kb_index < NR_KEYS)を設定する。 kb_value は対応するアク ションコード、または、そのようなキーが な い と き に は K_HOLE 、kb_table が無効な時には K_NOSUCHMAP に設定される。 KDSKBENT 変 換 テーブルのエントリーの一つを設定する。argp は構造体 struct kbentry へのポインターである。 KDGKBSENT ファンクションキーの文字列を取得する。argp は、 struct kbsentry { unsigned char kb_func; unsigned char kb_string[512]; }; という構造体へのポインターである。 kb_func 番目のファンクションキーのアクションコードに 対 応 す る (NULL で終端された)文字列が kb_string に設定される。 KDSKBSENT フ ァンクションキーの文字列のエントリーを設定する。argp は、構造 体 struct kbsentry へのポインターである。 KDGKBDIACR カーネルのアクセントテーブル(accent table)を読み込む。argpは、 struct kbdiacrs { unsigned int kb_cnt; struct kbdiacr kbdiacr[256]; }; という構造体へのポインターである。ここで、kb_cnt は配列中のエ ン トリーの個数で、個々のエントリーは、 struct kbdiacr { unsigned char diacr; unsigned char base; unsigned char result; }; という構造体である。 KDGETKEYCODE カーネルの(スキャンコードからキーコードへ変換する)キーコードテー ブルエントリーを読み込む。 argp は、 struct kbkeycode { unsigned int scancode; unsigned int keycode; }; へのポインターである。 keycode は、scancode に対応した値に設定さ れる。(ただし、89 <= scancode <= 255 のみについて。1 <= scancode <= 88 では keycode == scancode である。) (カーネル 1.1.63 以降) KDSETKEYCODE カーネルのキーコードテーブルエントリーを書き込む。argp は構造 体 struct kbkeycode へのポインターである。 (カーネル 1.1.63 以降) KDSIGACCEPT この関数呼び出しは、特別な組合せでキーを押した時に発生するシグナ ル argp (1 <= argp <= NSIG) を進んで受け付けるかどうかを示 す 。 (linux/drivers/char/keyboard.c の Spawn_console() を見よ。) VT_OPENQRY 最 初 の 空 いている(まだオープンされていない)コンソールを返す。 argp の指す int 型の整数には、vt の番号がセット さ れ る (1 <= *argp <= MAX_NR_CONSOLES)。 VT_GETMODE アクティブな vt のモードを取得する。argpは、 struct vt_mode { char mode; /* vt mode */ char waitv; /* if set, hang on writes if not active */ short relsig; /* signal to raise on release req */ short acqsig; /* signal to raise on acquisition */ short frsig; /* unused (set to 0) */ }; という構造体を指すポインタであり、アクティブな vt のモードがセッ トされる。 mode は次のどれかに設定される: VT_AUTO 自動vt切替え VT_PROCESS プロセスコントロール切替え VT_ACKACQ アクノリッジ切替え VT_SETMODE アクティブな vt のモードを設定する。argp は構造体 struct vt_mode へのポインターである。 VT_GETSTATE グローバルな vt の状態の情報を取得する。argpは、 struct vt_stat { unsigned short v_active; /* active vt */ unsigned short v_signal; /* signal to send */ unsigned short v_state; /* vt bit mask */ }; へのポインターである。使用されているそれぞれの vt につき v_state の対応するビットがセットされる。 (カーネルl 1.0 から 1.1.92 ま で) VT_RELDISP ディスプレーを解放する。 VT_ACTIVATE argp (1 <= argp <= MAX_NR_CONSOLES)の vt に切替える。 VT_WAITACTIVE argpの vt がアクティブになるまで待つ。 VT_DISALLOCATE argp の vt に結びつけられたメモリーを解放する。 (カーネル 1.1.54 以降) VT_RESIZE カーネルが認識するスクリーンサイズを設定する。argp は、 struct vt_sizes { unsigned short v_rows; /* # rows */ unsigned short v_cols; /* # columns */ unsigned short v_scrollsize; /* no longer used */ }; へのポインターである。これはビデオモードを変更しない事に注 意 。 resizecons(8) を見よ(カーネル 1.1.54 以降)。 VT_RESIZEX カ ーネルが認識する各種のスクリーンパラメータを設定する。argp は 、 struct vt_consize { unsigned short v_rows; /* number of rows */ unsigned short v_cols; /* number of columns */ unsigned short v_vlin; /* number of pixel rows on screen */ unsigned short v_clin; /* number of pixel rows per character */ unsigned short v_vcol; /* number of pixel columns on screen */ unsigned short v_ccol; /* number of pixel columns per character */ }; へのポインターである。 パラメータはゼロであってもよい。そのときは「変更しないこと」を意 味するが、複数のパラメータが設定された時にはそれらの間で矛盾がな いようにしなければならない。この関数呼び出しによってもビデオモー ド は 変 更 されない事に注意。 resizecons(8) を参照の事(カーネル 1.3.3 以降)。 以下の ioctl がどのように動作をするかは、argp が指す構造体の最初のバ イ ト(ここでは subcode と呼ぶ)に依存する。これらの呼出しは、スーパーユーザ ーか現在の tty のオーナにのみ許される。 TIOCLINUX, subcode=0 スクリーンをダンプ(dump)するカーネル 1.1.92 以 降 で な く な っ た(1.1.92 以降では、代わりに /dev/vcsN または /dev/vcsaN より読 み込む)。 TIOCLINUX, subcode=1 タスク情報を取得する。カーネル 1.1.92 でなくなった。 TIOCLINUX, subcode=2 選択を設定する。 argp が指すのは、 struct { char subcode; short xs, ys, xe, ye; short sel_mode; } であり、ここで xs と ys は始めの桁と行で、xe と ye は終りの桁 と 行 である。 (左上の隅が 桁=行=1 ) sel_mode は 0 が文字毎の選択で 、1は語毎の選択、2は行毎の選択を意味する。示されたスクリーン上の 文 字 は ハ イ ラ イト表示され devices/char/console.c の静的配列 sel_buffer に保存される。 TIOCLINUX, subcode=3 選択したものをペーストする。選択バッファ中の文字 が fd に書き 出 される。 TIOCLINUX, subcode=4 スクリーンをアンブランク(unblank)する。 TIOCLINUX, subcode=5 語 毎の選択のための「語」中の文字を規定している 256 ビットのルッ クアップテーブルの内容を設定する(カーネル 1.1.32 以降)。 TIOCLINUX, subcode=6 argp は文字変数を指すポインタで、その 内 容 が カ ー ネ ル 変 数 shift_stateの値に設定される(カーネル 1.1.32 以降)。 TIOCLINUX, subcode=7 argp は 文 字 変 数 を 指 すポインタで、その内容がカーネル変数 report_mouse の値に設定される(カーネル 1.1.33 以降)。 TIOCLINUX, subcode=8 スクリーン幅、スクリーン高さ、カーソル位置、全ての文字属性の組を ダンプする (カーネル 1.1.67 から 1.1.91までのみ。カーネル 1.1.92 以降では /dev/vcsa*より読み込む)。 TIOCLINUX, subcode=9 スクリーン幅、スクリーン高さ、カーソル位置、全ての文字属性の組を 復 元する (カーネル 1.1.67 から 1.1.91 までのみ。カーネル 1.1.92 以降では /dev/vcsa* に書き込む)。 TIOCLINUX, subcode=10 新世代モニターのパワーセーブ機能を制御する。 VESA スクリーンブラ ンキングモードが argp[1]に設定される。その値はスクリーンブランキ ングがどのように行われるかを示す。以下がその値である。 0: スクリーンブランキングなし。 1:現在のビデオアダプターレジスタが保存されたあと、コント ロ ーラは垂直同期パルスをオフにするようプログラムされる。これにより モニターは「スタンバイ」モードにはいる。モニターに Off_Mode タイ マが備わっておれば、最終的にはモニターが自分で電源を落す。 2: 現在の設定を保存した後、垂直、水平同期パルスがオフになる 。これによりモニターは「オフ」モードになる。モニターに Off_Mode タイマーがない時、または、blank_timer がタイムアウトしたらすぐに モニターの電源を落したいときにこの選択肢を選ぶ。 (注意:頻繁にモ ニターの電源を切るとモニターを痛める。) (カーネル 1.1.76 以降) 戻り値 成 功時には 0 が返される。エラーに対しては -1 が返され、 errno が設定さ れる。 エラー errno は次のような値をとる: EBADF ファイルディスクリプタが無効。 ENOTTY ファイルディスクリプタがキャラクタ・スペシャルデバイスと関連付け られていない。または、要求されたものがそれに当てはまらない。 EINVAL ファイルディスクリプタまたは argp が無効。 EPERM 権限が不十分。 注意 警 告: このマニュアルページを Linux のコンソール ioctl を文書化したもの と思わない事。これは、興味がある人がソースを読むことの代わりになるよ う に 用意した物である。 ioctl は文書化されない Linux の内部機能であって、 警告なしに変更されることがある。 (そして、このページはカーネ ル 1.1.94 の ときの状況を記述した物で、それは以前のバージョンと比べれば、多くの違 いがある) ioctl はカーネルと、ある特定のよく知られたプログラムとの情報交換のた め に 導 入される事が非常に多い(fdisk, hdparm, setserial,tunelp, loadkeys, selection, setfont など)。そのため ioctl の動作は、その特定のプログラム が必要とした時には変更になる。 これらの ioctl を使ったプログラムは他のバージョンの Unix との互換性がな いし、古いバージョンの Linux では、走らない。さらに将来のバージョ ン の Linux では走らなくなるかも知れない。 POSIX 機能を使いなさい。 関連項目 dumpkeys(1), kbd_mode(1), loadkeys(1), mknod(1), setleds(1), setmeta- mode(1), execve(2), fcntl(2), ioperm(2), termios(3), console(4), con- sole_codes(4), mt(4), sd(4), tty(4), tty_ioctl(4), ttyS(4), vcs(4), vcsa(4), charsets(7), mapscrn(8), resizecons(8), setfont(8), /usr/include/linux/kd.h, /usr/include/linux/vt.h Linux 2009-02-28 CONSOLE_IOCTL(4)
CONSOLE_IOCTL(4) Linux Programmer’s Manual CONSOLE_IOCTL(4) NAME console ioctl - ioctl’s for console terminal and virtual consoles DESCRIPTION The following Linux-specific ioctl(2) requests are supported. Each requires a third argument, assumed here to be argp. KDGETLED Get state of LEDs. argp points to a char. The lower three bits of *argp are set to the state of the LEDs, as follows: LED_CAP 0x04 caps lock led LEC_NUM 0x02 num lock led LED_SCR 0x01 scroll lock led KDSETLED Set the LEDs. The LEDs are set to correspond to the lower three bits of argp. However, if a higher order bit is set, the LEDs revert to normal: displaying the state of the keyboard functions of caps lock, num lock, and scroll lock. Before 1.1.54, the LEDs just reflected the state of the corresponding keyboard flags, and KDGETLED/KDSETLED would also change the keyboard flags. Since 1.1.54 the leds can be made to display arbitrary informa- tion, but by default they display the keyboard flags. The following two ioctl’s are used to access the keyboard flags. KDGKBLED Get keyboard flags CapsLock, NumLock, ScrollLock (not lights). argp points to a char which is set to the flag state. The low order three bits (mask 0x7) get the current flag state, and the low order bits of the next nibble (mask 0x70) get the default flag state. (Since 1.1.54.) KDSKBLED Set keyboard flags CapsLock, NumLock, ScrollLock (not lights). argp has the desired flag state. The low order three bits (mask 0x7) have the flag state, and the low order bits of the next nibble (mask 0x70) have the default flag state. (Since 1.1.54.) KDGKBTYPE Get keyboard type. This returns the value KB_101, defined as 0x02. KDADDIO Add I/O port as valid. Equivalent to ioperm(arg,1,1). KDDELIO Delete I/O port as valid. Equivalent to ioperm(arg,1,0). KDENABIO Enable I/O to video board. Equivalent to ioperm(0x3b4, 0x3df-0x3b4+1, 1). KDDISABIO Disable I/O to video board. Equivalent to ioperm(0x3b4, 0x3df-0x3b4+1, 0). KDSETMODE Set text/graphics mode. argp is one of these: KD_TEXT 0x00 KD_GRAPHICS 0x01 KDGETMODE Get text/graphics mode. argp points to a long which is set to one of the above values. KDMKTONE Generate tone of specified length. The lower 16 bits of argp specify the period in clock cycles, and the upper 16 bits give the duration in msec. If the duration is zero, the sound is turned off. Control returns immediately. For example, argp = (125<<16) + 0x637 would specify the beep normally associated with a ctrl-G. (Thus since 0.99pl1; broken in 2.1.49-50.) KIOCSOUND Start or stop sound generation. The lower 16 bits of argp spec- ify the period in clock cycles (that is, argp = 1193180/fre- quency). argp = 0 turns sound off. In either case, control returns immediately. GIO_CMAP Get the current default color map from kernel. argp points to a 48-byte array. (Since 1.3.3.) PIO_CMAP Change the default text-mode color map. argp points to a 48-byte array which contains, in order, the Red, Green, and Blue values for the 16 available screen colors: 0 is off, and 255 is full intensity. The default colors are, in order: black, dark red, dark green, brown, dark blue, dark purple, dark cyan, light grey, dark grey, bright red, bright green, yellow, bright blue, bright purple, bright cyan and white. (Since 1.3.3.) GIO_FONT Gets 256-character screen font in expanded form. argp points to an 8192 byte array. Fails with error code EINVAL if the cur- rently loaded font is a 512-character font, or if the console is not in text mode. GIO_FONTX Gets screen font and associated information. argp points to a struct consolefontdesc (see PIO_FONTX). On call, the charcount field should be set to the maximum number of characters that would fit in the buffer pointed to by chardata. On return, the charcount and charheight are filled with the respective data for the currently loaded font, and the chardata array contains the font data if the initial value of charcount indicated enough space was available; otherwise the buffer is untouched and errno is set to ENOMEM. (Since 1.3.1.) PIO_FONT Sets 256-character screen font. Load font into the EGA/VGA character generator. argp points to a 8192 byte map, with 32 bytes per character. Only first N of them are used for an 8xN font (0 < N <= 32). This call also invalidates the Unicode map- ping. PIO_FONTX Sets screen font and associated rendering information. argp points to a struct consolefontdesc { unsigned short charcount; /* characters in font (256 or 512) */ unsigned short charheight; /* scan lines per character (1-32) */ char *chardata; /* font data in expanded form */ }; If necessary, the screen will be appropriately resized, and SIG- WINCH sent to the appropriate processes. This call also invali- dates the Unicode mapping. (Since 1.3.1.) PIO_FONTRESET Resets the screen font, size and Unicode mapping to the bootup defaults. argp is unused, but should be set to NULL to ensure compatibility with future versions of Linux. (Since 1.3.28.) GIO_SCRNMAP Get screen mapping from kernel. argp points to an area of size E_TABSZ, which is loaded with the font positions used to display each character. This call is likely to return useless informa- tion if the currently loaded font is more than 256 characters. GIO_UNISCRNMAP Get full Unicode screen mapping from kernel. argp points to an area of size E_TABSZ*sizeof(unsigned short), which is loaded with the Unicodes each character represent. A special set of Unicodes, starting at U+F000, are used to represent "direct to font" mappings. (Since 1.3.1.) PIO_SCRNMAP Loads the "user definable" (fourth) table in the kernel which maps bytes into console screen symbols. argp points to an area of size E_TABSZ. PIO_UNISCRNMAP Loads the "user definable" (fourth) table in the kernel which maps bytes into Unicodes, which are then translated into screen symbols according to the currently loaded Unicode-to-font map. Special Unicodes starting at U+F000 can be used to map directly to the font symbols. (Since 1.3.1.) GIO_UNIMAP Get Unicode-to-font mapping from kernel. argp points to a struct unimapdesc { unsigned short entry_ct; struct unipair *entries; }; where entries points to an array of struct unipair { unsigned short unicode; unsigned short fontpos; }; (Since 1.1.92.) PIO_UNIMAP Put unicode-to-font mapping in kernel. argp points to a struct unimapdesc. (Since 1.1.92) PIO_UNIMAPCLR Clear table, possibly advise hash algorithm. argp points to a struct unimapinit { unsigned short advised_hashsize; /* 0 if no opinion */ unsigned short advised_hashstep; /* 0 if no opinion */ unsigned short advised_hashlevel; /* 0 if no opinion */ }; (Since 1.1.92.) KDGKBMODE Gets current keyboard mode. argp points to a long which is set to one of these: K_RAW 0x00 K_XLATE 0x01 K_MEDIUMRAW 0x02 K_UNICODE 0x03 KDSKBMODE Sets current keyboard mode. argp is a long equal to one of the above values. KDGKBMETA Gets meta key handling mode. argp points to a long which is set to one of these: K_METABIT 0x03 set high order bit K_ESCPREFIX 0x04 escape prefix KDSKBMETA Sets meta key handling mode. argp is a long equal to one of the above values. KDGKBENT Gets one entry in key translation table (keycode to action code). argp points to a struct kbentry { unsigned char kb_table; unsigned char kb_index; unsigned short kb_value; }; with the first two members filled in: kb_table selects the key table (0 <= kb_table < MAX_NR_KEYMAPS), and kb_index is the key- code (0 <= kb_index < NR_KEYS). kb_value is set to the corre- sponding action code, or K_HOLE if there is no such key, or K_NOSUCHMAP if kb_table is invalid. KDSKBENT Sets one entry in translation table. argp points to a struct kbentry. KDGKBSENT Gets one function key string. argp points to a struct kbsentry { unsigned char kb_func; unsigned char kb_string[512]; }; kb_string is set to the (NULL terminated) string corresponding to the kb_functh function key action code. KDSKBSENT Sets one function key string entry. argp points to a struct kbsentry. KDGKBDIACR Read kernel accent table. argp points to a struct kbdiacrs { unsigned int kb_cnt; struct kbdiacr kbdiacr[256]; }; where kb_cnt is the number of entries in the array, each of which is a struct kbdiacr { unsigned char diacr; unsigned char base; unsigned char result; }; KDGETKEYCODE Read kernel keycode table entry (scan code to keycode). argp points to a struct kbkeycode { unsigned int scancode; unsigned int keycode; }; keycode is set to correspond to the given scancode. (89 <= scancode <= 255 only. For 1 <= scancode <= 88, keycode==scan- code.) (Since 1.1.63.) KDSETKEYCODE Write kernel keycode table entry. argp points to a struct kbk- eycode. (Since 1.1.63.) KDSIGACCEPT The calling process indicates its willingness to accept the sig- nal argp when it is generated by pressing an appropriate key combination. (1 <= argp <= NSIG). (See spawn_console() in linux/drivers/char/keyboard.c.) VT_OPENQRY Returns the first available (non-opened) console. argp points to an int which is set to the number of the vt (1 <= *argp <= MAX_NR_CONSOLES). VT_GETMODE Get mode of active vt. argp points to a struct vt_mode { char mode; /* vt mode */ char waitv; /* if set, hang on writes if not active */ short relsig; /* signal to raise on release req */ short acqsig; /* signal to raise on acquisition */ short frsig; /* unused (set to 0) */ }; which is set to the mode of the active vt. mode is set to one of these values: VT_AUTO auto vt switching VT_PROCESS process controls switching VT_ACKACQ acknowledge switch VT_SETMODE Set mode of active vt. argp points to a struct vt_mode. VT_GETSTATE Get global vt state info. argp points to a struct vt_stat { unsigned short v_active; /* active vt */ unsigned short v_signal; /* signal to send */ unsigned short v_state; /* vt bit mask */ }; For each vt in use, the corresponding bit in the v_state member is set. (Kernels 1.0 through 1.1.92.) VT_RELDISP Release a display. VT_ACTIVATE Switch to vt argp (1 <= argp <= MAX_NR_CONSOLES). VT_WAITACTIVE Wait until vt argp has been activated. VT_DISALLOCATE Deallocate the memory associated with vt argp. (Since 1.1.54.) VT_RESIZE Set the kernel’s idea of screensize. argp points to a struct vt_sizes { unsigned short v_rows; /* # rows */ unsigned short v_cols; /* # columns */ unsigned short v_scrollsize; /* no longer used */ }; Note that this does not change the videomode. See resize- cons(8). (Since 1.1.54.) VT_RESIZEX Set the kernel’s idea of various screen parameters. argp points to a struct vt_consize { unsigned short v_rows; /* number of rows */ unsigned short v_cols; /* number of columns */ unsigned short v_vlin; /* number of pixel rows on screen */ unsigned short v_clin; /* number of pixel rows per character */ unsigned short v_vcol; /* number of pixel columns on screen */ unsigned short v_ccol; /* number of pixel columns per character */ }; Any parameter may be set to zero, indicating "no change", but if multiple parameters are set, they must be self-consistent. Note that this does not change the videomode. See resizecons(8). (Since 1.3.3.) The action of the following ioctls depends on the first byte in the struct pointed to by argp, referred to here as the subcode. These are legal only for the superuser or the owner of the current tty. TIOCLINUX, subcode=0 Dump the screen. Disappeared in 1.1.92. (With kernel 1.1.92 or later, read from /dev/vcsN or /dev/vcsaN instead.) TIOCLINUX, subcode=1 Get task information. Disappeared in 1.1.92. TIOCLINUX, subcode=2 Set selection. argp points to a struct { char subcode; short xs, ys, xe, ye; short sel_mode; }; xs and ys are the starting column and row. xe and ye are the ending column and row. (Upper left corner is row=column=1.) sel_mode is 0 for character-by-character selection, 1 for word- by-word selection, or 2 for line-by-line selection. The indi- cated screen characters are highlighted and saved in the static array sel_buffer in devices/char/console.c. TIOCLINUX, subcode=3 Paste selection. The characters in the selection buffer are written to fd. TIOCLINUX, subcode=4 Unblank the screen. TIOCLINUX, subcode=5 Sets contents of a 256-bit look up table defining characters in a "word", for word-by-word selection. (Since 1.1.32.) TIOCLINUX, subcode=6 argp points to a char which is set to the value of the kernel variable shift_state. (Since 1.1.32.) TIOCLINUX, subcode=7 argp points to a char which is set to the value of the kernel variable report_mouse. (Since 1.1.33.) TIOCLINUX, subcode=8 Dump screen width and height, cursor position, and all the char- acter-attribute pairs. (Kernels 1.1.67 through 1.1.91 only. With kernel 1.1.92 or later, read from /dev/vcsa* instead.) TIOCLINUX, subcode=9 Restore screen width and height, cursor position, and all the character-attribute pairs. (Kernels 1.1.67 through 1.1.91 only. With kernel 1.1.92 or later, write to /dev/vcsa* instead.) TIOCLINUX, subcode=10 Handles the Power Saving feature of the new generation of moni- tors. VESA screen blanking mode is set to argp[1], which gov- erns what screen blanking does: 0: Screen blanking is disabled. 1: The current video adapter register settings are saved, then the controller is programmed to turn off the vertical syn- chronization pulses. This puts the monitor into "standby" mode. If your monitor has an Off_Mode timer, then it will eventually power down by itself. 2: The current settings are saved, then both the vertical and horizontal synchronization pulses are turned off. This puts the monitor into "off" mode. If your monitor has no Off_Mode timer, or if you want your monitor to power down immediately when the blank_timer times out, then you choose this option. (Caution: Powering down frequently will damage the monitor.) (Since 1.1.76.) RETURN VALUE On success, 0 is returned. On error -1 is returned, and errno is set. ERRORS errno may take on these values: EBADF The file descriptor is invalid. ENOTTY The file descriptor is not associated with a character special device, or the specified request does not apply to it. EINVAL The file descriptor or argp is invalid. EPERM Insufficient permission. NOTES Warning: Do not regard this man page as documentation of the Linux con- sole ioctl’s. This is provided for the curious only, as an alternative to reading the source. Ioctl’s are undocumented Linux internals, liable to be changed without warning. (And indeed, this page more or less describes the situation as of kernel version 1.1.94; there are many minor and not-so-minor differences with earlier versions.) Very often, ioctl’s are introduced for communication between the kernel and one particular well-known program (fdisk, hdparm, setserial, tunelp, loadkeys, selection, setfont, etc.), and their behavior will be changed when required by this particular program. Programs using these ioctl’s will not be portable to other versions of Unix, will not work on older versions of Linux, and will not work on future versions of Linux. Use POSIX functions. SEE ALSO dumpkeys(1), kbd_mode(1), loadkeys(1), mknod(1), setleds(1), setmeta- mode(1), execve(2), fcntl(2), ioperm(2), termios(3), console(4), con- sole_codes(4), mt(4), sd(4), tty(4), tty_ioctl(4), ttyS(4), vcs(4), vcsa(4), charsets(7), mapscrn(8), resizecons(8), setfont(8), /usr/include/linux/kd.h, /usr/include/linux/vt.h COLOPHON This page is part of release 3.22 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2009-02-28 CONSOLE_IOCTL(4)
コロナウイルスの日ごとの感染者数・死者数をグラフ化してみました。どの国が増加傾向にあり、どの国が終息に向かっているかを視覚化しています。
Copyright(C) linux-cmd.com All Rights Reserved. Author Takayuki Yukawa