]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Use a single, consistent approach to returning success versus failure in
authorAlan Cox <alc@FreeBSD.org>
Mon, 4 Jun 2018 16:28:06 +0000 (16:28 +0000)
committerAlan Cox <alc@FreeBSD.org>
Mon, 4 Jun 2018 16:28:06 +0000 (16:28 +0000)
commit3e7cb27cdd192f93b4b0ada4f114d80cea37afcb
tree6d4c7d54daefd21bc26238a16b8ee8448eecf5d9
parenta8db1fa14dc3cefb6777999b5f67f79e1e3f16e6
Use a single, consistent approach to returning success versus failure in
vm_map_madvise().  Previously, vm_map_madvise() used a traditional Unix-
style "return (0);" to indicate success in the common case, but Mach-
style return values in the edge cases.  Since KERN_SUCCESS equals zero,
the only problem with this inconsistency was stylistic.  vm_map_madvise()
has exactly two callers in the entire source tree, and only one of them
cares about the return value.  That caller, kern_madvise(), can be
simplified if vm_map_madvise() consistently uses Unix-style return
values.

Since vm_map_madvise() uses the variable modify_map as a Boolean, make it
one.

Eliminate a redundant error check from kern_madvise().  Add a comment
explaining where the check is performed.

Explicitly note that exec_release_args_kva() doesn't care about
vm_map_madvise()'s return value.  Since MADV_FREE is passed as the
behavior, the return value will always be zero.

Reviewed by: kib, markj
MFC after: 7 days
sys/kern/kern_exec.c
sys/vm/vm_map.c
sys/vm/vm_mmap.c