Skip to content

Commit

Permalink
Introduce ErrorKind::Interrupted variant
Browse files Browse the repository at this point in the history
For (better? or) worse the EINTR error is typically treated somewhat
specially by clients. As such, it seems reasonable for us to expose it
properly as opposed to just capturing it as "other".
Introduce the ErrorKind::Interrupted variant to allow for that.

Signed-off-by: Daniel Müller <[email protected]>
  • Loading branch information
d-e-s-o authored and danielocfb committed Dec 5, 2023
1 parent 0026eeb commit 62009f5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions libbpf-rs/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ impl ErrorImpl {
io::ErrorKind::InvalidData => ErrorKind::InvalidData,
io::ErrorKind::TimedOut => ErrorKind::TimedOut,
io::ErrorKind::WriteZero => ErrorKind::WriteZero,
io::ErrorKind::Interrupted => ErrorKind::Interrupted,
io::ErrorKind::Unsupported => ErrorKind::Unsupported,
io::ErrorKind::UnexpectedEof => ErrorKind::UnexpectedEof,
io::ErrorKind::OutOfMemory => ErrorKind::OutOfMemory,
Expand Down Expand Up @@ -242,6 +243,10 @@ pub enum ErrorKind {
/// An error returned when an operation could not be completed
/// because a call to [`write`] returned [`Ok(0)`].
WriteZero,
/// This operation was interrupted.
///
/// Interrupted operations can typically be retried.
Interrupted,
/// This operation is unsupported on this platform.
Unsupported,
/// An error returned when an operation could not be completed
Expand Down

0 comments on commit 62009f5

Please sign in to comment.