Deleted Added
full compact
truncate.2 (108028) truncate.2 (108087)
1.\" Copyright (c) 1983, 1991, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 16 unchanged lines hidden (view full) ---

25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" @(#)truncate.2 8.1 (Berkeley) 6/4/93
1.\" Copyright (c) 1983, 1991, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 16 unchanged lines hidden (view full) ---

25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" @(#)truncate.2 8.1 (Berkeley) 6/4/93
33.\" $FreeBSD: head/lib/libc/sys/truncate.2 108028 2002-12-18 09:22:32Z ru $
33.\" $FreeBSD: head/lib/libc/sys/truncate.2 108087 2002-12-19 09:40:28Z ru $
34.\"
35.Dd June 4, 1993
36.Dt TRUNCATE 2
37.Os
38.Sh NAME
39.Nm truncate ,
40.Nm ftruncate
41.Nd truncate or extend a file to a specified length

--- 49 unchanged lines hidden (view full) ---

91The named file is a directory.
92.It Bq Er EROFS
93The named file resides on a read-only file system.
94.It Bq Er ETXTBSY
95The file is a pure procedure (shared text) file that is being executed.
96.It Bq Er EIO
97An I/O error occurred updating the inode.
98.It Bq Er EFAULT
34.\"
35.Dd June 4, 1993
36.Dt TRUNCATE 2
37.Os
38.Sh NAME
39.Nm truncate ,
40.Nm ftruncate
41.Nd truncate or extend a file to a specified length

--- 49 unchanged lines hidden (view full) ---

91The named file is a directory.
92.It Bq Er EROFS
93The named file resides on a read-only file system.
94.It Bq Er ETXTBSY
95The file is a pure procedure (shared text) file that is being executed.
96.It Bq Er EIO
97An I/O error occurred updating the inode.
98.It Bq Er EFAULT
99.Fa Path
99The
100.Fa path
101argument
100points outside the process's allocated address space.
101.El
102.Pp
103The
104.Fn ftruncate
105system call
106succeeds unless:
107.Bl -tag -width Er
108.It Bq Er EBADF
109The
110.Fa fd
102points outside the process's allocated address space.
103.El
104.Pp
105The
106.Fn ftruncate
107system call
108succeeds unless:
109.Bl -tag -width Er
110.It Bq Er EBADF
111The
112.Fa fd
113argument
111is not a valid descriptor.
112.It Bq Er EINVAL
113The
114.Fa fd
114is not a valid descriptor.
115.It Bq Er EINVAL
116The
117.Fa fd
118argument
115references a socket, not a file.
116.It Bq Er EINVAL
117The
118.Fa fd
119references a socket, not a file.
120.It Bq Er EINVAL
121The
122.Fa fd
123descriptor
119is not open for writing.
120.El
121.Sh SEE ALSO
122.Xr open 2
123.Sh BUGS
124These calls should be generalized to allow ranges
125of bytes in a file to be discarded.
126.Pp
127Use of
128.Fn truncate
129to extend a file is not portable.
130.Sh HISTORY
131The
132.Fn truncate
133system call appeared in
134.Bx 4.2 .
124is not open for writing.
125.El
126.Sh SEE ALSO
127.Xr open 2
128.Sh BUGS
129These calls should be generalized to allow ranges
130of bytes in a file to be discarded.
131.Pp
132Use of
133.Fn truncate
134to extend a file is not portable.
135.Sh HISTORY
136The
137.Fn truncate
138system call appeared in
139.Bx 4.2 .