OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [ecos-2.0/] [packages/] [net/] [tcpip/] [v2_0/] [doc/] [read.man] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1254 phoenix
NAME
2
       read - read from a file descriptor
3
 
4
SYNOPSIS
5
       ssize_t read(int fd, void *buf, size_t count);
6
 
7
DESCRIPTION
8
       read()  attempts  to  read  up  to  count  bytes from file
9
       descriptor fd into the buffer starting at buf.
10
 
11
       If count is zero, read() returns zero  and  has  no  other
12
       results.
13
 
14
 
15
RETURN VALUE
16
       On success, the number of bytes  read  is  returned  (zero
17
       indicates  end of file), and the file position is advanced
18
       by this number.  It is not an  error  if  this  number  is
19
       smaller  than the number of bytes requested; this may hap-
20
       pen for example because fewer bytes are actually available
21
       right  now (maybe because we were close to end-of-file, or
22
       because we are reading from a pipe, or from  a  terminal),
23
       or  because read() was interrupted by a signal.  On error,
24
       -1 is returned, and errno is set  appropriately.  In  this
25
       case  it is left unspecified whether the file position (if
26
       any) changes.
27
 
28
ERRORS
29
       EINTR   The call was interrupted by a  signal  before  any
30
               data was read.
31
 
32
       EAGAIN  Non-blocking  I/O  has  been selected using O_NON-
33
               BLOCK and no data was  immediately  available  for
34
               reading.
35
 
36
       EIO     I/O  error.  This will happen for example when the
37
               process is in a background process group, tries to
38
               read  from  its  controlling tty, and either it is
39
               ignoring or blocking SIGTTIN or its process  group
40
               is  orphaned.   It  may also occur when there is a
41
               low-level I/O error while reading from a  disk  or
42
               tape.
43
 
44
       EISDIR  fd refers to a directory.
45
 
46
       EBADF   fd  is  not a valid file descriptor or is not open
47
               for reading.
48
 
49
       EINVAL  fd is attached to an object  which  is  unsuitable
50
               for reading.
51
 
52
       Other  errors may occur, depending on the object connected
53
       to fd.  POSIX allows a  read  that  is  interrupted  after
54
       reading  some  data to return -1 (with errno set to EINTR)
55
       or to return the number of bytes already read.

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.