Added truncate(1) manpage; added comment about holes in du; removed

minix-vmd specificness of F_FREESP as minix now implements it too.
This commit is contained in:
Ben Gras 2006-01-11 17:18:53 +00:00
parent 50b06261b6
commit a9dd9784d1
3 changed files with 152 additions and 1 deletions

View file

@ -27,5 +27,10 @@ du \- print disk usage
.PP
\fIDu\fR examines one or more directories and prints the amount of space
occupied by the files in those directories and their subdirectories.
.SH BUGS
\fIDu\fR calculates disk usage based on file size. It could be there
are holes in the file, not occupying any actual disk blocks, causing
\fIdu\fR to overestimate disk usage. (\fIDu\fR does recognize and correctly
calculate disk usage when hard links are encountered.)
.SH "SEE ALSO"
.BR df (1).

146
man/man1/truncate.1 Normal file
View file

@ -0,0 +1,146 @@
.\"
.\" Copyright (c) 2000 Sheldon Hearn <sheldonh@FreeBSD.org>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD: src/usr.bin/truncate/truncate.1,v 1.12 2005/01/17 07:44:32 ru Exp $
.\"
.Dd July 4, 2000
.Dt TRUNCATE 1
.Os
.SH NAME
truncate \- truncate or extend the length of files
.SH SYNOPSIS
truncate
.Op Fl c
.Bk -words
.Fl s Xo
.Sm off
.Op Cm + | -
.Ar size
.Op Cm K | k | M | m | G | g
.Sm on
.Xc
.Ek
.Ar
truncate
.Op Fl c
.Bk -words
.Fl r Ar rfile
.Ek
.Ar
.SH DESCRIPTION
The
truncate
utility adjusts the length of each regular file given on the command-line.
.Pp
The following options are available:
.Bl -tag -width indent
.It Fl c
Do not create files if they do not exist.
The
truncate
utility does not treat this as an error.
No error messages are displayed
and the exit value is not affected.
.It Fl r Ar rfile
Truncate files to the length of the file
.Ar rfile .
.It Fl s Xo
.Sm off
.Op Cm + | -
.Ar size
.Op Cm K | k | M | m | G | g
.Sm on
.Xc
If the
.Ar size
argument is preceded by a plus sign
.Pq Cm + ,
files will be extended by this number of bytes.
If the
.Ar size
argument is preceded by a dash
.Pq Cm - ,
file lengths will be reduced by no more than this number of bytes,
to a minimum length of zero bytes.
Otherwise, the
.Ar size
argument specifies an absolute length to which all files
should be extended or reduced as appropriate.
.Pp
The
.Ar size
argument may be suffixed with one of
.Cm K ,
.Cm M
or
.Cm G
(either upper or lower case) to indicate a multiple of
Kilobytes, Megabytes or Gigabytes
respectively.
.El
.Pp
Exactly one of the
.Fl r
and
.Fl s
options must be specified.
.Pp
If a file is made smaller, its extra data is lost.
If a file is made larger,
it will be extended as if by writing bytes with the value zero.
If the file does not exist,
it is created unless the
.Fl c
option is specified.
.Pp
Note that,
while truncating a file causes space on disk to be freed,
extending a file does not cause space to be allocated.
To extend a file and actually allocate the space,
it is necessary to explicitly write data to it,
using (for example) the shell's
.Ql >>
redirection syntax, or
.Xr dd 1 .
.SH EXIT STATUS
.Ex -std
If the operation fails for an argument,
truncate
will issue a diagnostic
and continue processing the remaining arguments.
.SH SEE ALSO
.BR dd(1),
.BR touch(1),
.BR truncate(2)
.SH STANDARDS
The
truncate
utility conforms to no known standards.
.SH HISTORY
The
truncate
utility first appeared in FreeBSD 4.2.
.SH AUTHORS
The truncate utility was written by Sheldon Hearn <sheldonh@starjuice.net>.

View file

@ -187,7 +187,7 @@ segment is already locked.
.SP
.BI "fcntl(" fd ", F_FREESP, struct flock *" lkp ")"
.RS
This Minix-vmd specific call frees a segment of disk space occupied by the
This call frees a segment of disk space occupied by the
file associated with file descriptor
.IR fd .
The segment is described by the