Re: [PATCH libmlx5] fix err return values to match ibv_post_send expectations

Jason Gunthorpe
2016-08-08T17:33:33Z

On Mon, Aug 08, 2016 at 12:52:13PM -0400, Jarod Wilson wrote:
> > If the man page doesn't document the function destroying errno, then
> > it should preserve it. Do not just randomly set errno.
>
> $ man ibv_post_send
> ...
> RETURN VALUE
> ibv_post_send() returns 0 on success, or the value of errno on
> failure (which indicates the failure reason).
> ...
>
> This is a little bit terse, but looks to me like it means to say do set
> errno in ibv_post_send. I really am not terribly familiar with this
> code

Yes, our man pages are a little baroque.

The phrase 'returns the value of errno' means it returns a E* value,
not errno itself and leaves errno alone.

Using the phrase 'it returns an error number' would be clearer and
more consistent with glibc documentation.

> patch if consensus is that errno shouldn't be touched. Looks like
> mlx5_post_send() will need some additional work as well if that's the case
> though.

Most likely.

Jason