Merge pull request #5057 from mysterywolf/posix

[libc] fix the conflict warning of read and write functions
This commit is contained in:
Bernard Xiong 2021-09-14 22:32:15 +08:00 committed by GitHub
commit 673718c0a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -357,7 +357,7 @@ void rt_floppy_init(void)
device->read = rt_floppy_read;
device->write = rt_floppy_write;
device->control = rt_floppy_control;
device->user_data = NULL;
device->user_data = RT_NULL;
rt_device_register(device, "floppy",
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_REMOVABLE | RT_DEVICE_FLAG_STANDALONE);

View File

@ -110,7 +110,11 @@ RTM_EXPORT(close);
* @return the actual read data buffer length. If the returned value is 0, it
* may be reach the end of file, please check errno.
*/
#ifdef _READ_WRITE_RETURN_TYPE
_READ_WRITE_RETURN_TYPE read(int fd, void *buf, size_t len) /* some gcc tool chains will use different data structure */
#else
ssize_t read(int fd, void *buf, size_t len)
#endif
{
int result;
struct dfs_fd *d;
@ -150,7 +154,11 @@ RTM_EXPORT(read);
*
* @return the actual written data buffer length.
*/
#ifdef _READ_WRITE_RETURN_TYPE
_READ_WRITE_RETURN_TYPE write(int fd, const void *buf, size_t len) /* some gcc tool chains will use different data structure */
#else
ssize_t write(int fd, const void *buf, size_t len)
#endif
{
int result;
struct dfs_fd *d;