-
Notifications
You must be signed in to change notification settings - Fork 217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
return for a timeout is negative 4 #970
Comments
Is this the comment you are referring to? Line 224 in afb5f7b
Note that a read of size 0 typically indicates an EOF condition. POSIX says this about read():
This is a paradigm that OSAL is borrowing/passing through here, so returning I will update the documentation to correct this. We should probably also add a note that a read of size 0 is the EOF indicator. |
yep, the api comments need to not say timeout == 0. |
and just to double-check, double-confirm... for TCP sockets the "replacement" for send and recv calls is OS_TimedRead and OS_TimeWrite, correct? |
Yes, Or regular OS_read/OS_write if you don't need a timeout. The SendTo/RecvFrom abstractions are only intended for datagram sockets. Stream sockets should use either form of read/write to transfer data. |
Update the API documentation for OS_read/write/TimedRead/TimedWrite. Clarify that zero will be returned on EOF condition, and in the case of the timed API calls, the OS_ERR_TIMEOUT status code will be returned if the timeout expired without the handle becoming readable/writable during that time. This is intended to allow the caller to differentiate between a handle which is in a state where it cannot read/write data (e.g. at EOF, or a pipe/socket with remote end closed) and handle which is simply idle or busy.
Fix #970, update documentation for read/write
Adjust strncpy call to not trigger warning
Fix nasa#970, strncpy warning
osal/src/os/shared/src/osapi-file.c
Line 208 in afb5f7b
Not sure which layer of abstraction to report this but the comment states that a timeout should return 0. However, on Linux/portable BSD... the eventual call to OS_DoSelect is returning OS_ERROR_TIMEOUT (-4) and flowing that all the to the OS_TimedRead API. I would prefer it to be "caught" and returned as 0 at some point but.. more than anything.. just need the comment to match.
The text was updated successfully, but these errors were encountered: