Skip to content

Commit 673718c

Browse files
authored
Merge pull request #5057 from mysterywolf/posix
[libc] fix the conflict warning of read and write functions
2 parents 8e31120 + e91ffdd commit 673718c

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

bsp/x86/drivers/floppy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ void rt_floppy_init(void)
357357
device->read = rt_floppy_read;
358358
device->write = rt_floppy_write;
359359
device->control = rt_floppy_control;
360-
device->user_data = NULL;
360+
device->user_data = RT_NULL;
361361

362362
rt_device_register(device, "floppy",
363363
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_REMOVABLE | RT_DEVICE_FLAG_STANDALONE);

components/dfs/src/dfs_posix.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,11 @@ RTM_EXPORT(close);
110110
* @return the actual read data buffer length. If the returned value is 0, it
111111
* may be reach the end of file, please check errno.
112112
*/
113+
#ifdef _READ_WRITE_RETURN_TYPE
114+
_READ_WRITE_RETURN_TYPE read(int fd, void *buf, size_t len) /* some gcc tool chains will use different data structure */
115+
#else
113116
ssize_t read(int fd, void *buf, size_t len)
117+
#endif
114118
{
115119
int result;
116120
struct dfs_fd *d;
@@ -150,7 +154,11 @@ RTM_EXPORT(read);
150154
*
151155
* @return the actual written data buffer length.
152156
*/
157+
#ifdef _READ_WRITE_RETURN_TYPE
158+
_READ_WRITE_RETURN_TYPE write(int fd, const void *buf, size_t len) /* some gcc tool chains will use different data structure */
159+
#else
153160
ssize_t write(int fd, const void *buf, size_t len)
161+
#endif
154162
{
155163
int result;
156164
struct dfs_fd *d;

0 commit comments

Comments
 (0)