| 1 |
.\" Copyright 1995, Andries E. Brouwer <[email protected]> |
| 2 |
.\" Copyright 2007-2020, Michael Kerrisk <[email protected]> |
| 3 |
.\" Copyright, the authors of the Linux man-pages project |
| 4 |
.\" |
| 5 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 6 |
.\" |
| 7 |
.TH _llseek 2 2026-02-08 "Linux man-pages 6.18" |
| 8 |
.SH NAME |
| 9 |
_llseek \- reposition read/write file offset |
| 10 |
.SH LIBRARY |
| 11 |
Standard C library |
| 12 |
.RI ( libc ,\~ \-lc ) |
| 13 |
.SH SYNOPSIS |
| 14 |
.nf |
| 15 |
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */" |
| 16 |
.B #include <unistd.h> |
| 17 |
.P |
| 18 |
.BI "int syscall(SYS__llseek, unsigned int " fd ", unsigned long " offset_high , |
| 19 |
.BI " unsigned long " offset_low ", loff_t *" result , |
| 20 |
.BI " unsigned int " whence ); |
| 21 |
.fi |
| 22 |
.P |
| 23 |
.IR Note : |
| 24 |
glibc provides no wrapper for |
| 25 |
.BR _llseek (), |
| 26 |
necessitating the use of |
| 27 |
.BR syscall (2). |
| 28 |
.SH DESCRIPTION |
| 29 |
Note: for information about the |
| 30 |
.BR llseek (3) |
| 31 |
library function, see |
| 32 |
.BR lseek64 (3). |
| 33 |
.P |
| 34 |
The |
| 35 |
.BR _llseek () |
| 36 |
system call repositions the offset of the open file description associated |
| 37 |
with the file descriptor |
| 38 |
.I fd |
| 39 |
to the value |
| 40 |
.IP |
| 41 |
(offset_high << 32) | offset_low |
| 42 |
.P |
| 43 |
This new offset is a byte offset |
| 44 |
relative to the beginning of the file, the current file offset, |
| 45 |
or the end of the file, depending on whether |
| 46 |
.I whence |
| 47 |
is |
| 48 |
.BR SEEK_SET , |
| 49 |
.BR SEEK_CUR , |
| 50 |
or |
| 51 |
.BR SEEK_END , |
| 52 |
respectively. |
| 53 |
.P |
| 54 |
The new file offset is returned in the argument |
| 55 |
.IR result . |
| 56 |
The type |
| 57 |
.I loff_t |
| 58 |
is a 64-bit signed type. |
| 59 |
.P |
| 60 |
This system call exists on various 32-bit platforms to support |
| 61 |
seeking to large file offsets. |
| 62 |
.SH RETURN VALUE |
| 63 |
Upon successful completion, |
| 64 |
.BR _llseek () |
| 65 |
returns 0. |
| 66 |
Otherwise, a value of \-1 is returned and |
| 67 |
.I errno |
| 68 |
is set to indicate the error. |
| 69 |
.SH ERRORS |
| 70 |
.TP |
| 71 |
.B EBADF |
| 72 |
.I fd |
| 73 |
is not an open file descriptor. |
| 74 |
.TP |
| 75 |
.B EFAULT |
| 76 |
Problem with copying results to user space. |
| 77 |
.TP |
| 78 |
.B EINVAL |
| 79 |
.I whence |
| 80 |
is invalid. |
| 81 |
.SH VERSIONS |
| 82 |
You probably want to use the |
| 83 |
.BR lseek (2) |
| 84 |
wrapper function instead. |
| 85 |
.SH STANDARDS |
| 86 |
Linux. |
| 87 |
.SH SEE ALSO |
| 88 |
.BR lseek (2), |
| 89 |
.BR open (2), |
| 90 |
.BR lseek64 (3) |