summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2015-09-04 02:55:10 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2015-09-04 02:55:10 +0000
commitf9d2816e89126e3eed53e66635fa41b8b1c74efa (patch)
tree82e6c99c5eba172d612427938685b7a28b2f5bca /lib
parente3827b55a955b816bfed2934d55416ea854356d0 (diff)
add kvm_realloc() as a private function.
part of a larger diff ok millert@ guenther@
Diffstat (limited to 'lib')
-rw-r--r--lib/libkvm/kvm.c10
-rw-r--r--lib/libkvm/kvm_private.h3
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/libkvm/kvm.c b/lib/libkvm/kvm.c
index ee97c433b16..a261ce4ff82 100644
--- a/lib/libkvm/kvm.c
+++ b/lib/libkvm/kvm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kvm.c,v 1.55 2015/05/11 00:42:54 guenther Exp $ */
+/* $OpenBSD: kvm.c,v 1.56 2015/09/04 02:55:09 dlg Exp $ */
/* $NetBSD: kvm.c,v 1.43 1996/05/05 04:31:59 gwr Exp $ */
/*-
@@ -163,6 +163,14 @@ _kvm_malloc(kvm_t *kd, size_t n)
return (p);
}
+void *
+_kvm_realloc(kvm_t *kd, void *p, size_t n)
+{
+ if ((p = realloc(p, n)) == NULL)
+ _kvm_err(kd, kd->program, "%s", strerror(errno));
+ return (p);
+}
+
static kvm_t *
_kvm_open(kvm_t *kd, const char *uf, const char *mf, const char *sf,
int flag, char *errout)
diff --git a/lib/libkvm/kvm_private.h b/lib/libkvm/kvm_private.h
index e11501aaf7b..b42634ba969 100644
--- a/lib/libkvm/kvm_private.h
+++ b/lib/libkvm/kvm_private.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: kvm_private.h,v 1.23 2014/10/15 02:03:05 deraadt Exp $ */
+/* $OpenBSD: kvm_private.h,v 1.24 2015/09/04 02:55:09 dlg Exp $ */
/* $NetBSD: kvm_private.h,v 1.7 1996/05/05 04:32:15 gwr Exp $ */
/*-
@@ -98,6 +98,7 @@ void _kvm_freevtop(kvm_t *);
int _kvm_initvtop(kvm_t *);
int _kvm_kvatop(kvm_t *, u_long, paddr_t *);
void *_kvm_malloc(kvm_t *kd, size_t);
+void *_kvm_realloc(kvm_t *kd, void *, size_t);
off_t _kvm_pa2off(kvm_t *, paddr_t);
void *_kvm_reallocarray(kvm_t *kd, void *, size_t, size_t);
void _kvm_syserr(kvm_t *kd, const char *program, const char *fmt, ...)