From owner-svn-src-stable-8@FreeBSD.ORG Tue Jun 2 15:12:34 2015 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C9BBC4DF; Tue, 2 Jun 2015 15:12:34 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AAD77122F; Tue, 2 Jun 2015 15:12:34 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t52FCYML072516; Tue, 2 Jun 2015 15:12:34 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t52FCY7w072515; Tue, 2 Jun 2015 15:12:34 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201506021512.t52FCY7w072515@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 2 Jun 2015 15:12:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r283916 - in stable: 10/lib/libc/sys 8/lib/libc/sys 9/lib/libc/sys X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Jun 2015 15:12:35 -0000 Author: jhb Date: Tue Jun 2 15:12:33 2015 New Revision: 283916 URL: https://svnweb.freebsd.org/changeset/base/283916 Log: MFC 282417: Various updates to the ftruncate(2) documentation: - Note that ftruncate(2) can operate on shared memory objects and cross reference shm_open(2). - Note that ftruncate(2) does not change the file position pointer (aka seek pointer) of the file descriptor. - ftruncate(2) will fail with EINVAL for all sorts of other fd types than just sockets, so instead note that it fails for all but regular files and shared memory objects. - Note that ftruncate(2) also appeared in 4.2BSD along with truncate(2). (Or at least the manpage for both appeared in 4.2, I did not check the kernel code itself to see if either predated 4.2.) PR: 199472 Modified: stable/8/lib/libc/sys/truncate.2 Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libc/sys/ (props changed) Changes in other areas also in this revision: Modified: stable/10/lib/libc/sys/truncate.2 stable/9/lib/libc/sys/truncate.2 Directory Properties: stable/10/ (props changed) stable/9/lib/libc/ (props changed) stable/9/lib/libc/sys/ (props changed) Modified: stable/8/lib/libc/sys/truncate.2 ============================================================================== --- stable/8/lib/libc/sys/truncate.2 Tue Jun 2 15:09:33 2015 (r283915) +++ stable/8/lib/libc/sys/truncate.2 Tue Jun 2 15:12:33 2015 (r283916) @@ -28,7 +28,7 @@ .\" @(#)truncate.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd December 13, 2006 +.Dd May 4, 2015 .Dt TRUNCATE 2 .Os .Sh NAME @@ -60,9 +60,18 @@ 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. +.Pp +The +.Fn ftruncate +system call causes the file or shared memory object backing the file descriptor +.Fa fd +to be truncated or extended to +.Fa length +bytes in size. +The file descriptor must be a valid file descriptor open for writing. +The file position pointer associated with the file descriptor +.Fa fd +will not be modified. .Sh RETURN VALUES .Rv -std If the file to be modified is not a directory or @@ -129,7 +138,7 @@ is not a valid descriptor. The .Fa fd argument -references a socket, not a file. +references a file descriptor that is not a regular file or shared memory object. .It Bq Er EINVAL The .Fa fd @@ -138,11 +147,14 @@ is not open for writing. .El .Sh SEE ALSO .Xr chflags 2 , -.Xr open 2 +.Xr open 2 , +.Xr shm_open 2 .Sh HISTORY The .Fn truncate -system call appeared in +and +.Fn ftruncate +system calls appeared in .Bx 4.2 . .Sh BUGS These calls should be generalized to allow ranges