Blob


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