| 1194 | #endif |
| 1195 | |
| 1196 | int |
| 1197 | sys_munlockall(struct thread *td, struct munlockall_args *uap) |
| 1198 | { |
| 1199 | vm_map_t map; |
| 1200 | int error; |
| 1201 | |
| 1202 | map = &td->td_proc->p_vmspace->vm_map; |
| 1203 | error = priv_check(td, PRIV_VM_MUNLOCK); |
| 1204 | if (error) |
| 1205 | return (error); |
| 1206 | |
| 1207 | /* Clear the MAP_WIREFUTURE flag from this vm_map. */ |
| 1208 | vm_map_lock(map); |
| 1209 | vm_map_modflags(map, 0, MAP_WIREFUTURE); |
| 1210 | vm_map_unlock(map); |
| 1211 | |
| 1212 | /* Forcibly unwire all pages. */ |
| 1213 | error = vm_map_unwire(map, vm_map_min(map), vm_map_max(map), |
| 1214 | VM_MAP_WIRE_USER|VM_MAP_WIRE_HOLESOK); |
| 1215 | #ifdef RACCT |
| 1216 | if (racct_enable && error == KERN_SUCCESS) { |
| 1217 | PROC_LOCK(td->td_proc); |
| 1218 | racct_set(td->td_proc, RACCT_MEMLOCK, 0); |
| 1219 | PROC_UNLOCK(td->td_proc); |
| 1220 | } |
| 1221 | #endif |
| 1222 | |
| 1223 | return (error); |
| 1224 | } |
| 1225 | |
| 1226 | #ifndef _SYS_SYSPROTO_H_ |
| 1227 | struct munlock_args { |
nothing calls this directly
no test coverage detected