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