uselib

Section: System Calls (2)
Updated: 2026-02-08
Index JM Home Page roff page
 

名前

uselib - 共有ライブラリを選択する  

書式

#include <unistd.h>

[[deprecated]] int uselib(const char *library);
 

説明

システムコール uselib() は、呼び出し元プロセスが使用する 共有ライブラリをロードする際に使用される。 このシステムコールにはライブラリのパス名を指定する。 ライブラリをロードするアドレスはライブラリ自身に書かれている。 ライブラリは認識可能なバイナリ形式であればどんな形式でもよい。  

返り値

成功すると、0 を返す。 エラーの場合、-1 を返し、 errno にエラーを示す値を設定する。  

エラー

open(2) と mmap(2) が返すエラーコードに加えて、以下のエラーコードが設定されることがある。
EACCES
library で指定されたライブラリに対する読み込み許可、または実行許可がない。 もしくは library が存在するディレクトリかその上位のいずれかに対する検索許可がない (path_resolution(7) も参照)。
ENFILE
オープンされたファイルの総数がシステム全体の上限に達していた。
ENOEXEC
library で指定されたファイルが、実行可能ファイルと認識されるファイル種別ではない。 例えば、正しいマジックナンバーが付いていない。
 

標準規格

Linux.  

歴史

This obsolete system call is not supported by glibc. No declaration is provided in glibc headers, but, through a quirk of history, glibc before glibc 2.23 did export an ABI for this system call. Therefore, in order to employ this system call, it was sufficient to manually declare the interface in your code; alternatively, you could invoke the system call using syscall(2).

In ancient libc versions (before glibc 2.0), uselib() was used to load the shared libraries with names found in an array of names in the binary.

Since Linux 3.15, this system call is available only when the kernel is configured with the CONFIG_USELIB option.  

関連項目

ar(1), gcc(1), ld(1), ldd(1), mmap(2), open(2), dlopen(3), capabilities(7), ld.so(8)


 

Index

名前
書式
説明
返り値
エラー
標準規格
歴史
関連項目

This document was created by man2html, using the manual pages.