utmpの画面で使用されるディスプレイ

utmpの画面で使用されるディスプレイ

1つの物理モニターのみを使用するデスクトップLinuxのX Windowシステムは通常、モニター0、スクリーン0を使用します。 Ubuntu 14.04whoの出力は次のとおりです。

user1   :0           2016-06-15 14:25 (:0)

()の略:0。ここではGUIでのみログインします。:0.0:display.screen

その後、端末エミュレータを開きました。screen2つの異なるウィンドウを実行して作成しました(それぞれbash.結果出力はwho次のとおりです。)

user1   :0           2016-06-15 14:25 (:0)
user1   pts/1        2016-06-15 14:26 (:0)
user1   pts/11       2016-06-15 16:31 (:0:S.0)
user1   pts/11       2016-06-15 16:31 (:0:S.1)

この構文を使用するのはなぜですか?そうだ:display:display.screenscreen実際のモニター内で他のモニターをエミュレートしますか?

ベストアンサー1

行末のテキストを参照しています。screenどの疑似端末接続を使用しているか、どのscreenウィンドウ番号が割り当てられているかを示すために記録されます。コメントその機能はコードに記載されています:

/* 
 * Construct a utmp entry for window wi. 
 * the hostname field reflects what we know about the user (display) 
 * location. If d_loginhost is not set, then he is local and we write 
 * down the name of his terminal line; else he is remote and we keep 
 * the hostname here. The letter S and the window id will be appended. 
 * A saved utmp entry in wi->w_savut serves as a template, usually. 
 */

それから

      /* 
       * we want to set our ut_host field to something like 
       * ":ttyhf:s.0" or 
       * "faui45:s.0" or 
       * "132.199.81.4:s.0" (even this may hurt..), but not 
       * "faui45.informati"......:s.0 
       * HPUX uses host:0.0, so chop at "." and ":" (Eric Backus) 
       */

最後に、あなたが認識できる実際のコードを提供します。

    sprintf(host + strlen(host), ":S.%d", win->w_number);

    strncpy(u.ut_host、ホスト、sizeof(u.ut_host));

ut_hostutmp/utmpx 構造体のメンバーに文字列を格納します。

追加資料:

おすすめ記事