Skip to content

Commit

Permalink
kernel: pipe: Issue status changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mintsuki committed Jan 11, 2024
1 parent 91e59ac commit 601fceb
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions kernel/modules/pipe/pipe.v
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ fn (mut this Pipe) read(_handle voidptr, buf voidptr, loc u64, _count u64) ?i64
this.read_ptr = new_ptr_loc
this.used -= count

if this.used == 0 {
this.status &= ~file.pollin
}
if this.used < this.capacity {
this.status |= file.pollout
}
event.trigger(mut this.event, false)

return i64(count)
Expand Down Expand Up @@ -187,6 +193,10 @@ fn (mut this Pipe) write(handle voidptr, buf voidptr, loc u64, _count u64) ?i64
this.write_ptr = new_ptr_loc
this.used += count

if this.used == this.capacity {
this.status &= ~file.pollout
}
this.status |= file.pollin
event.trigger(mut this.event, false)

return i64(count)
Expand Down

0 comments on commit 601fceb

Please sign in to comment.