Resolve confusion between different error code spaces.

The vm_map_fixed() and vm_map_stack() VM functions return Mach error
codes.  Convert them into errno values before returning result from
exec_new_vmspace().

While there, modernize the comment and do minor style adjustments.

Reviewed by:	alc
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
This commit is contained in:
Konstantin Belousov 2017-07-03 20:44:01 +00:00
parent 2f0f20717d
commit 467b3975a3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=320619

View File

@ -1054,9 +1054,9 @@ exec_unmap_first_page(struct image_params *imgp)
}
/*
* Destroy old address space, and allocate a new stack
* The new stack is only SGROWSIZ large because it is grown
* automatically in trap.c.
* Destroy old address space, and allocate a new stack.
* The new stack is only sgrowsiz large because it is grown
* automatically on a page fault.
*/
int
exec_new_vmspace(struct image_params *imgp, struct sysentvec *sv)
@ -1112,9 +1112,9 @@ exec_new_vmspace(struct image_params *imgp, struct sysentvec *sv)
VM_PROT_READ | VM_PROT_EXECUTE,
VM_PROT_READ | VM_PROT_EXECUTE,
MAP_INHERIT_SHARE | MAP_ACC_NO_CHARGE);
if (error) {
if (error != KERN_SUCCESS) {
vm_object_deallocate(obj);
return (error);
return (vm_mmap_to_errno(error));
}
}
@ -1138,10 +1138,9 @@ exec_new_vmspace(struct image_params *imgp, struct sysentvec *sv)
stack_addr = sv->sv_usrstack - ssiz;
error = vm_map_stack(map, stack_addr, (vm_size_t)ssiz,
obj != NULL && imgp->stack_prot != 0 ? imgp->stack_prot :
sv->sv_stackprot,
VM_PROT_ALL, MAP_STACK_GROWS_DOWN);
if (error)
return (error);
sv->sv_stackprot, VM_PROT_ALL, MAP_STACK_GROWS_DOWN);
if (error != KERN_SUCCESS)
return (vm_mmap_to_errno(error));
/*
* vm_ssize and vm_maxsaddr are somewhat antiquated concepts, but they