diff options
-rw-r--r-- | lib/libkvm/kvm.c | 6 | ||||
-rw-r--r-- | lib/libkvm/kvm_getprocs.3 | 1 | ||||
-rw-r--r-- | lib/libkvm/kvm_open.3 | 25 |
3 files changed, 27 insertions, 5 deletions
diff --git a/lib/libkvm/kvm.c b/lib/libkvm/kvm.c index 0de0dd6..2f95a20 100644 --- a/lib/libkvm/kvm.c +++ b/lib/libkvm/kvm.c @@ -534,6 +534,10 @@ kvm_close(kvm_t *kd) { int error = 0; + if (kd == NULL) { + errno = EINVAL; + return (-1); + } if (kd->vmst != NULL) kd->arch->ka_freevtop(kd); if (kd->pmfd >= 0) @@ -552,7 +556,7 @@ kvm_close(kvm_t *kd) free((void *)kd->argv); free((void *)kd); - return (0); + return (error); } /* diff --git a/lib/libkvm/kvm_getprocs.3 b/lib/libkvm/kvm_getprocs.3 index 013da08..eb2af98 100644 --- a/lib/libkvm/kvm_getprocs.3 +++ b/lib/libkvm/kvm_getprocs.3 @@ -47,7 +47,6 @@ .In sys/param.h .In sys/sysctl.h .In sys/user.h -.\" .Fa kvm_t *kd .Ft struct kinfo_proc * .Fn kvm_getprocs "kvm_t *kd" "int op" "int arg" "int *cnt" .Ft char ** diff --git a/lib/libkvm/kvm_open.3 b/lib/libkvm/kvm_open.3 index 6942239..b573488 100644 --- a/lib/libkvm/kvm_open.3 +++ b/lib/libkvm/kvm_open.3 @@ -32,7 +32,7 @@ .\" @(#)kvm_open.3 8.3 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd November 27, 2015 +.Dd March 20, 2017 .Dt KVM_OPEN 3 .Os .Sh NAME @@ -196,7 +196,7 @@ function is called, specifies the requested symbol name. If the function is able to resolve the name to an address, the address should be set in -.Fa *addr +.Fa addr and the function should return zero. If the function is not able to resolve the name to an address, it should return a non-zero value. @@ -227,10 +227,29 @@ and write the error message into .Fa errbuf . .Pp +.Rv -std kvm_close +.Sh ERRORS The .Fn kvm_close -function returns 0 on success and -1 on failure. +function may fail and set the global variable +.Va errno +for any of the errors specified for +.Xr close 2 . +.Pp +The +.Fn kvm_close +function may also fail and set +.Va errno +if: +.Bl -tag -width Er +.It Bq Er EINVAL +The value passed via +.Fa kd +was +.Dv NULL . +.El .Sh SEE ALSO +.Xr close 2 , .Xr open 2 , .Xr kvm 3 , .Xr kvm_getargv 3 , |