Changeset View
Changeset View
Standalone View
Standalone View
sys/ddb/db_capture.c
Show All 12 Lines | |||||
KASSERT(db_capture_bufoff <= db_capture_bufsize, | KASSERT(db_capture_bufoff <= db_capture_bufsize, | ||||
("sysctl_debug_ddb_capture_bufsize: bufoff > bufsize")); | ("sysctl_debug_ddb_capture_bufsize: bufoff > bufsize")); | ||||
KASSERT(db_capture_bufsize <= db_capture_maxbufsize, | KASSERT(db_capture_bufsize <= db_capture_maxbufsize, | ||||
("sysctl_debug_ddb_capture_maxbufsize: bufsize > maxbufsize")); | ("sysctl_debug_ddb_capture_maxbufsize: bufsize > maxbufsize")); | ||||
return (0); | return (0); | ||||
} | } | ||||
SYSCTL_PROC(_debug_ddb_capture, OID_AUTO, bufsize, CTLTYPE_UINT|CTLFLAG_RW, | SYSCTL_PROC(_debug_ddb_capture, OID_AUTO, bufsize, | ||||
CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, | |||||
0, 0, sysctl_debug_ddb_capture_bufsize, "IU", | 0, 0, sysctl_debug_ddb_capture_bufsize, "IU", | ||||
"Size of DDB capture buffer"); | "Size of DDB capture buffer"); | ||||
/* | /* | ||||
* Sysctl to read out the capture buffer from userspace. We require | * Sysctl to read out the capture buffer from userspace. We require | ||||
* privilege as sensitive process/memory information may be accessed. | * privilege as sensitive process/memory information may be accessed. | ||||
*/ | */ | ||||
static int | static int | ||||
Show All 9 Lines | |||||
sx_slock(&db_capture_sx); | sx_slock(&db_capture_sx); | ||||
error = SYSCTL_OUT(req, db_capture_buf, db_capture_bufoff); | error = SYSCTL_OUT(req, db_capture_buf, db_capture_bufoff); | ||||
sx_sunlock(&db_capture_sx); | sx_sunlock(&db_capture_sx); | ||||
if (error) | if (error) | ||||
return (error); | return (error); | ||||
ch = '\0'; | ch = '\0'; | ||||
return (SYSCTL_OUT(req, &ch, sizeof(ch))); | return (SYSCTL_OUT(req, &ch, sizeof(ch))); | ||||
} | } | ||||
SYSCTL_PROC(_debug_ddb_capture, OID_AUTO, data, CTLTYPE_STRING | CTLFLAG_RD, | SYSCTL_PROC(_debug_ddb_capture, OID_AUTO, data, | ||||
CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, | |||||
NULL, 0, sysctl_debug_ddb_capture_data, "A", "DDB capture data"); | NULL, 0, sysctl_debug_ddb_capture_data, "A", "DDB capture data"); | ||||
/* | /* | ||||
* Routines for capturing DDB output into a fixed-size buffer. These are | * Routines for capturing DDB output into a fixed-size buffer. These are | ||||
* invoked from DDB's input and output routines. If we hit the limit on the | * invoked from DDB's input and output routines. If we hit the limit on the | ||||
* buffer, we simply drop further data. | * buffer, we simply drop further data. | ||||
*/ | */ | ||||
void | void | ||||
Show All 12 Lines |