Start of man-pages-5.14: renaming .Announce and .lsm files
[man-pages.git] / man2 / llseek.2
blob87f45f21901324062603352c5474431ea91a2909
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 .\" %%%LICENSE_START(VERBATIM)
6 .\" Permission is granted to make and distribute verbatim copies of this
7 .\" manual provided the copyright notice and this permission notice are
8 .\" preserved on all copies.
9 .\"
10 .\" Permission is granted to copy and distribute modified versions of this
11 .\" manual under the conditions for verbatim copying, provided that the
12 .\" entire resulting derived work is distributed under the terms of a
13 .\" permission notice identical to this one.
14 .\"
15 .\" Since the Linux kernel and libraries are constantly changing, this
16 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
17 .\" responsibility for errors or omissions, or for damages resulting from
18 .\" the use of the information contained herein.  The author(s) may not
19 .\" have taken the same level of care in the production of this manual,
20 .\" which is licensed free of charge, as they might when working
21 .\" professionally.
22 .\"
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" %%%LICENSE_END
26 .\"
27 .\" Modified Thu Oct 31 15:16:23 1996 by Eric S. Raymond <esr@thyrsus.com>
28 .\"
29 .TH LLSEEK 2 2021-03-22 "Linux" "Linux Programmer's Manual"
30 .SH NAME
31 _llseek \- reposition read/write file offset
32 .SH SYNOPSIS
33 .nf
34 .BR "#include <sys/syscall.h>" "      /* Definition of " SYS_* " constants */"
35 .B #include <unistd.h>
36 .PP
37 .BI "int syscall(SYS__llseek, unsigned int " fd ", unsigned long " offset_high ,
38 .BI "            unsigned long " offset_low ", loff_t *" result ,
39 .BI "            unsigned int " whence );
40 .fi
41 .PP
42 .IR Note :
43 glibc provides no wrapper for
44 .BR _llseek (),
45 necessitating the use of
46 .BR syscall (2).
47 .SH DESCRIPTION
48 Note: for information about the
49 .BR llseek (3)
50 library function, see
51 .BR lseek64 (3).
52 .PP
53 The
54 .BR _llseek ()
55 system call repositions the offset of the open file description associated
56 with the file descriptor
57 .I fd
58 to the value
59 .IP
60 (offset_high << 32) | offset_low
61 .PP
62 This new offset is a byte offset
63 relative to the beginning of the file, the current file offset,
64 or the end of the file, depending on whether
65 .I whence
67 .BR SEEK_SET ,
68 .BR SEEK_CUR ,
70 .BR SEEK_END ,
71 respectively.
72 .PP
73 The new file offset is returned in the argument
74 .IR result .
75 The  type
76 .I loff_t
77 is a 64-bit signed type.
78 .PP
79 This system call exists on various 32-bit platforms to support
80 seeking to large file offsets.
81 .SH RETURN VALUE
82 Upon successful completion,
83 .BR _llseek ()
84 returns 0.
85 Otherwise, a value of \-1 is returned and
86 .I errno
87 is set to indicate the error.
88 .SH ERRORS
89 .TP
90 .B EBADF
91 .I fd
92 is not an open file descriptor.
93 .TP
94 .B EFAULT
95 Problem with copying results to user space.
96 .TP
97 .B EINVAL
98 .I whence
99 is invalid.
100 .SH CONFORMING TO
101 This function is Linux-specific, and should not be used in programs
102 intended to be portable.
103 .SH NOTES
104 You probably want to use the
105 .BR lseek (2)
106 wrapper function instead.
107 .SH SEE ALSO
108 .BR lseek (2),
109 .BR open (2),
110 .BR lseek64 (3)