Submitted by: Akira Ikeuchi <a_ikeuchi@mic.mitsumi.co.jp> Reviewed by: Watanabe Kazuhiro <CQG00620@nifty.ne.jp>
121 lines
4.1 KiB
Groff
121 lines
4.1 KiB
Groff
.\" Copyright (c) 1983, 1991, 1993
|
|
.\" 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 8.1 (Berkeley) 6/4/93
|
|
.\" %FreeBSD: src/lib/libc/sys/truncate.2,v 1.16 2004/07/02 23:52:13 ru Exp %
|
|
.\"
|
|
.\" $FreeBSD$
|
|
.Dd June 4, 1993
|
|
.Dt TRUNCATE 2
|
|
.Os
|
|
.Sh ̾¾Î
|
|
.Nm truncate ,
|
|
.Nm ftruncate
|
|
.Nd »ØÄꤷ¤¿Ä¹¤µ¤Ë¥Õ¥¡¥¤¥ë¤òÀÚ¤ê¼Î¤Æ¤¿¤ê³ÈÄ¥¤·¤¿¤ê¤¹¤ë
|
|
.Sh ¥é¥¤¥Ö¥é¥ê
|
|
.Lb libc
|
|
.Sh ½ñ¼°
|
|
.In unistd.h
|
|
.Ft int
|
|
.Fn truncate "const char *path" "off_t length"
|
|
.Ft int
|
|
.Fn ftruncate "int fd" "off_t length"
|
|
.Sh ²òÀâ
|
|
.Fn truncate
|
|
¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï¡¢
|
|
.Fa path
|
|
¤Ç»ØÄꤵ¤ì¤ë¥Õ¥¡¥¤¥ë¤«
|
|
.Fa fd
|
|
¤Ç»²¾È¤µ¤ì¤ë¥Õ¥¡¥¤¥ë¤Î¥µ¥¤¥º¤¬¡¢
|
|
.Fa length
|
|
¥Ð¥¤¥È¤Ë¤Ê¤ë¤è¤¦¤ËÀÚ¤ê¼Î¤Æ¤¿¤ê³ÈÄ¥¤·¤Þ¤¹¡£
|
|
¥Õ¥¡¥¤¥ë¤¬¤³¤Î¥µ¥¤¥º¤è¤êÂ礤¤¾ì¹ç¤Ï¡¢Í¾Ê¬¤Ê¥Ç¡¼¥¿¤¬¼º¤ï¤ì¤Þ¤¹¡£
|
|
¥Õ¥¡¥¤¥ë¤¬¤³¤Î¥µ¥¤¥º¤è¤ê¾®¤µ¤¤¾ì¹ç¤Ï¡¢0 ¤¬½ñ¤¹þ¤Þ¤ì¤¿¤è¤¦¤Ë³ÈÄ¥¤µ¤ì¤Þ¤¹¡£
|
|
.Fn ftruncate
|
|
¤Ç¤Ï¡¢¥Õ¥¡¥¤¥ë¤¬½ñ¹þ¤ßÍѤ˳«¤¤¤Æ¤¤¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£
|
|
.Sh Ìá¤êÃÍ
|
|
.Rv -std
|
|
.Sh ¥¨¥é¡¼
|
|
.Fn truncate
|
|
¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï¡¢°Ê²¼¤Î¤è¤¦¤Ê¾ì¹ç¤Ë½èÍý¤ò¼ºÇÔ¤·¤Þ¤¹:
|
|
.Bl -tag -width Er
|
|
.It Bq Er ENOTDIR
|
|
¥Ñ¥¹¤Î¹½À®Í×ÁÇÃæ¤Ë¥Ç¥£¥ì¥¯¥È¥ê°Ê³°¤Î¤â¤Î¤¬´Þ¤Þ¤ì¤Æ¤¤¤Þ¤¹¡£
|
|
.It Bq Er ENAMETOOLONG
|
|
¥Ñ¥¹Ì¾¤Î¹½À®Í×ÁǤ¬ 255 ʸ»ú¤ò±Û¤¨¤Æ¤¤¤ë¤«¡¢
|
|
¤Þ¤¿¤Ï¥Ñ¥¹Ì¾Á´ÂΤ¬ 1023 ʸ»ú¤ò±Û¤¨¤Æ¤¤¤Þ¤¹¡£
|
|
.It Bq Er ENOENT
|
|
»ØÄꤵ¤ì¤¿¥Õ¥¡¥¤¥ë¤¬Â¸ºß¤·¤Þ¤»¤ó¡£
|
|
.It Bq Er EACCES
|
|
Á°Ã֥ѥ¹Ì¾¤Î¹½À®Í×ÁǤˤĤ¤¤Æ¸¡º÷µö²Ä¤¬µñÈݤµ¤ì¤Æ¤¤¤Þ¤¹¡£
|
|
.It Bq Er EACCES
|
|
»ØÄꤵ¤ì¤¿¥Õ¥¡¥¤¥ë¤Ë¥æ¡¼¥¶¤¬½ñ¤¹þ¤á¤Þ¤»¤ó¡£
|
|
.It Bq Er ELOOP
|
|
¥Ñ¥¹Ì¾¤òÊÑ´¹¤¹¤ë¤È¤¤Ë¸¡½Ð¤µ¤ì¤¿¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤¬Â¿¤¹¤®¤Þ¤¹¡£
|
|
.It Bq Er EISDIR
|
|
»ØÄꤵ¤ì¤¿¥Õ¥¡¥¤¥ë¤¬¥Ç¥£¥ì¥¯¥È¥ê¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£
|
|
.It Bq Er EROFS
|
|
»ØÄꤵ¤ì¤¿¥Õ¥¡¥¤¥ë¤ÏÆÉ¼è¤êÀìÍÑ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¾å¤Ë¤¢¤ê¤Þ¤¹¡£
|
|
.It Bq Er ETXTBSY
|
|
¥Õ¥¡¥¤¥ë¤¬¡¢¼Â¹ÔÃæ¤Î¥Ô¥å¥¢¥×¥í¥·¡¼¥¸¥ã (¶¦Í¥Æ¥¥¹¥È) ¥Õ¥¡¥¤¥ë¤Ç¤¹¡£
|
|
.It Bq Er EIO
|
|
inode ¤Î¹¹¿·¤ò¤·¤Æ¤¤¤ë´Ö¤ËÆþ½ÐÎÏ¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡£
|
|
.It Bq Er EFAULT
|
|
.Fa path
|
|
°ú¿ô¤¬¡¢¥×¥í¥»¥¹¤Ë³ä¤êÅö¤Æ¤é¤ì¤¿¥¢¥É¥ì¥¹¶õ´Ö¤ÎÈϰϳ°¤ò»Ø¤·¤Æ¤¤¤Þ¤¹¡£
|
|
.El
|
|
.Pp
|
|
.Fn ftruncate
|
|
¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï¡¢°Ê²¼¤Î¤è¤¦¤Ê¾ì¹ç¤Ë½èÍý¤ò¼ºÇÔ¤·¤Þ¤¹:
|
|
.Bl -tag -width Er
|
|
.It Bq Er EBADF
|
|
.Fa fd
|
|
°ú¿ô¤¬Í¸ú¤Êµ½Ò»Ò¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£
|
|
.It Bq Er EINVAL
|
|
.Fa fd
|
|
°ú¿ô¤Ï¥Õ¥¡¥¤¥ë¤Ç¤Ï¤Ê¤¯¥½¥±¥Ã¥È¤ò»²¾È¤·¤Æ¤¤¤Þ¤¹¡£
|
|
.It Bq Er EINVAL
|
|
.Fa fd
|
|
°ú¿ô¤¬½ñ¹þ¤ßÍѤ˳«¤¤¤Æ¤¤¤Þ¤»¤ó¡£
|
|
.El
|
|
.Sh ´ØÏ¢¹àÌÜ
|
|
.Xr open 2
|
|
.Sh ¥Ð¥°
|
|
¤³¤Î¸Æ½Ð¤·¤Ï¡¢¥Õ¥¡¥¤¥ë¤Î¤¢¤ëÈϰϤòÊü´þ¤Ç¤¤ë¤è¤¦¤Ë°ìÈ̲½¤¹¤ë
|
|
ɬÍפ¬¤¢¤ê¤Þ¤¹¡£
|
|
.Pp
|
|
.Fn truncate
|
|
¤ò»ÈÍѤ·¤Æ¥Õ¥¡¥¤¥ë¤ò³ÈÄ¥¤¹¤ë¤È¡¢°Ü¿¢À¤¬¼º¤ï¤ì¤Þ¤¹¡£
|
|
.Sh Îò»Ë
|
|
.Fn truncate
|
|
¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï¡¢
|
|
.Bx 4.2
|
|
¤ÇÅо줷¤Þ¤·¤¿¡£
|