grantpt
Section: C Library Functions (3)
Updated: 2025-09-21
Index
JM Home Page
roff page
名前
grantpt - スレーブ擬似端末へのアクセスを許可する
ライブラリ
標準 C ライブラリ (libc,~-lc)
書式
#define _XOPEN_SOURCE
#include <stdlib.h>
int grantpt(int fd);
glibc 向けの機能検査マクロの要件 (feature_test_macros(7) 参照):
grantpt():
Since glibc 2.24:
_XOPEN_SOURCE >= 500
glibc 2.23 and earlier:
_XOPEN_SOURCE
説明
grantpt() 関数は、ファイルディスクリプター fd で参照されたマスタ擬似端末に対応するスレーブ擬似端末デバイス
のモードと所有者を変更する。 スレーブのユーザーID は呼び出したプロセスの実 UID に設定される。 グループID
として設定される値は規定されていない (例えば tty になる)。 スレーブのモードは 0620 (crw--w----) に設定される。
SIGCHLD シグナルを捕捉するためにシグナルハンドラーが設定されている場合の grantpt() の動作は規定されていない。
返り値
When successful, grantpt() returns 0. Otherwise, it returns -1 and sets
errno to indicate the error.
エラー
- EACCES
-
対応するスレーブ擬似端末にアクセスできなかった。
- EBADF
-
引数 fd が有効なオープンされたファイルディスクリプターでない。
- EINVAL
-
引数 fd は有効だが、マスタ擬似端末に対応するものではない。
属性
この節で使用されている用語の説明については、 attributes(7) を参照。
| インターフェース | 属性 | 値
|
|
grantpt()
| Thread safety | MT-Safe locale
|
標準規格
POSIX.1-2008.
歴史
glibc 2.1. POSIX.1-2001.
これは UNIX 98 疑似端末仕様の一部である。 pts(4) を参照。
Historical systems implemented this function via a set-user-ID helper binary
called "pt_chown". glibc on Linux before glibc 2.33 could do so as well, in
order to support configurations with only BSD pseudoterminals; this support
has been removed. On modern systems this is either a no-op ---with
permissions configured on pty allocation, as is the case on Linux--- or an
ioctl(2).
関連項目
open(2), posix_openpt(3), ptsname(3), unlockpt(3), pts(4),
pty(7)
Index
- 名前
-
- ライブラリ
-
- 書式
-
- 説明
-
- 返り値
-
- エラー
-
- 属性
-
- 標準規格
-
- 歴史
-
- 関連項目
-
This document was created by
man2html,
using the manual pages.