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
|
.\" Hey Emacs! This file is -*- nroff -*- source.
.\"
.\" This manpage is Copyright (C) 1992 Drew Eckhardt;
.\" 1993 Michael Haardt, Ian Jackson.
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein. The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.\" Modified Sat Jul 24 00:06:00 1993 by Rik Faith <faith@cs.unc.edu>
.\" Modified Wed Jan 17 16:02:32 1996 by Michael Haardt
.\" <michael@cantor.informatik.rwth-aachen.de>
.\" Modified Thu Apr 11 19:26:35 1996 by Andries Brouwer <aeb@cwi.nl>
.\" Modified Sun Jul 21 18:59:33 1996 by Andries Brouwer <aeb@cwi.nl>
.\" Modified Fri Jan 31 16:47:33 1997 by Eric S. Raymond <esr@thyrsus.com>
.\" Modified Sat Jul 12 20:45:39 1997 by Michael Haardt
.\" <michael@cantor.informatik.rwth-aachen.de>
.\"
.\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
.\" all rights reserved.
.\" Translated 1997-02-23, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
.\" Modified 1997-09-28, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
.\" Updated & Modified 2005-02-24, Yuichi SATO <ysato444@yahoo.co.jp>
.\" Updated 2005-09-06, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
.\" Updated 2005-10-14, Akihiro MOTOKI
.\" Updated 2008-02-10, Akihiro MOTOKI, LDP v2.77
.\"
.\"WORD: descriptor ǥץ
.\"WORD: buffer Хåե
.\"WORD: signal ʥ
.\"WORD: process group ץ롼
.\"WORD: backgraound Хå
.\"WORD: orphan Ω
.\"WORD: open ץ
.\"WORD: directory ǥ쥯ȥ
.\"WORD: object ֥
.\"
.TH READ 2 2007-11-15 "Linux" "Linux Programmer's Manual"
.SH ̾
read \- ե롦ǥץɤ߹
.SH
.nf
.B #include <unistd.h>
.sp
.BI "ssize_t read(int " fd ", void *" buf ", size_t " count );
.fi
.SH
.BR read ()
ϥե롦ǥץ (file descriptor)
.I fd
.I count
ХȤ
.I buf
ǻϤޤХåեɤ߹⤦Ȥ롣
.PP
.I count
0 ʤС
.BR read ()
0 ֤¾˲ⵯʤ
.I count
.B SSIZE_MAX
礭С̤Ǥʤ
.SH ֤
硢ɤ߹Хȿ֤ (0 ϥեν̣)
ե֤Ϥοʤ롣
οᤷ꾮äȤƤ⥨顼ǤϤʤ;
㤨кˤϼºݤˤοʤ (եκǸ˶ᤤΤ
ʤѥ (pipe) ü (terminal) ɤ߹Ǥ뤫⤷ʤ)
.BR read ()
ʥ (signal) ˤäƳޤ줿ˤϵꤨ롣
顼ξϡ\-1 ֤졢
.I errno
Ŭڤꤵ롣ξϥե֤ѹ뤫ɤ
Ǥ롣
.SH 顼
.TP
.B EAGAIN
.B O_NONBLOCK
Ѥ (Non-blocking) I/O Ƥꡢ
˥ǡɤ߹߲ǽǤʤä
.TP
.B EBADF
.I fd
ͭʥե롦ǥץǤʤɤ߹ߤΤ
ץ (open) Ƥʤ
.TP
.B EFAULT
.I buf
ǽʥɥ쥹֤γˤ롣
.TP
.B EINTR
Υǡɤ߹ޤʤ˥ʥ˳ޤ줿
.TP
.B EINVAL
.I fd
ɤ߹ߤŬƤʤ֥ȤȤƤ롣
⤷ϡե뤬
.B O_DIRECT
ե饰ꤷƥץƤ뤬
.I buf
˻ꤵ줿ɥ쥹
.I count
˻ꤵ줿͡
ߤΥե륪եåȤΤ줫
饤ȤŬڤǤ롣
.TP
.B EINVAL
.I fd
.BR timerfd_create (2)
θƤӽФǺ줿
.BR read ()
˴ְäΥХåեϤ줿
ʤ
.BR timerfd_create (2)
ȤΤȡ
.TP
.B EIO
I/O 顼㤨ХץХåɡץ롼פǡ
椷Ƥ tty ɤ߹⤦Ȥ
.B SIGTTIN
̵ (ignore) ޤ϶ػ (blocking) Ƥ䡢
Υץ롼פΩ (orphan) Ƥ˵롣
ޤǥơפɤǤ٥ I/O 顼
ȯˤⵯ롣
.TP
.B EISDIR
.I fd
ǥ쥯ȥȤƤ롣
.PP
.I fd
³Ƥ륪֥ȤˤäƤ¾Υ顼ⵯꤨ롣
POSIX Ǥϡ
餫Υǡɤ˳ߤä硢
.BR read ()
.RI ( errno
.B EINTR
ꤷ) \-1 ֤Ƥ褤
ɤ߹Хȿ֤Ƥ褤
.SH
SVr4, 4.3BSD, POSIX.1-2001.
.SH
NFS ˤơ̤Υǡɤ߹硢ǽλΤߤ˥ࡦ
פ졢³ǤϹʤ
ϥ饤¦°ΥåԤʤǤ롣
ʤʤС⤷Ƥ NFS 饤Ȥ st_atime (ǽե륢)
ιС餺饤¦ǥåɤळȤ
СС¦Ǥ read ȯʤΤ st_atime ιϹԤʤ줫
UNIX Ǥϡ饤¦°Υå̵ˤ뤳Ȥǡ
뤳ȤǤ롣ۤȤɤξǤϤ³С
٤äѥեޥ㲼⤿餹
.PP
¿Υե륷ƥǥ
.B O_NONBLOCK
μϤʤƤѤय餤˽ʬ˹®ǤȹͤƤ롣
ǤΤ褦ʥեǥˤ
.B O_NONBLOCK
ѤǤʤ⤷ʤ
.SH Ϣ
.BR close (2),
.BR fcntl (2),
.BR ioctl (2),
.BR lseek (2),
.BR open (2),
.BR pread (2),
.BR readdir (2),
.BR readlink (2),
.BR readv (2),
.BR select (2),
.BR write (2),
.BR fread (3)
|