| 115 | } |
| 116 | |
| 117 | static int |
| 118 | write_buffer(struct dumperinfo *di, char *ptr, size_t sz) |
| 119 | { |
| 120 | size_t len; |
| 121 | int error, c; |
| 122 | u_int maxdumpsz; |
| 123 | |
| 124 | maxdumpsz = di->maxiosize; |
| 125 | |
| 126 | if (maxdumpsz == 0) /* seatbelt */ |
| 127 | maxdumpsz = PAGE_SIZE; |
| 128 | |
| 129 | error = 0; |
| 130 | |
| 131 | while (sz) { |
| 132 | len = min(maxdumpsz, sz); |
| 133 | counter += len; |
| 134 | progress -= len; |
| 135 | |
| 136 | if (counter >> 22) { |
| 137 | report_progress(progress, dumpsize); |
| 138 | counter &= (1<<22) - 1; |
| 139 | } |
| 140 | |
| 141 | wdog_kern_pat(WD_LASTVAL); |
| 142 | |
| 143 | if (ptr) { |
| 144 | error = dump_append(di, ptr, 0, len); |
| 145 | if (error) |
| 146 | return (error); |
| 147 | ptr += len; |
| 148 | sz -= len; |
| 149 | } else { |
| 150 | panic("pa is not supported"); |
| 151 | } |
| 152 | |
| 153 | /* Check for user abort. */ |
| 154 | c = cncheckc(); |
| 155 | if (c == 0x03) |
| 156 | return (ECANCELED); |
| 157 | if (c != -1) |
| 158 | printf(" (CTRL-C to abort) "); |
| 159 | } |
| 160 | |
| 161 | return (0); |
| 162 | } |
| 163 | |
| 164 | int |
| 165 | minidumpsys(struct dumperinfo *di) |
no test coverage detected