OSDN Git Service

(split) Import translated manuals from JM CVS Repository.
[linuxjm/LDP_man-pages.git] / draft / man2 / pread.2
1 .\" Copyright (C) 1999 Joseph Samuel Myers.
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein.  The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .\" Japanese Version Copyright (c) 1999 HANATAKA Shinya
24 .\"         all rights reserved.
25 .\" Translated Fri Jun 25 23:32:20 JST 1999
26 .\"         by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
27 .\"
28 .\"WORD:        descriptor              ¥Ç¥£¥¹¥¯¥ê¥×¥¿
29 .\"WORD:        offset                  ¥ª¥Õ¥»¥Ã¥È
30 .\"WORD:        seek                    ¥·¡¼¥¯
31 .\"
32 .TH PREAD 2 2008-12-03 "Linux" "Linux Programmer's Manual"
33 .SH Ì¾Á°
34 .\"O pread, pwrite \- read from or write to a file descriptor at a given offset
35 pread, pwrite \- »ØÄꤷ¤¿¥ª¥Õ¥»¥Ã¥È¤Ç¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤òÆɤ߽ñ¤­¤¹¤ë
36 .SH ½ñ¼°
37 .B #define _XOPEN_SOURCE 500
38 .sp
39 .B #include <unistd.h>
40 .sp
41 .BI "ssize_t pread(int " fd ", void *" buf ", size_t " count \
42 ", off_t " offset );
43 .sp
44 .BI "ssize_t pwrite(int " fd ", const void *" buf ", size_t " count \
45 ", off_t " offset );
46 .SH ÀâÌÀ
47 .\"O .BR pread ()
48 .\"O reads up to
49 .\"O .I count
50 .\"O bytes from file descriptor
51 .\"O .I fd
52 .\"O at offset
53 .\"O .I offset
54 .\"O (from the start of the file) into the buffer starting at
55 .\"O .IR buf .
56 .\"O The file offset is not changed.
57 .BR pread ()
58 ¤Ï¡¢¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿
59 .I fd
60 ¤Î (¥Õ¥¡¥¤¥ë¤ÎÀèƬ¤«¤é¤Î) ¥ª¥Õ¥»¥Ã¥È
61 .I offset
62 ¤«¤éºÇÂç
63 .I count
64 ¥Ð¥¤¥È¤ò¥Ð¥Ã¥Õ¥¡
65 .I buf
66 ¤ØÆɤ߹þ¤à¡£¥Õ¥¡¥¤¥ë¡¦¥ª¥Õ¥»¥Ã¥È¤ÏÊѲ½¤·¤Ê¤¤¡£
67 .PP
68 .\"O .BR pwrite ()
69 .\"O writes up to
70 .\"O .I count
71 .\"O bytes from the buffer starting at
72 .\"O .I buf
73 .\"O to the file descriptor
74 .\"O .I fd
75 .\"O at offset
76 .\"O .IR offset .
77 .\"O The file offset is not changed.
78 .BR pwrite ()
79 ¤Ï¡¢¥Ð¥Ã¥Õ¥¡
80 .I buf
81 ¤«¤éºÇÂç
82 .I count
83 ¥Ð¥¤¥È¤ò¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿
84 .I fd
85 ¤Î¥ª¥Õ¥»¥Ã¥È
86 .I offset
87 ¤Ë½ñ¤­¹þ¤à¡£¥Õ¥¡¥¤¥ë¡¦¥ª¥Õ¥»¥Ã¥È¤ÏÊѲ½¤·¤Ê¤¤¡£
88 .PP
89 .\"O The file referenced by
90 .\"O .I fd
91 .\"O must be capable of seeking.
92 .I fd
93 ¤Ç»²¾È¤µ¤ì¤ë¥Õ¥¡¥¤¥ë¤Ï¥·¡¼¥¯ (seek) ²Äǽ¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
94 .SH ÊÖ¤êÃÍ
95 .\"O On success, the number of bytes read or written is returned (zero
96 .\"O indicates that nothing was written, in the case of
97 .\"O .BR pwrite (),
98 .\"O or
99 .\"O end of file, in the case of
100 .\"O .BR pread (),
101 .\"O or \-1 on error, in which case
102 .\"O .I errno
103 .\"O is set to indicate the error.
104 À®¸ù¤·¤¿¾ì¹ç¡¢Æɤ߽ñ¤­¤ò¹Ô¤Ã¤¿¥Ð¥¤¥È¿ô¤¬ÊÖ¤µ¤ì¤ë (¥¼¥í¤Ï¡¢
105 .BR pwrite ()
106 ¤Î¾ì¹ç¤Ë¤Ï²¿¤â½ñ¤«¤ì¤Ê¤«¤Ã¤¿¤³¤È¤ò°ÕÌ£¤·¡¢
107 .BR pread ()
108 ¤Î¾ì¹ç¤Ë¤Ï¥Õ¥¡¥¤¥ë
109 ¤ÎËöÈø¤Ë㤷¤¿¤³¤È¤ò°ÕÌ£¤¹¤ë)¡£
110 ¥¨¥é¡¼¤Î¾ì¹ç¤Ï \-1 ¤¬ÊÖ¤µ¤ì¡¢
111 .I errno
112 ¤¬¤½¤Î¥¨¥é¡¼¤ò¼¨¤¹¤è¤¦¤ËÀßÄꤵ¤ì¤ë¡£
113 .SH ¥¨¥é¡¼
114 .\"O .BR pread ()
115 .\"O can fail and set
116 .\"O .I errno
117 .\"O to any error specified for
118 .\"O .BR read (2)
119 .\"O or
120 .\"O .BR lseek (2).
121 .BR pread ()
122 ¤Ç¤Ï¡¢
123 .BR read (2)
124 ¤ª¤è¤Ó
125 .BR lseek (2)
126 ¤Çµ¬Äꤵ¤ì¤¿Á´¤Æ¤Î¥¨¥é¡¼¤¬È¯À¸¤¹¤ë²ÄǽÀ­¤¬¤¢¤ê¡¢
127 .I error
128 ¤Ë¤Ï¥¨¥é¡¼¤ò¼¨¤¹Ãͤ¬ÀßÄꤵ¤ì¤ë¡£
129 .\"O .BR pwrite ()
130 .\"O can fail and set
131 .\"O .I errno
132 .\"O to any error specified for
133 .\"O .BR write (2)
134 .\"O or
135 .\"O .BR lseek (2).
136 .BR pwrite ()
137 ¤Ç¤Ï¡¢
138 .BR write (2)
139 ¤ª¤è¤Ó
140 .BR lseek (2)
141 ¤Çµ¬Äꤵ¤ì¤¿Á´¤Æ¤Î¥¨¥é¡¼¤¬È¯À¸¤¹¤ë²ÄǽÀ­¤¬¤¢¤ê¡¢
142 .I error
143 ¤Ë¤Ï¥¨¥é¡¼¤ò¼¨¤¹Ãͤ¬ÀßÄꤵ¤ì¤ë¡£
144 .\"O .SH VERSIONS
145 .SH ¥Ð¡¼¥¸¥ç¥ó
146 .\"O The
147 .\"O .BR pread ()
148 .\"O and
149 .\"O .BR pwrite ()
150 .\"O system calls were added to Linux in
151 .\"O version 2.1.60; the entries in the i386 system call table were added
152 .\"O in 2.1.69.
153 .\"O C library support (including emulation using
154 .\"O .BR lseek (2)
155 .\"O on older kernels without the system calls) was added in glibc 2.1.
156 ¥·¥¹¥Æ¥à¥³¡¼¥ë
157 .BR pread ()
158 ¤È
159 .BR pwrite ()
160 ¤Ï Linux ¤Ë¥Ð¡¼¥¸¥ç¥ó 2.1.60 ¤ÇÄɲ䵤줿¡£
161 i386 ¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Î¥¨¥ó¥È¥ê¤Ï 2.1.69 ¤ÇÄɲ䵤줿¡£
162 (¥·¥¹¥Æ¥à¥³¡¼¥ë¤ò»ý¤¿¤Ê¤¤¸Å¤¤¥«¡¼¥Í¥ë¤Ç¤Î
163 .BR lseek (2)
164 ¤ò»È¤Ã¤¿¥¨¥ß¥å¥ì¡¼¥·¥ç¥ó¤ò´Þ¤á¤ë¤È)
165 C ¥é¥¤¥Ö¥é¥ê¤Ë¤ª¤±¤ë¥µ¥Ý¡¼¥È¤Ï glibc 2.1 ¤ÇÄɲ䵤줿¡£
166 .\"O .SH "CONFORMING TO"
167 .SH ½àµò
168 POSIX.1-2001.
169 .\"O .SH "SEE ALSO"
170 .SH ´ØÏ¢¹àÌÜ
171 .BR lseek (2),
172 .BR read (2),
173 .BR write (2),
174 .BR feature_test_macros (7)