socket file descriptors seem broken inside components
Posted: Thu Apr 20, 2017 8:09 am
Hi there,
I think the read() and write() system calls are broken for socket file descriptors. If I use read() and write() in a function compiled with my app_main, when I look at the assembly, I see that apparently the read and write calls are getting mapped directly onto lwip_read_r and lwip_write_r, which is almost certainly wrong, even though it 'works'. HOWEVER, when I move that function into a component and pass in the file descriptor I see that they are getting mapped to something inside libc, as I would have expected. Unfortunately this causes crashes and I don't know why, because my JTAG pins are taken up by an SD card.
Can someone please fix this! It's really a problem to have to re-write all my library code to use send/recv when it doesn't have to care about the difference between files and sockets.
I think the read() and write() system calls are broken for socket file descriptors. If I use read() and write() in a function compiled with my app_main, when I look at the assembly, I see that apparently the read and write calls are getting mapped directly onto lwip_read_r and lwip_write_r, which is almost certainly wrong, even though it 'works'. HOWEVER, when I move that function into a component and pass in the file descriptor I see that they are getting mapped to something inside libc, as I would have expected. Unfortunately this causes crashes and I don't know why, because my JTAG pins are taken up by an SD card.
Can someone please fix this! It's really a problem to have to re-write all my library code to use send/recv when it doesn't have to care about the difference between files and sockets.