Lines Matching +full:write +full:- +full:to +full:- +full:read

1 // SPDX-License-Identifier: GPL-2.0-only
10 /* Test Write
12 * A wrapper for write(2), that automatically handles the following
16 * + Write of less than requested amount
17 * + Non-block return (EAGAIN)
19 * For each of the above, an additional write is performed to automatically
21 * There are also many cases where write(2) can return an unexpected
24 * Note, for function signature compatibility with write(2), this function
26 * to the number of requested bytes. All other conditions in this and
27 * future enhancements to this function either automatically issue another
28 * write(2) or cause a TEST_ASSERT failure.
31 * fd - Opened file descriptor to file to be written.
32 * count - Number of bytes to write.
35 * buf - Starting address of data to be written.
49 * write(2) manpage for details. in test_write()
54 rc = write(fd, ptr, num_left); in test_write()
57 case -1: in test_write()
59 "Unexpected write failure,\n" in test_write()
70 TEST_ASSERT(rc >= 0, "Unexpected ret from write,\n" in test_write()
73 num_left -= rc; in test_write()
82 /* Test Read
84 * A wrapper for read(2), that automatically handles the following
88 * + Read of less than requested amount
89 * + Non-block return (EAGAIN)
91 * For each of the above, an additional read is performed to automatically
93 * There are also many cases where read(2) can return an unexpected
96 * contains at least the number of requested bytes to be read. A TEST_ASSERT
97 * failure is produced if an End-Of-File condition occurs, before all the
98 * data is read. It is the callers responsibility to assure that sufficient
101 * Note, for function signature compatibility with read(2), this function
102 * returns the number of bytes read, but that value will always be equal
103 * to the number of requested bytes. All other conditions in this and
104 * future enhancements to this function either automatically issue another
105 * read(2) or cause a TEST_ASSERT failure.
108 * fd - Opened file descriptor to file to be read.
109 * count - Number of bytes to read.
112 * buf - Starting address of where to write the bytes read.
115 * On success, number of bytes read.
126 * read(2) manpage for details. in test_read()
131 rc = read(fd, ptr, num_left); in test_read()
134 case -1: in test_read()
136 "Unexpected read failure,\n" in test_read()
147 TEST_ASSERT(rc > 0, "Unexpected ret from read,\n" in test_read()
150 num_left -= rc; in test_read()