Print this page
12364 mdb trips assertion related to autowrap
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/cmd/mdb/common/mdb/mdb_io.h
+++ new/usr/src/cmd/mdb/common/mdb/mdb_io.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
↓ open down ↓ |
13 lines elided |
↑ open up ↑ |
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 23 * Use is subject to license terms.
24 + *
25 + * Copyright 2020 Joyent, Inc.
24 26 */
25 27
26 28 #ifndef _MDB_IO_H
27 29 #define _MDB_IO_H
28 30
29 -#pragma ident "%Z%%M% %I% %E% SMI"
30 -
31 31 #ifdef __cplusplus
32 32 extern "C" {
33 33 #endif
34 34
35 35 #ifdef _MDB
36 36
37 37 #include <sys/types.h>
38 38 #include <setjmp.h>
39 39 #include <stdarg.h>
40 40 #include <stdio.h>
41 41
42 42 typedef struct mdb_iob mdb_iob_t; /* I/O buffer */
43 43 typedef struct mdb_io mdb_io_t; /* I/O implementation */
44 44 struct mdb_arg; /* Argument structure */
45 45
46 46 #define MDB_IOB_DEFTAB 8 /* Default tabstop */
47 47 #define MDB_IOB_DEFMARGIN 16 /* Default margin width */
48 48 #define MDB_IOB_DEFROWS 24 /* Default rows */
49 49 #define MDB_IOB_DEFCOLS 80 /* Default columns */
50 50
51 51 #define MDB_IOB_RDONLY 0x0001 /* Buffer is for reading */
52 52 #define MDB_IOB_WRONLY 0x0002 /* Buffer is for writing */
53 53 #define MDB_IOB_EOF 0x0004 /* Read buffer has reached EOF */
54 54 #define MDB_IOB_ERR 0x0008 /* Underlying i/o error occurred */
55 55 #define MDB_IOB_INDENT 0x0010 /* Lines are auto-indented */
56 56 #define MDB_IOB_PGENABLE 0x0020 /* Pager enabled */
57 57 #define MDB_IOB_PGSINGLE 0x0040 /* Line-at-a-time pager active */
58 58 #define MDB_IOB_PGCONT 0x0080 /* Continue paging until next reset */
59 59 #define MDB_IOB_AUTOWRAP 0x0100 /* Auto-wrap if next chunk won't fit */
60 60 #define MDB_IOB_TTYLIKE 0x0200 /* Input is interactive like a tty */
61 61
62 62 typedef struct mdb_iob_stack {
63 63 mdb_iob_t *stk_top; /* Topmost stack element */
64 64 size_t stk_size; /* Number of stack elements */
65 65 } mdb_iob_stack_t;
66 66
67 67 typedef struct mdb_iob_ctx {
68 68 jmp_buf ctx_rpcb; /* Read-side context label */
69 69 jmp_buf ctx_wpcb; /* Write-side context label */
70 70 void *ctx_rptr; /* Read-side client data */
71 71 void *ctx_wptr; /* Write-side client data */
72 72 void *ctx_data; /* Pointer to client data */
73 73 mdb_iob_t *ctx_iob; /* Storage for iob save/restore */
74 74 } mdb_iob_ctx_t;
75 75
76 76 #define MDB_IOB_RDIOB 0 /* Index for pipe's read-side iob */
77 77 #define MDB_IOB_WRIOB 1 /* Index for pipe's write-side iob */
78 78
79 79 typedef void mdb_iobsvc_f(mdb_iob_t *, mdb_iob_t *, mdb_iob_ctx_t *);
80 80
81 81 #define MDBIOC (('m' << 24) | ('d' << 16) | ('b' << 8))
82 82
83 83 #define MDB_IOC_CTTY (MDBIOC | 0x01) /* Clear child tty settings */
84 84 #define MDB_IOC_TSET (MDBIOC | 0x02) /* Set terminal type */
85 85 #define MDB_IOC_GETFD (MDBIOC | 0x04) /* Get file descriptor (if any) */
86 86
87 87
88 88 typedef void mdb_table_print_f(void *);
89 89
90 90 #define MDB_TBL_DONE 0
91 91 #define MDB_TBL_PRNT 1
92 92 #define MDB_TBL_FUNC 2
93 93
94 94 extern mdb_io_t *mdb_io_hold(mdb_io_t *);
95 95 extern void mdb_io_rele(mdb_io_t *);
96 96 extern void mdb_io_destroy(mdb_io_t *);
97 97
98 98 extern mdb_iob_t *mdb_iob_create(mdb_io_t *, uint_t);
99 99 extern void mdb_iob_pipe(mdb_iob_t **, mdb_iobsvc_f *, mdb_iobsvc_f *);
100 100 extern void mdb_iob_destroy(mdb_iob_t *);
101 101
102 102 extern void mdb_iob_flush(mdb_iob_t *);
103 103 extern void mdb_iob_nlflush(mdb_iob_t *);
104 104 extern void mdb_iob_discard(mdb_iob_t *);
105 105
106 106 extern void mdb_iob_push_io(mdb_iob_t *, mdb_io_t *);
107 107 extern mdb_io_t *mdb_iob_pop_io(mdb_iob_t *);
108 108
109 109 extern void mdb_iob_resize(mdb_iob_t *, size_t, size_t);
110 110 extern void mdb_iob_setpager(mdb_iob_t *, mdb_io_t *);
111 111 extern void mdb_iob_clearlines(mdb_iob_t *);
112 112 extern void mdb_iob_tabstop(mdb_iob_t *, size_t);
113 113 extern void mdb_iob_margin(mdb_iob_t *, size_t);
114 114 extern void mdb_iob_setbuf(mdb_iob_t *, void *, size_t);
115 115
116 116 extern void mdb_iob_setflags(mdb_iob_t *, uint_t);
117 117 extern void mdb_iob_clrflags(mdb_iob_t *, uint_t);
118 118 extern uint_t mdb_iob_getflags(mdb_iob_t *);
119 119
120 120 extern void mdb_iob_vprintf(mdb_iob_t *, const char *, va_list);
121 121 extern void mdb_iob_aprintf(mdb_iob_t *, const char *, const struct mdb_arg *);
122 122 extern void mdb_iob_printf(mdb_iob_t *, const char *, ...);
123 123
124 124 extern size_t mdb_iob_vsnprintf(char *, size_t, const char *, va_list);
125 125 extern size_t mdb_iob_asnprintf(char *, size_t, const char *,
126 126 const struct mdb_arg *);
127 127 extern size_t mdb_iob_snprintf(char *, size_t, const char *, ...);
128 128
129 129 extern void mdb_iob_nputs(mdb_iob_t *, const char *, size_t);
130 130 extern void mdb_iob_puts(mdb_iob_t *, const char *);
131 131 extern void mdb_iob_putc(mdb_iob_t *, int);
132 132
133 133 extern void mdb_iob_fill(mdb_iob_t *, int, size_t);
134 134 extern void mdb_iob_ws(mdb_iob_t *, size_t);
135 135 extern void mdb_iob_tab(mdb_iob_t *);
136 136 extern void mdb_iob_nl(mdb_iob_t *);
137 137
138 138 extern ssize_t mdb_iob_ngets(mdb_iob_t *, char *, size_t);
139 139 extern int mdb_iob_getc(mdb_iob_t *);
140 140 extern int mdb_iob_ungetc(mdb_iob_t *, int);
141 141 extern int mdb_iob_eof(mdb_iob_t *);
↓ open down ↓ |
101 lines elided |
↑ open up ↑ |
142 142 extern int mdb_iob_err(mdb_iob_t *);
143 143
144 144 extern ssize_t mdb_iob_read(mdb_iob_t *, void *, size_t);
145 145 extern ssize_t mdb_iob_write(mdb_iob_t *, const void *, size_t);
146 146 extern int mdb_iob_ctl(mdb_iob_t *, int, void *);
147 147 extern const char *mdb_iob_name(mdb_iob_t *);
148 148 extern size_t mdb_iob_lineno(mdb_iob_t *);
149 149 extern size_t mdb_iob_gettabstop(mdb_iob_t *);
150 150 extern size_t mdb_iob_getmargin(mdb_iob_t *);
151 151
152 +extern void mdb_iob_set_autowrap(mdb_iob_t *);
153 +
152 154 extern void mdb_iob_stack_create(mdb_iob_stack_t *);
153 155 extern void mdb_iob_stack_destroy(mdb_iob_stack_t *);
154 156 extern void mdb_iob_stack_push(mdb_iob_stack_t *, mdb_iob_t *, size_t);
155 157 extern mdb_iob_t *mdb_iob_stack_pop(mdb_iob_stack_t *);
156 158 extern size_t mdb_iob_stack_size(mdb_iob_stack_t *);
157 159
158 160 extern const char *mdb_iob_format2str(const char *);
159 161
160 162 /*
161 163 * Available i/o backend constructors for common MDB code. These are
162 164 * implemented in the corresponding .c files.
163 165 */
164 166 extern mdb_io_t *mdb_logio_create(mdb_io_t *);
165 167 extern mdb_io_t *mdb_fdio_create_path(const char **, const char *, int, mode_t);
166 168 extern mdb_io_t *mdb_fdio_create_named(int fd, const char *);
167 169 extern mdb_io_t *mdb_fdio_create(int);
168 170 extern mdb_io_t *mdb_strio_create(const char *);
169 171 extern mdb_io_t *mdb_termio_create(const char *, mdb_io_t *, mdb_io_t *);
170 172 extern mdb_io_t *mdb_pipeio_create(mdb_iobsvc_f *, mdb_iobsvc_f *);
171 173 extern mdb_io_t *mdb_nullio_create(void);
172 174 extern mdb_io_t *mdb_memio_create(char *, size_t);
173 175
174 176 /*
175 177 * Functions for testing whether the given iob is of a given backend type:
176 178 */
177 179 extern int mdb_iob_isastr(mdb_iob_t *);
178 180 extern int mdb_iob_isatty(mdb_iob_t *);
179 181 extern int mdb_iob_isapipe(mdb_iob_t *);
180 182
181 183 extern void mdb_table_print(uint_t, const char *, ...);
182 184
183 185 extern int mdb_setupterm(const char *, mdb_io_t *, int *);
184 186
185 187 extern int mdb_fdio_fileno(mdb_io_t *);
186 188
187 189 #endif /* _MDB */
188 190
189 191 #ifdef __cplusplus
190 192 }
191 193 #endif
192 194
193 195 #endif /* _MDB_IO_H */
↓ open down ↓ |
32 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX