3 *
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.
7 *
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.
12 *
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]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 /*
27 * Stubs for basic system services otherwise unavailable to the debugger.
28 */
29
30 #include <stdlib.h>
31 #include <unistd.h>
32 #include <libproc.h>
33 #include <sys/time.h>
34
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>
41 #include <mdb/mdb.h>
42
47 /* There aren't any environment variables here */
48 return (NULL);
49 }
50
51 char *
52 strerror(int errnum)
53 {
54 static char errnostr[16];
55
56 (void) mdb_snprintf(errnostr, sizeof (errnostr), "Error %d", errnum);
57
58 return (errnostr);
59 }
60
61 pid_t
62 getpid(void)
63 {
64 return (1);
65 }
66
67 /*
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.
72 */
73 hrtime_t
74 gethrtime(void)
75 {
76 static hrtime_t kmdb_timestamp;
77
78 return (++kmdb_timestamp);
79 }
80
81 /*
82 * Signal handling
83 */
84
85 /*ARGSUSED*/
86 int
|
3 *
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.
7 *
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.
12 *
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]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
23 * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 /*
28 * Stubs for basic system services otherwise unavailable to the debugger.
29 */
30
31 #include <stdlib.h>
32 #include <unistd.h>
33 #include <libproc.h>
34 #include <sys/time.h>
35
36 #include <kmdb/kmdb_dpi.h>
37 #include <kmdb/kmdb_promif.h>
38 #include <kmdb/kmdb_io.h>
39 #include <mdb/mdb_debug.h>
40 #include <mdb/mdb_signal.h>
41 #include <mdb/mdb_io_impl.h>
42 #include <mdb/mdb.h>
43
48 /* There aren't any environment variables here */
49 return (NULL);
50 }
51
52 char *
53 strerror(int errnum)
54 {
55 static char errnostr[16];
56
57 (void) mdb_snprintf(errnostr, sizeof (errnostr), "Error %d", errnum);
58
59 return (errnostr);
60 }
61
62 pid_t
63 getpid(void)
64 {
65 return (1);
66 }
67
68 void
69 __assert(const char *statement, const char *file, int line)
70 {
71 (void) mdb_printf("ASSERT at %s, File: %s, Line: %d\n",
72 statement ? statement : "<empty>",
73 file ? file : "<empty>", line);
74 exit(1);
75 }
76
77 /*
78 * We're trying to isolate ourselves from the rest of the world as much as
79 * possible, so we can't rely on the time in the kernel proper. For now, we
80 * just bump a counter whenever time is requested, thus guaranteeing that
81 * things with timestamps can be compared according to order of occurrance.
82 */
83 hrtime_t
84 gethrtime(void)
85 {
86 static hrtime_t kmdb_timestamp;
87
88 return (++kmdb_timestamp);
89 }
90
91 /*
92 * Signal handling
93 */
94
95 /*ARGSUSED*/
96 int
|