Deleted Added
full compact
db_textdump.c (256281) db_textdump.c (273265)
1/*-
2 * Copyright (c) 2007 Robert N. M. Watson
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 43 unchanged lines hidden (view full) ---

52 * TODO
53 * ----
54 *
55 * - Allow subsytems to register to submit files for inclusion in the text
56 * dump in a generic way.
57 */
58
59#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2007 Robert N. M. Watson
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 43 unchanged lines hidden (view full) ---

52 * TODO
53 * ----
54 *
55 * - Allow subsytems to register to submit files for inclusion in the text
56 * dump in a generic way.
57 */
58
59#include <sys/cdefs.h>
60__FBSDID("$FreeBSD: stable/10/sys/ddb/db_textdump.c 242424 2012-11-01 04:07:08Z alfred $");
60__FBSDID("$FreeBSD: stable/10/sys/ddb/db_textdump.c 273265 2014-10-18 19:22:59Z pfg $");
61
62#include "opt_config.h"
63
64#include "opt_ddb.h"
65
66#include <sys/param.h>
67#include <sys/conf.h>
68#include <sys/kernel.h>

--- 274 unchanged lines hidden (view full) ---

343
344 /*
345 * Copy out the data in small chunks, but don't copy nuls that may be
346 * present if the message buffer has not yet completely filled at
347 * least once.
348 */
349 total_len = 0;
350 offset = 0;
61
62#include "opt_config.h"
63
64#include "opt_ddb.h"
65
66#include <sys/param.h>
67#include <sys/conf.h>
68#include <sys/kernel.h>

--- 274 unchanged lines hidden (view full) ---

343
344 /*
345 * Copy out the data in small chunks, but don't copy nuls that may be
346 * present if the message buffer has not yet completely filled at
347 * least once.
348 */
349 total_len = 0;
350 offset = 0;
351 msgbuf_peekbytes(msgbufp, NULL, 0, &seq);
352 while ((len = msgbuf_peekbytes(msgbufp, buf, sizeof(buf), &seq)) > 0) {
351 msgbuf_peekbytes(msgbufp, NULL, 0, &seq);
352 while ((len = msgbuf_peekbytes(msgbufp, buf, sizeof(buf), &seq)) > 0) {
353 for (i = 0; i < len; i++) {
354 if (buf[i] == '\0')
355 continue;
356 textdump_block_buffer[offset] = buf[i];
357 offset++;
358 if (offset != sizeof(textdump_block_buffer))
359 continue;
360 (void)textdump_writenextblock(di,
361 textdump_block_buffer);
362 total_len += offset;
363 offset = 0;
364 }
353 for (i = 0; i < len; i++) {
354 if (buf[i] == '\0')
355 continue;
356 textdump_block_buffer[offset] = buf[i];
357 offset++;
358 if (offset != sizeof(textdump_block_buffer))
359 continue;
360 (void)textdump_writenextblock(di,
361 textdump_block_buffer);
362 total_len += offset;
363 offset = 0;
364 }
365 }
365 }
366 total_len += offset; /* Without the zero-padding. */
367 if (offset != 0) {
368 bzero(textdump_block_buffer + offset,
369 sizeof(textdump_block_buffer) - offset);
370 (void)textdump_writenextblock(di, textdump_block_buffer);
371 }
372
373 /*

--- 177 unchanged lines hidden ---
366 total_len += offset; /* Without the zero-padding. */
367 if (offset != 0) {
368 bzero(textdump_block_buffer + offset,
369 sizeof(textdump_block_buffer) - offset);
370 (void)textdump_writenextblock(di, textdump_block_buffer);
371 }
372
373 /*

--- 177 unchanged lines hidden ---