.\" Copyright (c) 1980, 1991 Regents of the University of California. .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" from: @(#)fork.2 6.5 (Berkeley) 3/10/91 .\" %FreeBSD: src/lib/libc/i386/sys/i386_get_ldt.2,v 1.6.2.7 2001/12/14 18:33:54 ru Exp % .\" .\" $FreeBSD$ .Dd September 20, 1993 .Dt I386_GET_LDT 2 .Os .Sh 名称 .Nm i386_get_ldt , .Nm i386_set_ldt .Nd i386 プロセスごとのローカル記述子テーブルエントリを管理する .Sh ライブラリ .Lb libc .Sh 書式 .In machine/segments.h .In machine/sysarch.h .Ft int .Fn i386_get_ldt "int start_sel" "union descriptor *descs" "int num_sels" .Ft int .Fn i386_set_ldt "int start_sel" "union descriptor *descs" "int num_sels" .Sh 解説 .Fn i386_get_ldt はプロセスの LDT の中にある i386 記述子のリストを返します。 .Fn i386_set_ldt は現在のプロセスのための i386 記述子の リストを、そのプロセスの LDT に設定します。 両方のルーチンは、開始するセレクタ番号の .Fa start_sel と、設定する記述子の入った、または記述子が返されるメモリの配列の .Fa descs および設定または返されるエントリ数の .Fa num_sels を受け取ります。 .Pp 引数 .Fa descs としては segment_descriptor または gate_descriptor .Aq Pa i386/segments.h . .\".Fd .Ao Pa i386/segments.h Ac 内に定義されています。これらの構成要素は、アーキテクチャに対応して ばらばらになったビットフィールドとして定義 されているので、それらを組み立てる際には注意を払う必要があります。 .Pp これらの関数を使用するには、カーネルの設定ファイル中で .Dq options USER_LDT を指定していなければならないことに注意してください。 .Sh 戻り値 正常に完了した場合、 .Fn i386_get_ldt は現在 LDT 内にある記述子の数を返します。 .Fn i386_set_ldt は最初のセレクタセットを返します。そうでない場合は -1 が返され、 エラーを示すためにグローバル変数 .Va errno が設定されます。 .Sh エラー .Fn i386_get_ldt と .Fn i386_set_ldt は次の場合に失敗します。 .Bl -tag -width Er .It Bq Er EINVAL .Fa start_sel または .Fa num_sels について不適切なパラメータが使用されました。 .It Bq Er EACCES 呼び出し側が保護機構を欺くかまたは障害を起こす記述子を使おうとしました。 .El .Sh 関連項目 i386 Microprocessor Programmer's Reference Manual, Intel .Sh 警告 これを使用してプロセスをまったくダメにすることができます。