DouglasGray / xsk-rs

A Rust interface for Linux AF_XDP sockets
MIT License
68 stars 16 forks source link

Translate error codes to errno by inverting #16

Closed tdittr closed 2 years ago

tdittr commented 2 years ago

This allows std::io::Error::from_raw_os_error to translate the number to an error name.


Thanks again for creating the library. I had another try with it and it works great :) the only small "pain-point" I had was that the error codes returned for some of the system calls were not translated because they were negative. I think this PR should fix this.

Also is there a reason why FrameDesc does not implement Default? I needed some FrameDescs when fetching packets. I solved it by just keeping a copy of one of the original FrameDescs around in my struct.

DouglasGray commented 2 years ago

Good catch on those error codes, that was an oversight on my part. All looks good apart from one minor comment.

Re FrameDesc not implementing Default there's no reason, but if you've a PR I'd certainly accept it or I'll chuck it in before the release with these changes you submitted.

tdittr commented 2 years ago

Hi thanks :) your suggestion is correct.

I can try to make a PR, although it will take me at least two weeks as I'm currently away from my PC.

DouglasGray commented 2 years ago

Thanks for the PR, much appreciated!

And no worries, I'll add a default impl to FrameDesc before release