#define _LARGEFILE64_SOURCE /* See feature_test_macros(7) */ #include <sys/types.h> #include <unistd.h> off64_t lseek64(int fd, off64_t offset, int whence);
更に詳しい説明・返り値・エラーは、 lseek(2) を参照すること。
4 つのインターフェースが使用可能である: lseek(), lseek64(), llseek(), llseek()
off_t lseek(int fd, off_t offset, int whence);
The C library's lseek() wrapper function uses the type off_t. This is a 32-bit signed type on 32-bit architectures, unless one compiles with
#define _FILE_OFFSET_BITS 64
を定義してコンパイルした場合は 64 ビット符号付き型である。
off64_t lseek64(int fd, off64_t offset, int whence);
ライブラリ関数 lseek64() は off_t が 32 ビット型であっても 64 ビット型を使う。 このプロトタイプ (と型 off64_t) は、以下の定義をしてコンパイルした場合にのみ使用可能である。
#define _LARGEFILE64_SOURCE
関数 lseek64() は glibc 2.1 以降で使用可能である。
loff_t llseek(int fd, loff_t offset, int whence);
型 loff_t は 64 ビット符号付き型である。 ライブラリ関数 llseek() は glibc で利用可能であり、 特別な定義なしに動作する。 しかしながら、 glibc のヘッダーはプロトタイプを供していない。 ユーザーは上記のプロトタイプまたはそれと同等のものを、 自身のソースに追加しなければならない。 このデータがないことによって e2fsck(8) のコンパイルが失敗するという苦情がユーザーから出たので、 glibc 2.1.3 では以下のようなリンク時の警告が追加された。
"the `llseek' function may be dangerous; use `lseek64' instead."
これにより、警告なしでコンパイルしたい場合には、この関数を使用不可にできる。
Since glibc 2.28, this function symbol is no longer available to newly linked applications.
int _llseek(int fd, off_t offset_hi, off_t offset_lo,
loff_t *result, int whence);
更に詳しい情報は、 llseek(2) を参照すること。
64-bit systems don't need an _llseek() system call. Instead, they have an lseek(2) system call that supports 64-bit file offsets.
| インターフェース | 属性 | 値 |
| lseek64() | Thread safety | MT-Safe |