Extract the code to translate VM error into errno, into an exported

function vm_mmap_to_errno(). It is useful for the drivers that implement
mmap(2)-like functionality, to be able to return error codes consistent
with mmap(2).

Sponsored by:	The FreeBSD Foundation
No objections from:	alc
MFC after:	1 week
This commit is contained in:
Konstantin Belousov 2011-07-10 20:49:13 +00:00
parent 3103730c82
commit 2e32165ce0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=223914
2 changed files with 8 additions and 0 deletions

View File

@ -72,6 +72,7 @@ int vm_fault_wire(vm_map_t, vm_offset_t, vm_offset_t, boolean_t);
int vm_forkproc(struct thread *, struct proc *, struct thread *, struct vmspace *, int);
void vm_waitproc(struct proc *);
int vm_mmap(vm_map_t, vm_offset_t *, vm_size_t, vm_prot_t, vm_prot_t, int, objtype_t, void *, vm_ooffset_t);
int vm_mmap_to_errno(int rv);
void vm_set_page_size(void);
void vm_sync_icache(vm_map_t, vm_offset_t, vm_size_t);
struct vmspace *vmspace_alloc(vm_offset_t, vm_offset_t);

View File

@ -1535,6 +1535,13 @@ vm_mmap(vm_map_t map, vm_offset_t *addr, vm_size_t size, vm_prot_t prot,
vm_map_wire(map, *addr, *addr + size,
VM_MAP_WIRE_USER|VM_MAP_WIRE_NOHOLES);
return (vm_mmap_to_errno(rv));
}
int
vm_mmap_to_errno(int rv)
{
switch (rv) {
case KERN_SUCCESS:
return (0);