(head: *const RobustListHead)
| 125 | } |
| 126 | |
| 127 | pub fn exit_robust_list(head: *const RobustListHead) -> AxResult<()> { |
| 128 | // Reference: https://elixir.bootlin.com/linux/v6.13.6/source/kernel/futex/core.c#L777 |
| 129 | |
| 130 | let mut limit = ROBUST_LIST_LIMIT; |
| 131 | |
| 132 | let end_ptr = unsafe { &raw const (*head).list }; |
| 133 | let head = head.vm_read()?; |
| 134 | let mut entry = head.list.next; |
| 135 | let offset = head.futex_offset; |
| 136 | let pending = head.list_op_pending; |
| 137 | |
| 138 | while !core::ptr::eq(entry, end_ptr) { |
| 139 | let next_entry = entry.vm_read()?.next; |
| 140 | if entry != pending { |
| 141 | handle_futex_death(entry, offset)?; |
| 142 | } |
| 143 | entry = next_entry; |
| 144 | |
| 145 | limit -= 1; |
| 146 | if limit == 0 { |
| 147 | return Err(AxError::FilesystemLoop); |
| 148 | } |
| 149 | axtask::yield_now(); |
| 150 | } |
| 151 | |
| 152 | Ok(()) |
| 153 | } |
| 154 | |
| 155 | pub fn do_exit(exit_code: i32, group_exit: bool) { |
| 156 | let curr = current(); |
no test coverage detected