Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/ddb Introduce db_alloc.h.
details: https://anonhg.NetBSD.org/src/rev/a04ed0ed65d1
branches: trunk
changeset: 933904:a04ed0ed65d1
user: rin <rin%NetBSD.org@localhost>
date: Sun May 31 09:40:09 2020 +0000
description:
Introduce db_alloc.h.
Provide db_alloc() and friends to userland, i.e., crash(8).
diffstat:
sys/ddb/db_alloc.h | 42 ++++++++++++++++++++++++++++++++++++++++++
sys/ddb/db_command.h | 6 +-----
sys/ddb/ddb.h | 3 ++-
3 files changed, 45 insertions(+), 6 deletions(-)
diffs (82 lines):
diff -r 307b11f84df3 -r a04ed0ed65d1 sys/ddb/db_alloc.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/ddb/db_alloc.h Sun May 31 09:40:09 2020 +0000
@@ -0,0 +1,42 @@
+/* $NetBSD: db_alloc.h,v 1.1 2020/05/31 09:40:09 rin Exp $ */
+
+/*-
+ * Copyright (c) 2020 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _DDB_ALLOC_
+#define _DDB_ALLOC_
+
+#ifdef _KERNEL
+void *db_alloc(size_t);
+void *db_zalloc(size_t);
+void db_free(void *, size_t);
+#else
+#define db_alloc(sz) malloc(size)
+#define db_zalloc(sz) calloc(1, (size))
+#define db_free(p, sz) free(p)
+#endif
+
+#endif /* _DDB_ALLOC_ */
diff -r 307b11f84df3 -r a04ed0ed65d1 sys/ddb/db_command.h
--- a/sys/ddb/db_command.h Sun May 31 09:00:25 2020 +0000
+++ b/sys/ddb/db_command.h Sun May 31 09:40:09 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_command.h,v 1.36 2020/03/10 15:58:37 christos Exp $ */
+/* $NetBSD: db_command.h,v 1.37 2020/05/31 09:40:09 rin Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 1999, 2002 The NetBSD Foundation, Inc.
@@ -144,10 +144,6 @@
#endif
};
-void *db_alloc(size_t);
-void *db_zalloc(size_t);
-void db_free(void *, size_t);
-
#ifndef _KERNEL
#define db_kernelonly() \
db_printf("%s: can only be used in-kernel.\n", __func__)
diff -r 307b11f84df3 -r a04ed0ed65d1 sys/ddb/ddb.h
--- a/sys/ddb/ddb.h Sun May 31 09:00:25 2020 +0000
+++ b/sys/ddb/ddb.h Sun May 31 09:40:09 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ddb.h,v 1.3 2018/03/04 07:14:50 mlelstv Exp $ */
+/* $NetBSD: ddb.h,v 1.4 2020/05/31 09:40:09 rin Exp $ */
/*-
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -50,5 +50,6 @@
#include <ddb/db_proc.h>
#include <ddb/db_cpu.h>
#include <ddb/db_autoconf.h>
+#include <ddb/db_alloc.h>
#endif /* _DDB_DDB_H_ */
Home |
Main Index |
Thread Index |
Old Index