~ubuntu-branches/ubuntu/precise/manpages-posix/precise

1 by Francesco Paolo Lovergine
rules: linking manpages-posix not manpages.
1
.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved 
2 by Francesco Paolo Lovergine
* Alligned to linux main manpages edition.
2
.TH "POSIX_FALLOCATE" P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
1 by Francesco Paolo Lovergine
rules: linking manpages-posix not manpages.
3
.\" posix_fallocate 
4
.SH NAME
5
posix_fallocate \- file space control (\fBADVANCED REALTIME\fP)
6
.SH SYNOPSIS
7
.LP
8
\fB#include <fcntl.h>
9
.br
10
.sp
11
int posix_fallocate(int\fP \fIfd\fP\fB, off_t\fP \fIoffset\fP\fB,
12
size_t\fP \fIlen\fP\fB); \fP
13
\fB
14
.br
15
\fP
16
.SH DESCRIPTION
17
.LP
18
The \fIposix_fallocate\fP() function shall ensure that any required
19
storage for regular file data starting at \fIoffset\fP and
20
continuing for \fIlen\fP bytes is allocated on the file system storage
21
media. If \fIposix_fallocate\fP() returns successfully,
22
subsequent writes to the specified file data shall not fail due to
23
the lack of free space on the file system storage media.
24
.LP
25
If the \fIoffset\fP+ \fIlen\fP is beyond the current file size, then
26
\fIposix_fallocate\fP() shall adjust the file size to
27
\fIoffset\fP+ \fIlen\fP. Otherwise, the file size shall not be changed.
28
.LP
29
It is implementation-defined whether a previous \fIposix_fadvise\fP()
30
call
31
influences allocation strategy.
32
.LP
33
Space allocated via \fIposix_fallocate\fP() shall be freed by a successful
34
call to \fIcreat\fP() or \fIopen\fP() that truncates the size of the
35
file. Space allocated via \fIposix_fallocate\fP() may be freed by
36
a successful call to \fIftruncate\fP() that reduces the file size
37
to a size smaller than \fIoffset\fP+
38
\fIlen\fP.
39
.SH RETURN VALUE
40
.LP
41
Upon successful completion, \fIposix_fallocate\fP() shall return zero;
42
otherwise, an error number shall be returned to indicate
43
the error.
44
.SH ERRORS
45
.LP
46
The \fIposix_fallocate\fP() function shall fail if:
47
.TP 7
48
.B EBADF
49
The \fIfd\fP argument is not a valid file descriptor.
50
.TP 7
51
.B EBADF
52
The \fIfd\fP argument references a file that was opened without write
53
permission.
54
.TP 7
55
.B EFBIG
56
The value of \fIoffset\fP+ \fIlen\fP is greater than the maximum file
57
size.
58
.TP 7
59
.B EINTR
60
A signal was caught during execution.
61
.TP 7
62
.B EINVAL
63
The \fIlen\fP argument was zero or the \fIoffset\fP argument was less
64
than zero.
65
.TP 7
66
.B EIO
67
An I/O error occurred while reading from or writing to a file system.
68
.TP 7
69
.B ENODEV
70
The \fIfd\fP argument does not refer to a regular file.
71
.TP 7
72
.B ENOSPC
73
There is insufficient free space remaining on the file system storage
74
media.
75
.TP 7
76
.B ESPIPE
77
The \fIfd\fP argument is associated with a pipe or FIFO.
78
.sp
79
.LP
80
\fIThe following sections are informative.\fP
81
.SH EXAMPLES
82
.LP
83
None.
84
.SH APPLICATION USAGE
85
.LP
86
The \fIposix_fallocate\fP() function is part of the Advisory Information
87
option and need not be provided on all
88
implementations.
89
.SH RATIONALE
90
.LP
91
None.
92
.SH FUTURE DIRECTIONS
93
.LP
94
None.
95
.SH SEE ALSO
96
.LP
97
\fIcreat\fP() , \fIftruncate\fP() , \fIopen\fP() , \fIunlink\fP()
98
, the Base Definitions volume of
99
IEEE\ Std\ 1003.1-2001, \fI<fcntl.h>\fP
100
.SH COPYRIGHT
101
Portions of this text are reprinted and reproduced in electronic form
102
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
103
-- Portable Operating System Interface (POSIX), The Open Group Base
104
Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
105
Electrical and Electronics Engineers, Inc and The Open Group. In the
106
event of any discrepancy between this version and the original IEEE and
107
The Open Group Standard, the original IEEE and The Open Group Standard
108
is the referee document. The original Standard can be obtained online at
109
http://www.opengroup.org/unix/online.html .