-
Notifications
You must be signed in to change notification settings - Fork 390
Closed
Labels
A-shimsArea: This affects the external function shimsArea: This affects the external function shimsA-unixArea: affects our shared Unix target supportArea: affects our shared Unix target supportC-cleanupCategory: cleaning up our codeCategory: cleaning up our codeE-good-first-issueA good way to start contributing, mentoring is availableA good way to start contributing, mentoring is available
Description
Unix shims return -1
and set the thread-local "last error" variable to indicate an error occurred. With #3923 and #3929, Miri has some nice helpers to help with that, but they are not being used everywhere yet. So this is about refactoring the existing code to use the new helpers.
To help, start by grepping for -1
and for this.eval_libc("E
in the src/shims/unix
folder. You will find a few patterns:
let efault = this.eval_libc("EFAULT");
this.set_last_error(efault)?;
this.write_int(-1, dest)?;
should become this.set_last_error_and_return(LibcError("EFAULT"), dest)?;
.
this.set_last_error(ErrorKind::PermissionDenied)?;
return Ok(Scalar::from_i32(-1));
should become return this.set_last_error_and_return_i32(ErrorKind::PermissionDenied);
.
Feel free to ask if you encounter other patterns you are unsure about. It's also okay for the first PR to only cover parts of this and leave the harder cases for a second round.
saethlin
Metadata
Metadata
Assignees
Labels
A-shimsArea: This affects the external function shimsArea: This affects the external function shimsA-unixArea: affects our shared Unix target supportArea: affects our shared Unix target supportC-cleanupCategory: cleaning up our codeCategory: cleaning up our codeE-good-first-issueA good way to start contributing, mentoring is availableA good way to start contributing, mentoring is available