aboutsummaryrefslogtreecommitdiff
path: root/man/man3/seek.3
blob: a95f37ff48dc7cbf37aecb0b4bdf1b3c360a96f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
.TH SEEK 3
.SH NAME
seek \- change file offset
.SH SYNOPSIS
.B #include <u.h>
.br
.B #include <libc.h>
.PP
.B
vlong seek(int fd, vlong n, int type)
.SH DESCRIPTION
.I Seek
sets the offset for the file
associated with
.I fd
as follows:
.IP
If
.I type
is 0, the offset is set to
.I n
bytes.
.IP
If
.I type
is 1, the pointer is set to its current location plus
.IR n .
.IP
If
.I type
is 2, the pointer is set to the size of the
file plus
.IR n .
.PP
The new file offset value is returned.
.PP
Seeking in a directory is not allowed.
Seeking in a pipe is a no-op.
.SH SOURCE
.B \*9/src/lib9/seek.c
.SH SEE ALSO
.IM intro (3) ,
.IM open (3)
.SH DIAGNOSTICS
Sets
.IR errstr .
.SH BUGS
To avoid name conflicts with the underlying system,
.I seek
is a preprocessor macro defined as
.IR p9seek ;
see
.IM intro (3) .