4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
27 * Stubs for basic system services otherwise unavailable to the debugger.
35 #include <kmdb/kmdb_dpi.h>
36 #include <kmdb/kmdb_promif.h>
37 #include <kmdb/kmdb_io.h>
38 #include <mdb/mdb_debug.h>
39 #include <mdb/mdb_signal.h>
40 #include <mdb/mdb_io_impl.h>
45 getenv(const char *name
)
47 /* There aren't any environment variables here */
54 static char errnostr
[16];
56 (void) mdb_snprintf(errnostr
, sizeof (errnostr
), "Error %d", errnum
);
68 * We're trying to isolate ourselves from the rest of the world as much as
69 * possible, so we can't rely on the time in the kernel proper. For now, we
70 * just bump a counter whenever time is requested, thus guaranteeing that
71 * things with timestamps can be compared according to order of occurrance.
76 static hrtime_t kmdb_timestamp
;
78 return (++kmdb_timestamp
);
87 sigemptyset(sigset_t
*set
)
94 sigaddset(sigset_t
*set
, int signo
)
101 sigfillset(sigset_t
*set
)
108 sigprocmask(int how
, const sigset_t
*set
, sigset_t
*oset
)
115 sigaction(int sig
, const struct sigaction
*act
, struct sigaction
*oact
)
122 kill(pid_t pid
, int sig
)
124 if (sig
== SIGABRT
) {
125 mdb_printf("Debugger aborted\n");
134 proc_str2flt(const char *buf
, int *ptr
)
141 proc_str2sig(const char *buf
, int *ptr
)
148 proc_str2sys(const char *buf
, int *ptr
)
157 extern void kmdb_dpi_reboot(void) __NORETURN
;
158 static int recurse
= 0;
164 mdb_iob_printf(mdb
.m_out
, "Press any key to reboot\n");
165 mdb_iob_flush(mdb
.m_out
);
166 mdb_iob_clearlines(mdb
.m_out
);
168 (void) kmdb_getchar();