The number of bytes placed in buf on success, 0 if no data is available, or a negative value if an error occurred.