@@ -71,24 +71,27 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
|
71 | 71 | throw_unsup_format!("Miri does not support file-backed memory mappings"); |
72 | 72 | } |
73 | 73 | |
74 | | -// POSIX says: |
75 | | -// [ENOTSUP] |
76 | | -// * MAP_FIXED or MAP_PRIVATE was specified in the flags argument and the implementation |
77 | | -// does not support this functionality. |
78 | | -// * The implementation does not support the combination of accesses requested in the |
79 | | -// prot argument. |
80 | | -// |
81 | | -// Miri doesn't support MAP_FIXED or any any protections other than PROT_READ|PROT_WRITE. |
82 | | -if flags & map_fixed != 0 || prot != prot_read | prot_write { |
83 | | - this.set_last_error(this.eval_libc("ENOTSUP"))?; |
84 | | -return Ok(this.eval_libc("MAP_FAILED")); |
| 74 | +// Miri doesn't support MAP_FIXED. |
| 75 | +if flags & map_fixed != 0 { |
| 76 | +throw_unsup_format!( |
| 77 | +"Miri does not support calls to mmap with MAP_FIXED as part of the flags argument", |
| 78 | +); |
| 79 | +} |
| 80 | + |
| 81 | +// Miri doesn't support protections other than PROT_READ|PROT_WRITE. |
| 82 | +if prot != prot_read | prot_write { |
| 83 | +throw_unsup_format!( |
| 84 | +"Miri does not support calls to mmap with protections other than \ |
| 85 | + PROT_READ|PROT_WRITE", |
| 86 | +); |
85 | 87 | } |
86 | 88 | |
87 | 89 | // Miri does not support shared mappings, or any of the other extensions that for example |
88 | 90 | // Linux has added to the flags arguments. |
89 | 91 | if flags != map_private | map_anonymous { |
90 | 92 | throw_unsup_format!( |
91 | | -"Miri only supports calls to mmap which set the flags argument to MAP_PRIVATE|MAP_ANONYMOUS" |
| 93 | +"Miri only supports calls to mmap which set the flags argument to \ |
| 94 | + MAP_PRIVATE|MAP_ANONYMOUS", |
92 | 95 | ); |
93 | 96 | } |
94 | 97 | |
|