[kernel] Allow passing 0 to vma_resize to query the current size
Passing a size of 0 in to vma_resize will now not attempt to alter the VMA size, but will still put the size into the passed-in pointer. Using this allows querying the size of a VMA without changing it.
This commit is contained in:
@@ -32,6 +32,6 @@ object vma : object {
|
|||||||
}
|
}
|
||||||
|
|
||||||
method resize [cap:resize] {
|
method resize [cap:resize] {
|
||||||
param size size [inout]
|
param size size [inout] # New size for the VMA, or 0 to query the current size without changing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ enum class vm_flags : uint32_t
|
|||||||
#define VM_FLAG(name, v) name = v,
|
#define VM_FLAG(name, v) name = v,
|
||||||
#include <j6/tables/vm_flags.inc>
|
#include <j6/tables/vm_flags.inc>
|
||||||
#undef VM_FLAG
|
#undef VM_FLAG
|
||||||
driver_mask = 0x000fffff, ///< flags allowed via syscall for drivers
|
driver_mask = 0x00ff'ffff, ///< flags allowed via syscall for drivers
|
||||||
user_mask = 0x0000ffff, ///< flags allowed via syscall for non-drivers
|
user_mask = 0x000f'ffff, ///< flags allowed via syscall for non-drivers
|
||||||
};
|
};
|
||||||
is_bitfield(vm_flags);
|
is_bitfield(vm_flags);
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,11 @@ vma_unmap(vm_area *self, process *proc)
|
|||||||
j6_status_t
|
j6_status_t
|
||||||
vma_resize(vm_area *self, size_t *size)
|
vma_resize(vm_area *self, size_t *size)
|
||||||
{
|
{
|
||||||
|
if (!*size) {
|
||||||
|
*size = self->size();
|
||||||
|
} else {
|
||||||
*size = self->resize(*size);
|
*size = self->resize(*size);
|
||||||
|
}
|
||||||
return j6_status_ok;
|
return j6_status_ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user