File tree Expand file tree Collapse file tree
crates/fspy_shm/src/macos Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -74,10 +74,9 @@ pub fn create(size: usize) -> io::Result<Shm> {
7474pub fn open ( id : & str ) -> io:: Result < Shm > {
7575 // `rustix::shm::open` sets `FD_CLOEXEC` on the returned descriptor.
7676 let fd = shm:: open ( id, OFlags :: RDWR , Mode :: empty ( ) ) . map_err ( io:: Error :: from) ?;
77- // Another process that opens this object for writing can resize it. If it
78- // shrinks the object after `fstat`, `mmap` rejects the requested size and
79- // `open` returns an error. Fspy sets the size before sharing `id` and never
80- // changes it afterward.
77+ // If another process shrinks the object before `mmap`, `mmap` returns an
78+ // error. If it resizes the object after `mmap`, `open` does not access the
79+ // mapped pages. A concurrent resize cannot make `open` access invalid memory.
8180 let stat = fstat ( & fd) ?;
8281 let size = usize:: try_from ( stat. st_size )
8382 . map_err ( |_| io:: Error :: new ( io:: ErrorKind :: InvalidData , "invalid shared-memory size" ) ) ?;
You can’t perform that action at this time.
0 commit comments