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