File: truncate.2

package info (click to toggle)
manpages-ja 0.5.0.0.20080615-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 20,508 kB
  • ctags: 1
  • sloc: sh: 13,690; perl: 157; makefile: 114
file content (222 lines) | stat: -rw-r--r-- 6,893 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
.\" Copyright (c) 1983, 1991 The Regents of the University of California.
.\" 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.
.\" 3. All advertising materials mentioning features or use of this software
.\"    must display the following acknowledgement:
.\"	This product includes software developed by the University of
.\"	California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\"    may be used to endorse or promote products derived from this software
.\"    without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
.\"
.\"     @(#)truncate.2	6.9 (Berkeley) 3/10/91
.\"
.\" Modified 1993-07-24 by Rik Faith <faith@cs.unc.edu>
.\" Modified 1996-10-22 by Eric S. Raymond <esr@thyrsus.com>
.\" Modified 1998-12-21 by Andries Brouwer <aeb@cwi.nl>
.\" Modified 2002-01-07 by Michael Kerrisk <mtk.manpages@gmail.com>
.\" Modified 2002-04-06 by Andries Brouwer <aeb@cwi.nl>
.\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
.\"
.\" Japanese Version Copyright (c) 1997 SUTO, Mitsuaki
.\"         all rights reserved.
.\" Translated 1997-06-26, SUTO, Mitsuaki <suto@av.crl.sony.co.jp>
.\" Modified 2000-03-12, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
.\" Updated 2001-01-09, Kentaro Shirakata <argrath@ub32.org>
.\" Updated 2002-04-13, Kentaro Shirakata <argrath@ub32.org>
.\" Updated 2002-10-21, Kentaro Shirakata <argrath@ub32.org>
.\" Updated 2005-09-06, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
.\" Updated 2006-07-21, Akihiro MOTOKI, LDP v2.36
.\"
.TH TRUNCATE 2 2007-07-26 "Linux" "Linux Programmer's Manual"
.SH ̾
truncate, ftruncate \- ꤷĹ˥եڤͤ
.SH 
.B #include <unistd.h>
.br
.B #include <sys/types.h>
.sp
.BI "int truncate(const char *" path ", off_t " length );
.br
.BI "int ftruncate(int " fd ", off_t " length );
.sp
.in -4n
glibc εǽޥ׷
.RB ( feature_test_macros (7)
):
.in
.ad l
.sp
.BR getdtablesize ():
_BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 || _POSIX_C_SOURCE\ >=\ 200112L
.ad b
.SH 
.BR truncate ()

.I path
ǻꤵե
.BR ftruncate ()

.I fd
ǻȤե
.I length
ХȤĹˤʤ褦˱Ĺ롢⤷ڤͤ롣
⤷ڤͤΥե뤬
.I length
ĹСlength ХȤۤʬΥǡϼ롣
⤷ڤͤΥե뤬
.I length
ûСĥ롣
ĥ줿ʬɤ NULL Х ('\\0') ֤롣
.LP
ե륪եåȤѹʤ
.LP
礭ѹȡե st_ctime  st_mtime ե
(줾ǽѹǽ;
.BR stat (2)
) 롣
ޤset-user-ID  set-group-ID εĥӥåȤꥢ뤫⤷ʤ
.LP
.BR ftruncate ()
ξ硢եϽ񤭹Ѥ˳ƤʤФʤʤ
.BR truncate ()
ξ硢եϽ񤭹߲ǽǤʤФʤʤ
.SH ֤
 0 ֤롣Ԥ \-1 ֤ꡢ
.I errno
顼Ƥ˽äꤵ롣
.SH 顼
.BR truncate ()
ǤϰʲΥ顼ɤƤ롣
.TP
.B EACCES
ѥǻꤵƤǥ쥯ȥ˸ĤΤʤΤ
(:x ӥåȤΩäƤʤ)
뤤ϡꤵ줿եФ񤭹ߵĤäƤʤ
.RB ( path_resolution (7)
⻲ȤΤ)
.TP
.B EFAULT
.I path
ץ˳ƤƤ륢ɥ쥹ֳؤƤ롣
.TP
.B EFBIG

.I length
ե륵礭(XSI)
.TP
.B EINTR
¹˥ʥ
.TP
.B EINVAL

.I length
Ǥ뤫ե륵礭
.TP
.B EIO
inode ι I/O 顼ȯ
.TP
.B EISDIR
ꤵ줿եϥǥ쥯ȥǤ롣
.TP
.B ELOOP
ѥ᤹̾ݤ˥ܥå󥯤¿
.TP
.B ENAMETOOLONG
ѥ̾Υǥ쥯ȥ̾ 255 ʸۤƤ롢⤷ϥѥ̾Τ
1023 ʸۤƤ롣
.TP
.B ENOENT
ꤵ줿̾Υե뤬¸ߤʤ
.TP
.B ENOTDIR
ѥ̾ιܤ˥ǥ쥯ȥǤϤʤΤäƤ롣
.TP
.B EPERM
.\" This happens for at leas MSDOS and VFAT fil systems
.\" on kernel 2.6.13
ؤˤե륷ƥǤϡߤΥեĹۤ
եĹ뤳ȤǤʤ
.TP
.B EROFS
ꤵ줿եɤ߽ФѤΥե륷ƥˤ롣
.TP
.B ETXTBSY
ꤵ줿եϼ¹ԤƤեǤ롣
.PP
.BR ftruncate  ()
ˤƱͤΥ顼ŬѤ롣
â
.I path
˴ؤ륨顼ξ
.I fd
˴ؤ륨顼Ȥʤ롣
.TP
.B EBADF
.I fd
̵ʥǥץ(descripter)Ǥ롣
.TP
.BR EBADF " ޤ " EINVAL
.I fd
ǻꤵƤΤ񤭹ߥ⡼ɤdzƤʤ
.TP
.B EINVAL
.I fd
̾Υե򻲾ȤƤʤ
.SH 
4.4BSD, SVr4, POSIX.1-2001 (Υ 4.2BSD ǽо줷)
.\" POSIX 1003.1-1996 ˤ
.\" .BR ftruncate ()
.\" 롣
.\" POSIX.1-2001 ˤ
.\" XSI ĥȤ
.\" .BR truncate ()
.\" ⤢롣
.\" .LP
.\" SVr4 ˤ¾Υ顼ɤȤơ
.\" .BR truncate ()
.\" ˤ EMFILE, EMULTIHP, ENFILE, ENOLINK 
.\" .BR ftruncate ()
.\" ˤ EAGAIN 줾쵭ҤƤ롣
.SH 
嵭εҤ XSI ΥƥΤΤǤ롣
XSI Υƥξ硢POSIX ɸ
.BR ftruncate ()
Ф
.I length
եĹĹä硢
顼֤եĥ뤫ĤưƤƤ롣
.BR truncate ()
ФƤꤵƤʤ
ۤȤɤ Unix Ʊ͡Linux ϥͥƥ (Linux ͳ) 
ե륷ƥΰǤ XSI ׵ͤˤäƤ롣
ʤ顢Ĥͥƥ֤Υե륷ƥǤϡ
.BR truncate ()

.BR ftruncate ()
ȤäƸߤΥեĹۤƥեĹ뤳ȤǤʤ
Linux Ǥͭ̾ȤƤ VFAT 롣
.SH Ϣ
.BR open (2),
.BR stat (2),
.BR path_resolution (7)