Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ just run webserver

To run Fix-on-Arca, run:
```sh
just fix addblob.fix
just fix eval addblob.fix
```

# License
Expand Down
2 changes: 1 addition & 1 deletion common/src/buddy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ impl BuddyAllocatorImpl {
pub fn set_caching(&self, enable: bool) -> bool {
if cfg!(feature = "cache") {
self.caching
.fetch_update(Ordering::SeqCst, Ordering::SeqCst, |_| Some(enable))
.try_update(Ordering::SeqCst, Ordering::SeqCst, |_| Some(enable))
.unwrap_or_else(|x| x)
} else {
false
Expand Down
19 changes: 11 additions & 8 deletions common/src/pipe/uni.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,17 +133,20 @@ pub struct Reader {
impl Reader {
pub fn read(&mut self, data: &mut [u8]) -> Result<usize> {
unsafe {
// Drain any buffered bytes before reporting the writer's hangup, so a
// reader still sees data the writer sent immediately before closing
// (e.g. a Close-ack the peer wrote just before dropping its end).
if self.ring.as_ref().unwrap().can_read() {
let bytes = self.ring.as_ref().unwrap().readable_bytes();
let len = core::cmp::min(data.len(), bytes.len());
data[..len].copy_from_slice(&(&(*bytes))[..len]);
self.ring.as_mut().unwrap().read(len);
return Ok(len);
}
if self.is_closed() {
return Err(Error::Closed);
}
if !self.ring.as_ref().unwrap().can_read() {
return Err(Error::WouldBlock);
}
let bytes = self.ring.as_ref().unwrap().readable_bytes();
let len = core::cmp::min(data.len(), bytes.len());
data[..len].copy_from_slice(&(&(*bytes))[..len]);
self.ring.as_mut().unwrap().read(len);
Ok(len)
Err(Error::WouldBlock)
}
}

Expand Down
4 changes: 2 additions & 2 deletions common/src/util/concurrent_trie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl<T> SyncBox<T> {
unsafe {
Some(Box::from_raw(
self.ptr
.fetch_update(Ordering::SeqCst, Ordering::SeqCst, |old| {
.try_update(Ordering::SeqCst, Ordering::SeqCst, |old| {
if old.is_null() {
None
} else {
Expand All @@ -54,7 +54,7 @@ impl<T> SyncBox<T> {
let ptr = Box::into_raw(value);
unsafe {
self.ptr
.fetch_update(Ordering::SeqCst, Ordering::SeqCst, |old| {
.try_update(Ordering::SeqCst, Ordering::SeqCst, |old| {
if old.is_null() {
Some(ptr)
} else {
Expand Down
3 changes: 3 additions & 0 deletions vmm/src/comm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ pub fn file_thread(mut file: File, mut pipe: FilePipe) {
Response::Offset(offset)
}
Request::Close => {
pipe.send(&Response::Ack);
return;
}
};
Expand All @@ -120,6 +121,7 @@ pub fn listener_thread(listener: TcpListener, mut pipe: ListenerPipe) {
Response::Pipe(decompose_pipe(p))
}
Request::Close => {
pipe.send(&Response::Ack);
return;
}
};
Expand All @@ -142,6 +144,7 @@ pub fn stream_thread(mut stream: TcpStream, mut pipe: StreamPipe) {
Response::Length(len)
}
Request::Close => {
pipe.send(&Response::Ack);
return;
}
};
Expand Down
Loading