.\" Copyright 2012 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 .\" .\" See also https://lwn.net/Articles/519085/ .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH GETAUXVAL 3 2020\-06\-09 GNU "Linux Programmer's Manual" .SH 名前 getauxval \- 補助ベクトルから値を取得する .SH 書式 .nf \fB#include \fP .PP \fBunsigned long getauxval(unsigned long \fP\fItype\fP\fB);\fP .fi .SH 説明 \fBgetauxval\fP() 関数は補助ベクトル (auxiliary vector) から値を取得する。 補助ベクトルは、 プログラムが実行される際に、 カーネルの ELF バイナリーローダーがユーザー空間にある種の情報を渡すのに使われる仕組みである。 .PP 補助ベクトルの各エントリーは、 このエントリーを示すタイプとそのタイプの値のペアで構成される。 引数 \fItype\fP が指定されると、 \fBgetauxval\fP() は対応する値を返す。 .PP それぞれの \fItype\fP に対して返される値の詳細を以下に示す。 すべてのアーキテクチャーですべて \fItype\fP 値が存在するわけではない。 .TP \fBAT_BASE\fP プログラムインタープリター (通常は動的ローダー) のベースアドレス。 .TP \fBAT_BASE_PLATFORM\fP .\" commit e585b768da111f2c2d413de6214e83bbdfee8f22 A pointer to a string (PowerPC and MIPS only). On PowerPC, this identifies the real platform; may differ from \fBAT_PLATFORM\fP. On MIPS, this identifies the ISA level (since Linux 5.7). .TP \fBAT_CLKTCK\fP \fBtimes\fP(2) のカウントが行われる周波数。 この値は \fIsysconf(_SC_CLK_TCK)\fP でも取得できる。 .TP \fBAT_DCACHEBSIZE\fP データキャッシュのブロックサイズ。 .TP \fBAT_EGID\fP このスレッドの実効グループ ID。 .TP \fBAT_ENTRY\fP 実行ファイルのエントリーアドレス。 .TP \fBAT_EUID\fP このスレッドの実効ユーザー ID。 .TP \fBAT_EXECFD\fP プログラムのファイルディスクリプター。 .TP \fBAT_EXECFN\fP A pointer to a string containing the pathname used to execute the program. .TP \fBAT_FLAGS\fP フラグ (未使用)。 .TP \fBAT_FPUCW\fP 使用された FPU 制御ワード (SuperH アーキテクチャーのみ)。 カーネルが実行した FPU 初期化に関する情報を提供するためのものである。 .TP \fBAT_GID\fP このスレッドの実グループ ID。 .TP \fBAT_HWCAP\fP An architecture and ABI dependent bit\-mask whose settings indicate detailed processor capabilities. The contents of the bit mask are hardware dependent (for example, see the kernel source file \fIarch/x86/include/asm/cpufeature.h\fP for details relating to the Intel x86 architecture; the value returned is the first 32\-bit word of the array described there). A human\-readable version of the same information is available via \fI/proc/cpuinfo\fP. .TP \fBAT_HWCAP2\fP (glibc 2.18 以降) Further machine\-dependent hints about processor capabilities. .TP \fBAT_ICACHEBSIZE\fP .\" .TP .\" .BR AT_IGNORE .\" .TP .\" .BR AT_IGNOREPPC .\" .TP .\" .BR AT_NOTELF 命令キャッシュのブロックサイズ。 .TP .\" Kernel commit 98a5f361b8625c6f4841d6ba013bbf0e80d08147 \fBAT_L1D_CACHEGEOMETRY\fP Geometry of the L1 data cache, encoded with the cache line size in bytes in the bottom 16 bits and the cache associativity in the next 16 bits. The associativity is such that if N is the 16\-bit value, the cache is N\-way set associative. .TP \fBAT_L1D_CACHESIZE\fP L1 データキャッシュのサイズ。 .TP \fBAT_L1I_CACHEGEOMETRY\fP Geometry of the L1 instruction cache, encoded as for \fBAT_L1D_CACHEGEOMETRY\fP. .TP \fBAT_L1I_CACHESIZE\fP L1 命令キャッシュのサイズ。 .TP \fBAT_L2_CACHEGEOMETRY\fP Geometry of the L2 cache, encoded as for \fBAT_L1D_CACHEGEOMETRY\fP. .TP \fBAT_L2_CACHESIZE\fP L2 キャッシュのサイズ。 .TP \fBAT_L3_CACHEGEOMETRY\fP Geometry of the L3 cache, encoded as for \fBAT_L1D_CACHEGEOMETRY\fP. .TP \fBAT_L3_CACHESIZE\fP L3 キャッシュのサイズ。 .TP \fBAT_PAGESZ\fP システムページサイズ (\fIsysconf(_SC_PAGESIZE)\fP が返す値と同じ)。 .TP \fBAT_PHDR\fP 実行プログラムのプログラムヘッダーのアドレス。 .TP \fBAT_PHENT\fP プログラムヘッダーエントリーのサイズ。 .TP \fBAT_PHNUM\fP プログラムヘッダー数。 .TP \fBAT_PLATFORM\fP このプログラムが実行されているハードウェアプラットフォームを特定する文字列へのポインター。 動的リンカーは \fIrpath\fP 値の解釈を行う際にこの値を使用する。 .TP \fBAT_RANDOM\fP ランダム値が入った 16 バイトがあるアドレス。 .TP \fBAT_SECURE\fP Has a nonzero value if this executable should be treated securely. Most commonly, a nonzero value indicates that the process is executing a set\-user\-ID or set\-group\-ID binary (so that its real and effective UIDs or GIDs differ from one another), or that it gained capabilities by executing a binary file that has capabilities (see \fBcapabilities\fP(7)). Alternatively, a nonzero value may be triggered by a Linux Security Module. When this value is nonzero, the dynamic linker disables the use of certain environment variables (see \fBld\-linux.so\fP(8)) and glibc changes other aspects of its behavior. (See also \fBsecure_getenv\fP(3).) .TP \fBAT_SYSINFO\fP vDSO のシステムコール関数へのエントリーポイント。すべてのアーキテクチャーで存在するわけではなく、 また必要というわけでもない (例えば x86\-64 には存在しない)。 .TP \fBAT_SYSINFO_EHDR\fP 仮想動的共有オブジェクト (vDSO; virtual Dynamic Shared Object) が入ったページのアドレス。 vDSO は、 特定のシステムコールの高速な実装を提供するためにカーネルが作成する共有オブジェクトである。 .TP \fBAT_UCACHEBSIZE\fP ユニファイド (unified) キャッシュのブロックサイズ。 .TP \fBAT_UID\fP このスレッドの実ユーザー ID。 .SH 返り値 成功すると、 \fBgetauxval\fP() は \fItype\fP に対応する値を返す。 \fItype\fP が見つからない場合には 0 を返す。 .SH エラー .TP \fBENOENT\fP (glibc 2.19 以降) .\" commit b9ab448f980e296eac21ac65f53783967cc6037b \fItype\fP に対応するエントリーが補助ベクトルになかった。 .SH バージョン \fBgetauxval\fP() 関数は glibc バージョン 2.16 で追加された。 .SH 属性 この節で使用されている用語の説明については、 \fBattributes\fP(7) を参照。 .TS allbox; lb lb lb l l l. インターフェース 属性 値 T{ \fBgetauxval\fP() T} Thread safety MT\-Safe .TE .SH 準拠 この関数は非標準で glibc による拡張である。 .SH 注意 補助ベクトルの情報を主に使用するのは、 動的ローダー \fBld\-linux.so\fP(8) である。 補助ベクトルは、 カーネルが動的リンカーが通常もしくは常に必要とするある意味標準的な情報を伝えるための便利で効率的なショートカットである。 いくつかの場合では、 同じ情報がシステムコール経由でも取得できるが、 補助ベクトルを使う方がコストがかからない。 .PP 補助ベクトルには、 単に、 プロセスのアドレス空間の引数リストと環境上に存在するだけである。 プログラム実行時に \fBLD_SHOW_AUXV\fP 環境変数を設定すると、 プログラムに渡された補助ベクトルを表示することができる。 .PP .in +4n .EX $ LD_SHOW_AUXV=1 sleep 1 .EE .in .PP 任意のプロセスの補助ベクトルは (ファイルのアクセス許可があれば) \fI/proc/[pid]/auxv\fP 経由で取得できる。 詳細は \fBproc\fP(5) を参照。 .SH バグ glibc 2.19 で \fBENOENT\fP エラーが追加される前は、 \fItype\fP が見つからなかった場合と \fItype\fP に対応する値が 0 だった場合を明確に区別する方法がなかった。 .SH 関連項目 \fBsecure_getenv\fP(3), \fBvdso\fP(7), \fBld\-linux.so\fP(8) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は \%https://www.kernel.org/doc/man\-pages/ に書かれている。