OSDN Git Service

(split) Import translated manuals from JM CVS Repository.
[linuxjm/LDP_man-pages.git] / release / man2 / lseek.2
1 .\" Copyright (c) 1980, 1991 Regents of the University of California.
2 .\" 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.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\"    must display the following acknowledgement:
14 .\"     This product includes software developed by the University of
15 .\"     California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\"    may be used to endorse or promote products derived from this software
18 .\"    without specific prior written permission.
19 .\"
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
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 .\"     @(#)lseek.2     6.5 (Berkeley) 3/10/91
33 .\"
34 .\" Modified Fri Jul 23 22:17:00 1993 by Rik Faith <faith@cs.unc.edu>
35 .\" Modified 10 June 1995 by Andries Brouwer <aeb@cwi.nl>
36 .\" Modified Thu Oct 31 15:18:33 1996 by Eric S. Raymond <esr@thyrsus.com>
37 .\" Modified Sat Jan 17 13:00:32 MET 1998 by Michael Haardt
38 .\"   <michael@cantor.informatik.rwth-aachen.de>
39 .\" Modified Mon Sep 24 16:18:02 CEST 2001 by Michael Haardt <michael@moria.de>
40 .\"
41 .\" Japanese Version Copyright (c) 1997-1998 HANATAKA Shinya
42 .\"         all rights reserved.
43 .\" Translated 1997-02-23, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
44 .\" Modified 1998-05-11, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
45 .\" Updated 2001-12-14, Kentaro Shirakata <argrath@ub32.org>
46 .\" Updated 2003-09-08, Kentaro Shirakata <argrath@ub32.org>
47 .\" Updated 2005-02-24, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
48 .\" Updated 2006-03-05, Akihiro MOTOKI, catch up to LDP v2.25
49 .\"
50 .\"WORD:        end-of-file             ¥Õ¥¡¥¤¥ë¤Î½ªÃ¼(end-of-file)
51 .\"
52 .TH LSEEK 2 2001-09-24 "Linux" "Linux Programmer's Manual"
53 .SH Ì¾Á°
54 lseek \- ¥Õ¥¡¥¤¥ë¤ÎÆɤ߽ñ¤­¥ª¥Õ¥»¥Ã¥È¤Î°ÌÃÖ¤òÊѤ¨¤ë
55 .SH ½ñ¼°
56 .B #include <sys/types.h>
57 .br
58 .B #include <unistd.h>
59 .sp
60 .BI "off_t lseek(int " fd ", off_t " offset ", int " whence );
61 .SH ÀâÌÀ
62 .BR lseek ()
63 ´Ø¿ô¤Ï¡¢¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿ (descriptor)
64 .I fd
65 ¤ËÂбþ¤¹¤ë¥ª¡¼¥×¥ó¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¤Î¥ª¥Õ¥»¥Ã¥È¤ò¡¢
66 .IR  whence
67 ¤Ë´ð¤Å¤­
68 .I offset
69 °ú¤­¿ô¤Î°ÌÃ֤ذʲ¼¤Î¤è¤¦¤ËÊѹ¹¤¹¤ë:
70 .TP
71 .B SEEK_SET
72 ¥ª¥Õ¥»¥Ã¥È¤Ï
73 .I offset
74 ¥Ð¥¤¥È¤ËÀßÄꤵ¤ì¤ë¡£
75 .TP
76 .B SEEK_CUR
77 ¥ª¥Õ¥»¥Ã¥È¤Ï¸½ºß°ÌÃÖ¤Ë
78 .I offset
79 ¥Ð¥¤¥È¤ò­¤·¤¿°ÌÃ֤ˤʤ롣
80 .TP
81 .B SEEK_END
82 ¥ª¥Õ¥»¥Ã¥È¤Ï¥Õ¥¡¥¤¥ë¤Î¥µ¥¤¥º¤Ë
83 .I offset
84 ¥Ð¥¤¥È¤ò­¤·¤¿°ÌÃ֤ˤʤ롣
85 .PP
86 .BR lseek ()
87 ´Ø¿ô¤Ï¡¢¥ª¥Õ¥»¥Ã¥È¤ò¥Õ¥¡¥¤¥ë¤ÎËöÈø¤ò±Û¤¨¤¿°ÌÃÖ¤ËÀßÄê¤Ç¤­¤ë
88 (⤷¡¢¤³¤ì¤Ë¤è¤ê¥Õ¥¡¥¤¥ë¤Î¥µ¥¤¥º¤¬ÊѤï¤é¤Ê¤¤)¡£
89 ¤â¤·¥Ç¡¼¥¿¤¬¤³¤Î¥ª¥Õ¥»¥Ã¥È°ÌÃְʹߤ˽ñ¤­¹þ¤Þ¤ì¤¿¾ì¹ç¡¢
90 ´Ö¤Î¶õ·ä¤ÎÉôʬ ("·ê (hole)") ¤ÎÆɤ߽Ф·¤¬¤¢¤ë¤È¡¢
91 ¼ÂºÝ¤Ë¤½¤³¤Ë¥Ç¡¼¥¿¤ò½ñ¤­¹þ¤Þ¤ì¤ë¤Þ¤Ç¤Ï
92 NULL ¥Ð¥¤¥È (\(aq\\0\(aq) ¤ÎÎó¤¬ÊÖ¤µ¤ì¤ë¡£
93 .SH ÊÖ¤êÃÍ
94 À®¸ù¤·¤¿¾ì¹ç¡¢
95 .BR lseek ()
96 ¤Ï·ë²Ì¤Î¥Õ¥¡¥¤¥ë°ÌÃÖ¤ò¥Õ¥¡¥¤¥ë¤ÎÀèƬ¤«¤é¤Î¥Ð¥¤¥È¿ô¤ÇÊÖ¤¹¡£
97 ¥¨¥é¡¼¤Î¾ì¹ç¡¢ÃͤȤ·¤Æ \fI(off_t)\ \-1\fP ¤òÊÖ¤·¡¢
98 .I errno
99 ¤Ë¥¨¥é¡¼¤¬»Ø¼¨¤µ¤ì¤ë¡£
100 .SH ¥¨¥é¡¼
101 .TP
102 .B EBADF
103 .I fd
104 ¤¬¥ª¡¼¥×¥ó¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Ç¤Ê¤¤¡£
105 .TP
106 .B EINVAL
107 .I whence
108 ¤¬
109 .BR SEEK_SET ,
110 .BR SEEK_CUR ,
111 .B SEEK_END
112 ¤Î¤É¤ì¤Ç¤â¤Ê¤¤¡£
113 ¤Þ¤¿¤Ï¡¢seek ¤Î·ë²Ì¡¢¥Õ¥¡¥¤¥ë¡¦¥ª¥Õ¥»¥Ã¥È¤¬Éé¤Ë¤Ê¤Ã¤Æ¤·¤Þ¤¦¤«¡¢
114 seek ²Äǽ¤Ê¥Ç¥Ð¥¤¥¹¤ÎËöÈø¤ò±Û¤¨¤Æ¤·¤Þ¤¦¡£
115 .\" ¥·¥¹¥Æ¥à¤Ë¤è¤Ã¤Æ¤Ï¥­¥ã¥é¥¯¥¿¥Ç¥Ð¥¤¥¹¤ä¥ê¥â¡¼¥È¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤ËÂФ·¤Æ
116 .\" Éé¤Î¥ª¥Õ¥»¥Ã¥È¤¬µö¤µ¤ì¤ë¤«¤â¤·¤ì¤Ê¤¤¡£
117 .B EOVERFLOW
118 .\" ¤³¤Î¾ì¹ç HP-UX 11 ¤Ï EINVAL ¤òÊÖ¤¹ (°ìÊý¡¢POSIX.1 ¤Ï EOVERFLOW ¤òÊÖ¤¹)
119 ·ë²Ì¤Î¥Õ¥¡¥¤¥ë¡¦¥ª¥Õ¥»¥Ã¥È¤ò
120 .I off_t
121 ·¿¤Çɽ¸½¤¹¤ë¤³¤È¤¬¤Ç¤­¤Ê¤¤¡£
122 .TP
123 .B ESPIPE
124 .I fd
125 ¤¬¥Ñ¥¤¥×¡¢¥½¥±¥Ã¥È¡¢FIFO ¤ò»²¾È¤·¤Æ¤¤¤ë¡£
126 .SH ½àµò
127 SVr4, 4.3BSD, POSIX.1-2001.
128 .SH Ãí°Õ
129 ¤³¤Îʸ¾Ï¤Ç»ÈÍѤ·¤¿
130 .I whence
131 ¤Ï±Ñ¸ì¤È¤·¤ÆÀµ¤·¤¯¤Ê¤¤¤¬¡¢
132 Îò»ËŪÍýͳ¤Ë¤è¤ê¤½¤Î¤Þ¤Þ»È¤ï¤ì¤Æ¤¤¤ë¡£
133
134 ¤¤¤¯¤Ä¤«¤Î¥Ç¥Ð¥¤¥¹¤Ç¤Ï seek ¤¬¤Ç¤­¤Ê¤¤¡£
135 POSIX ¤Ï¤É¤Î¥Ç¥Ð¥¤¥¹¤¬
136 .BR lseek ()
137 ¤ËÂбþ¤¹¤Ù¤­¤«¤Ïµ¬Äꤷ¤Æ¤¤¤Ê¤¤¡£
138
139 Linux ¤Ç¤Ï¡¢ tty ¥Ç¥Ð¥¤¥¹¤Ë
140 .BR lseek ()
141 ¤ò»ÈÍѤ¹¤ë¤È
142 \fBESPIPE\fP ¤òÊÖ¤¹¡£
143 .\" Â¾¤Î¥·¥¹¥Æ¥à¤Ç¤Ï½ñ¤­¹þ¤Þ¤ì¤¿Ê¸»ú¤Î¿ô¤òÊÖ¤·¡¢
144 .\" SEEK_SET ¤òÍѤ¤¤Æ¥«¥¦¥ó¥¿¤òÀßÄꤹ¤ë¡£ (½ñ¤­¹þ¤Þ¤ì¤¿Ê¸»ú¤Î¡£)
145
146 ¸Å¤¤¥³¡¼¥É¤òÊÑ´¹¤¹¤ë»þ¤Ï \fIwhence\fP ¤ÎÃͤò°Ê²¼¤Î¥Þ¥¯¥í¤ËÃÖ¤­´¹¤¨¤ë¤³¤È:
147 .TS
148 c c
149 l l.
150 old     new
151 0       SEEK_SET
152 1       SEEK_CUR
153 2       SEEK_END
154 L_SET   SEEK_SET
155 L_INCR  SEEK_CUR
156 L_XTND  SEEK_END
157 .TE
158 .PP
159 ÊÖ¤êÃͤη¿¤Ï¡¢SVr1-3 ¤Ç¤Ï \fIoff_t\fP ¤Ç¤Ï¤Ê¤¯ \fIlong\fP ¤Ç¤¢¤ê¡¢
160 BSD ¤Ç¤Ï \fIint\fP ¤Ç¤¢¤ë¡£
161 .PP
162 .BR dup (2)
163 ¤ä
164 .BR fork (2)
165 ¤ÇºîÀ®¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Ï¡¢¸½ºß¤Î¥Õ¥¡¥¤¥ë°ÌÃ֥ݥ¤¥ó¥¿
166 (current file position pointer) ¤ò¶¦Í­¤·¤Æ¤¤¤ë¤Î¤Ç¡¢
167 ¤³¤Î¤è¤¦¤Ê¥Õ¥¡¥¤¥ë¤Ç°ÜÆ°¤ò¹Ô¤¦¤È¶¥¹ç¾õÂÖ¤ò°ú¤­µ¯¤³¤¹²ÄǽÀ­¤¬¤¢¤ë¡£
168 .SH ´ØÏ¢¹àÌÜ
169 .BR dup (2),
170 .BR fork (2),
171 .BR open (2),
172 .BR fseek (3),
173 .BR lseek64 (3),
174 .BR posix_fallocate (3)