.\" Copyright (C) 2004 Michael Kerrisk .\" .\" %%%LICENSE_START(VERBATIM) .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" %%%LICENSE_END .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 2005 Yuichi SATO .\" all rights reserved. .\" Translated Sun Jan 30 08:55:16 JST 2005 .\" by Yuichi SATO .\" Updated 2012-05-01, Akihiro MOTOKI .\" .TH POSIX_OPENPT 3 2020\-08\-13 "" "Linux Programmer's Manual" .SH 名前 posix_openpt \- 疑似端末 (pseudoterminal) デバイスをオープンする .SH 書式 .nf \fB#include \fP \fB#include \fP .PP \fBint posix_openpt(int \fP\fIflags\fP\fB);\fP .fi .PP .RS -4 glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7) 参照): .RE .PP .ad l \fBposix_openpt\fP(): _XOPEN_SOURCE\ >=\ 600 .ad b .SH 説明 \fBposix_openpt\fP() 関数は使用されていない疑似端末マスタデバイスをオープンし、 そのデバイスを参照するために使うファイルディスクリプターを返す。 .PP \fIflags\fP 引数は、以下のフラグのうち 0 個以上の OR をとったビットマスクである。 .TP \fBO_RDWR\fP 読み書きのためにデバイスをオープンする。 普通はこのフラグを指定する。 .TP \fBO_NOCTTY\fP このデバイスをプロセスの制御端末としない。 .SH 返り値 成功した場合、 \fBposix_openpt\fP() は、未使用のファイルディスクリプターのうち最小の値のファイルディスクリプター (非負の整数) を返す。失敗した場合、\-1 が返されて、エラーを示すために \fIerrno\fP が設定される。 .SH エラー \fBopen\fP(2) を参照すること。 .SH バージョン \fBposix_openpt\fP() の glibc でのサポートはバージョン 2.2.1 以降で提供されている。 .SH 属性 この節で使用されている用語の説明については、 \fBattributes\fP(7) を参照。 .TS allbox; lb lb lb l l l. インターフェース 属性 値 T{ \fBposix_openpt\fP() T} Thread safety MT\-Safe .TE .SH 準拠 POSIX.1\-2001, POSIX.1\-2008. .PP \fBposix_openpt\fP() は UNIX 98 疑似端末仕様の一部である。 \fBpts\fP(4) を参照。 .SH 注意 System V (別名 UNIX 98) 疑似端末をサポートする古い UNIX 実装の中には、この関数を持たないものもあるが、以下のように擬似端末多重デバイスをオープンすることで簡単に実装できる。 .PP .in +4n .EX int posix_openpt(int flags) { return open("/dev/ptmx", flags); } .EE .in .PP \fBposix_openpt\fP() を呼び出すと、対応する擬似端末スレーブデバイスのパス 名が生成される。スレーブデバイスのパス名は \fBptsname\fP(3) を使って取得 できる。スレーブデバイスのパス名はマスターデバイスがオープンされている 間だけ存在する。 .SH 関連項目 \fBopen\fP(2), \fBgetpt\fP(3), \fBgrantpt\fP(3), \fBptsname\fP(3), \fBunlockpt\fP(3), \fBpts\fP(4), \fBpty\fP(7) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は \%https://www.kernel.org/doc/man\-pages/ に書かれている。