summaryrefslogtreecommitdiffstats
path: root/lib/libc/sys/truncate.2
diff options
context:
space:
mode:
authoralex <alex@FreeBSD.org>1996-06-07 01:34:47 +0000
committeralex <alex@FreeBSD.org>1996-06-07 01:34:47 +0000
commit428ee3c3355ecf218c47b06437118e1874af24c8 (patch)
treebb8389a7d17ceda4bdd71d181893b503187a0150 /lib/libc/sys/truncate.2
parent0aa6551c71df42077340060b613cd357fa1aea98 (diff)
downloadFreeBSD-src-428ee3c3355ecf218c47b06437118e1874af24c8.zip
FreeBSD-src-428ee3c3355ecf218c47b06437118e1874af24c8.tar.gz
Document that truncate can also be used to extend the size of a file,
but doing so is not truly portable.
Diffstat (limited to 'lib/libc/sys/truncate.2')
-rw-r--r--lib/libc/sys/truncate.210
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/libc/sys/truncate.2 b/lib/libc/sys/truncate.2
index 2a5f3a6..b9c039a 100644
--- a/lib/libc/sys/truncate.2
+++ b/lib/libc/sys/truncate.2
@@ -37,7 +37,7 @@
.Sh NAME
.Nm truncate ,
.Nm ftruncate
-.Nd truncate a file to a specified length
+.Nd truncate or extend a file to a specified length
.Sh SYNOPSIS
.Fd #include <unistd.h>
.Ft int
@@ -50,11 +50,13 @@ causes the file named by
.Fa path
or referenced by
.Fa fd
-to be truncated to at most
+to be truncated or extended to
.Fa length
bytes in size. If the file previously
was larger than this size, the extra data
is lost.
+If the file was smaller than this size,
+extra zeros are appended.
With
.Fn ftruncate ,
the file must be open for writing.
@@ -116,6 +118,10 @@ is not open for writing.
.Sh BUGS
These calls should be generalized to allow ranges
of bytes in a file to be discarded.
+.Pp
+Use of
+.Fn truncate
+to extend a file is not portable.
.Sh HISTORY
The
.Nm
OpenPOWER on IntegriCloud