diff options
author | 2000-07-21 21:52:14 +0000 | |
---|---|---|
committer | 2000-07-21 21:52:14 +0000 | |
commit | 4a375d8b03f90d5df58e7715c63a52d71cceca59 (patch) | |
tree | 316dc1251b6e28398939d1964f2a114c075ab59b /lib/libc | |
parent | regen (diff) | |
download | wireguard-openbsd-4a375d8b03f90d5df58e7715c63a52d71cceca59.tar.xz wireguard-openbsd-4a375d8b03f90d5df58e7715c63a52d71cceca59.zip |
Document that truncate() can also be used to extend the size of a file.
From FreeBSD; ok deraadt@
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/sys/truncate.2 | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/libc/sys/truncate.2 b/lib/libc/sys/truncate.2 index 5c7128553d0..e07a0a353f1 100644 --- a/lib/libc/sys/truncate.2 +++ b/lib/libc/sys/truncate.2 @@ -1,4 +1,4 @@ -.\" $OpenBSD: truncate.2,v 1.7 2000/04/15 11:46:04 aaron Exp $ +.\" $OpenBSD: truncate.2,v 1.8 2000/07/21 21:52:14 naddy Exp $ .\" $NetBSD: truncate.2,v 1.7 1995/02/27 12:39:00 cgd Exp $ .\" .\" Copyright (c) 1983, 1991, 1993 @@ -40,7 +40,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 @@ -53,11 +53,14 @@ 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 +bytes in size. If the file was larger than this size, the extra data is lost. +If the file was smaller than this size, +it will be extended as if by writing bytes +with the value zero. With .Fn ftruncate , the file must be open for writing. @@ -123,6 +126,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 .Fn truncate |