Module Name: src
Committed By: rin
Date: Sun May 31 09:40:09 UTC 2020
Modified Files:
src/sys/ddb: db_command.h ddb.h
Added Files:
src/sys/ddb: db_alloc.h
Log Message:
Introduce db_alloc.h.
Provide db_alloc() and friends to userland, i.e., crash(8).
To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/ddb/db_alloc.h
cvs rdiff -u -r1.36 -r1.37 src/sys/ddb/db_command.h
cvs rdiff -u -r1.3 -r1.4 src/sys/ddb/ddb.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/ddb/db_command.h
diff -u src/sys/ddb/db_command.h:1.36 src/sys/ddb/db_command.h:1.37
--- src/sys/ddb/db_command.h:1.36 Tue Mar 10 15:58:37 2020
+++ src/sys/ddb/db_command.h Sun May 31 09:40:09 2020
@@ -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 @@ struct db_command {
#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__)
Index: src/sys/ddb/ddb.h
diff -u src/sys/ddb/ddb.h:1.3 src/sys/ddb/ddb.h:1.4
--- src/sys/ddb/ddb.h:1.3 Sun Mar 4 07:14:50 2018
+++ src/sys/ddb/ddb.h Sun May 31 09:40:09 2020
@@ -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_ */
Added files:
Index: src/sys/ddb/db_alloc.h
diff -u /dev/null src/sys/ddb/db_alloc.h:1.1
--- /dev/null Sun May 31 09:40:10 2020
+++ src/sys/ddb/db_alloc.h Sun May 31 09:40:09 2020
@@ -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_ */