X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/2d21ac55c334faf3a56e5634905ed6987fc787d4..4bd07ac2140668789aa3ee8ec4dde4a3e0a3bba5:/bsd/man/man2/truncate.2 diff --git a/bsd/man/man2/truncate.2 b/bsd/man/man2/truncate.2 index 660045be5..b82853d56 100644 --- a/bsd/man/man2/truncate.2 +++ b/bsd/man/man2/truncate.2 @@ -53,20 +53,29 @@ .Fa "off_t length" .Fc .Sh DESCRIPTION -.Fn Truncate -causes the file named by -.Fa path +.Fn ftruncate +and +.Fn truncate +cause the file named by +.Fa path , or referenced by -.Fa fildes -to be truncated or extended to +.Fa fildes , +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, it will be extended as -if by writing bytes with the value zero. -With -.Fn ftruncate , -the file must be open for writing. +bytes in size. If the file size exceeds +.Fa length , +any extra data is discarded. If the file size is smaller than +.Fa length , +the file is extended and filled with zeros to the indicated length. +The +.Fn ftruncate +form requires the file to be open for writing. +.Pp +Note: +.Fn ftruncate +and +.Fn truncate +do not modify the current file offset for any open file descriptions associated with the file. .Sh RETURN VALUES A value of 0 is returned if the call succeeds. If the call fails a -1 is returned, and the global variable