1 .\" Copyright (C) 1999 Joseph Samuel Myers.
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.
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.
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
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
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>
28 .\"WORD: descriptor ¥Ç¥£¥¹¥¯¥ê¥×¥¿
29 .\"WORD: offset ¥ª¥Õ¥»¥Ã¥È
32 .TH PREAD 2 2008-12-03 "Linux" "Linux Programmer's Manual"
34 .\"O pread, pwrite \- read from or write to a file descriptor at a given offset
35 pread, pwrite \- »ØÄꤷ¤¿¥ª¥Õ¥»¥Ã¥È¤Ç¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤òÆɤ߽ñ¤¤¹¤ë
37 .B #define _XOPEN_SOURCE 500
39 .B #include <unistd.h>
41 .BI "ssize_t pread(int " fd ", void *" buf ", size_t " count \
44 .BI "ssize_t pwrite(int " fd ", const void *" buf ", size_t " count \
50 .\"O bytes from file descriptor
54 .\"O (from the start of the file) into the buffer starting at
56 .\"O The file offset is not changed.
58 ¤Ï¡¢¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿
60 ¤Î (¥Õ¥¡¥¤¥ë¤ÎÀèƬ¤«¤é¤Î) ¥ª¥Õ¥»¥Ã¥È
66 ¤ØÆɤ߹þ¤à¡£¥Õ¥¡¥¤¥ë¡¦¥ª¥Õ¥»¥Ã¥È¤ÏÊѲ½¤·¤Ê¤¤¡£
71 .\"O bytes from the buffer starting at
73 .\"O to the file descriptor
77 .\"O The file offset is not changed.
83 ¥Ð¥¤¥È¤ò¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿
87 ¤Ë½ñ¤¹þ¤à¡£¥Õ¥¡¥¤¥ë¡¦¥ª¥Õ¥»¥Ã¥È¤ÏÊѲ½¤·¤Ê¤¤¡£
89 .\"O The file referenced by
91 .\"O must be capable of seeking.
93 ¤Ç»²¾È¤µ¤ì¤ë¥Õ¥¡¥¤¥ë¤Ï¥·¡¼¥¯ (seek) ²Äǽ¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
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
99 .\"O end of file, in the case of
101 .\"O or \-1 on error, in which case
103 .\"O is set to indicate the error.
104 À®¸ù¤·¤¿¾ì¹ç¡¢Æɤ߽ñ¤¤ò¹Ô¤Ã¤¿¥Ð¥¤¥È¿ô¤¬ÊÖ¤µ¤ì¤ë (¥¼¥í¤Ï¡¢
106 ¤Î¾ì¹ç¤Ë¤Ï²¿¤â½ñ¤«¤ì¤Ê¤«¤Ã¤¿¤³¤È¤ò°ÕÌ£¤·¡¢
109 ¤ÎËöÈø¤Ë㤷¤¿¤³¤È¤ò°ÕÌ£¤¹¤ë)¡£
110 ¥¨¥é¡¼¤Î¾ì¹ç¤Ï \-1 ¤¬ÊÖ¤µ¤ì¡¢
112 ¤¬¤½¤Î¥¨¥é¡¼¤ò¼¨¤¹¤è¤¦¤ËÀßÄꤵ¤ì¤ë¡£
115 .\"O can fail and set
117 .\"O to any error specified for
126 ¤Çµ¬Äꤵ¤ì¤¿Á´¤Æ¤Î¥¨¥é¡¼¤¬È¯À¸¤¹¤ë²ÄǽÀ¤¬¤¢¤ê¡¢
128 ¤Ë¤Ï¥¨¥é¡¼¤ò¼¨¤¹Ãͤ¬ÀßÄꤵ¤ì¤ë¡£
130 .\"O can fail and set
132 .\"O to any error specified for
141 ¤Çµ¬Äꤵ¤ì¤¿Á´¤Æ¤Î¥¨¥é¡¼¤¬È¯À¸¤¹¤ë²ÄǽÀ¤¬¤¢¤ê¡¢
143 ¤Ë¤Ï¥¨¥é¡¼¤ò¼¨¤¹Ãͤ¬ÀßÄꤵ¤ì¤ë¡£
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
153 .\"O C library support (including emulation using
155 .\"O on older kernels without the system calls) was added in glibc 2.1.
160 ¤Ï Linux ¤Ë¥Ð¡¼¥¸¥ç¥ó 2.1.60 ¤ÇÄɲ䵤줿¡£
161 i386 ¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Î¥¨¥ó¥È¥ê¤Ï 2.1.69 ¤ÇÄɲ䵤줿¡£
162 (¥·¥¹¥Æ¥à¥³¡¼¥ë¤ò»ý¤¿¤Ê¤¤¸Å¤¤¥«¡¼¥Í¥ë¤Ç¤Î
164 ¤ò»È¤Ã¤¿¥¨¥ß¥å¥ì¡¼¥·¥ç¥ó¤ò´Þ¤á¤ë¤È)
165 C ¥é¥¤¥Ö¥é¥ê¤Ë¤ª¤±¤ë¥µ¥Ý¡¼¥È¤Ï glibc 2.1 ¤ÇÄɲ䵤줿¡£
166 .\"O .SH "CONFORMING TO"
174 .BR feature_test_macros (7)