Returns

The number of bytes read, which will not exceed the maximum size, sz. A negative value is returned if an error has occurred, in which
case errno is set to the constant ETIMEDOUT if
the operation did not complete before timeout seconds elapsed.