source: rtems/cpukit/libcsupport/src/read.c @ 9b4422a2

4.11
Last change on this file since 9b4422a2 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on May 3, 2012 at 3:09:24 PM

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*
2 *  read() - POSIX 1003.1b 6.4.1 - Read From a File
3 *
4 *  COPYRIGHT (c) 1989-2011.
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.rtems.com/license/LICENSE.
10 */
11
12#if HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#include <rtems/libio_.h>
17#include <rtems/seterr.h>
18
19ssize_t read(
20  int         fd,
21  void       *buffer,
22  size_t      count
23)
24{
25  ssize_t      rc;
26  rtems_libio_t *iop;
27
28  rtems_libio_check_fd( fd );
29  iop = rtems_libio_iop( fd );
30  rtems_libio_check_is_open( iop );
31  rtems_libio_check_buffer( buffer );
32  rtems_libio_check_count( count );
33  rtems_libio_check_permissions_with_error( iop, LIBIO_FLAGS_READ, EBADF );
34
35  /*
36   *  Now process the read().
37   */
38  rc = (*iop->pathinfo.handlers->read_h)( iop, buffer, count );
39
40  if ( rc > 0 )
41    iop->offset += rc;
42
43  return rc;
44}
45
46/*
47 *  _read_r
48 *
49 *  This is the Newlib dependent reentrant version of read().
50 */
51
52#if defined(RTEMS_NEWLIB) && !defined(HAVE__READ_R)
53
54#include <reent.h>
55
56ssize_t _read_r(
57  struct _reent *ptr __attribute__((unused)),
58  int            fd,
59  void          *buf,
60  size_t         nbytes
61)
62{
63  return read( fd, buf, nbytes );
64}
65#endif
Note: See TracBrowser for help on using the repository browser.