Skip to content

Commit fb11930

Browse files
committed
further tweak FileDescription comments
1 parent d29be1f commit fb11930

File tree

1 file changed

+12
-17
lines changed
  • src/tools/miri/src/shims/unix

1 file changed

+12
-17
lines changed

src/tools/miri/src/shims/unix/fd.rs

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,9 @@ pub(crate) enum FlockOp {
2525
pub trait FileDescription: std::fmt::Debug + Any {
2626
fn name(&self) -> &'static str;
2727

28-
/// Reads as much as possible into the given buffer, and returns the number of bytes read.
29-
/// `ptr` is the pointer to the user supplied read buffer.
30-
/// `len` indicates how many bytes the user requested.
31-
/// `dest` is where the return value should be stored.
28+
/// Reads as much as possible into the given buffer `ptr`.
29+
/// `len` indicates how many bytes we should try to read.
30+
/// `dest` is where the return value should be stored: number of bytes read, or `-1` in case of error.
3231
fn read<'tcx>(
3332
&self,
3433
_self_ref: &FileDescriptionRef,
@@ -41,10 +40,9 @@ pub trait FileDescription: std::fmt::Debug + Any {
4140
throw_unsup_format!("cannot read from {}", self.name());
4241
}
4342

44-
/// Writes as much as possible from the given buffer, and returns the number of bytes written.
45-
/// `ptr` is the pointer to the user supplied read buffer.
46-
/// `len` indicates how many bytes the user requested.
47-
/// `dest` is where the return value should be stored.
43+
/// Writes as much as possible from the given buffer `ptr`.
44+
/// `len` indicates how many bytes we should try to write.
45+
/// `dest` is where the return value should be stored: number of bytes written, or `-1` in case of error.
4846
fn write<'tcx>(
4947
&self,
5048
_self_ref: &FileDescriptionRef,
@@ -57,11 +55,9 @@ pub trait FileDescription: std::fmt::Debug + Any {
5755
throw_unsup_format!("cannot write to {}", self.name());
5856
}
5957

60-
/// Reads as much as possible into the given buffer from a given offset,
61-
/// and returns the number of bytes read.
62-
/// `ptr` is the pointer to the user supplied read buffer.
63-
/// `len` indicates how many bytes the user requested.
64-
/// `dest` is where the return value should be stored.
58+
/// Reads as much as possible into the given buffer `ptr` from a given offset.
59+
/// `len` indicates how many bytes we should try to read.
60+
/// `dest` is where the return value should be stored: number of bytes read, or `-1` in case of error.
6561
fn pread<'tcx>(
6662
&self,
6763
_communicate_allowed: bool,
@@ -74,11 +70,10 @@ pub trait FileDescription: std::fmt::Debug + Any {
7470
throw_unsup_format!("cannot pread from {}", self.name());
7571
}
7672

77-
/// Writes as much as possible from the given buffer starting at a given offset,
78-
/// and returns the number of bytes written.
73+
/// Writes as much as possible from the given buffer `ptr` starting at a given offset.
7974
/// `ptr` is the pointer to the user supplied read buffer.
80-
/// `len` indicates how many bytes the user requested.
81-
/// `dest` is where the return value should be stored.
75+
/// `len` indicates how many bytes we should try to write.
76+
/// `dest` is where the return value should be stored: number of bytes written, or `-1` in case of error.
8277
fn pwrite<'tcx>(
8378
&self,
8479
_communicate_allowed: bool,

0 commit comments

Comments
 (0)