MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sysctl_debug_ddb_scripting_script

Function sysctl_debug_ddb_scripting_script

freebsd/ddb/db_script.c:504–536  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

502 "List of defined scripts");
503
504static int
505sysctl_debug_ddb_scripting_script(SYSCTL_HANDLER_ARGS)
506{
507 char *buffer, *script, *scriptname;
508 int error, len;
509
510 /*
511 * Maximum length for an input string is DB_MAXSCRIPTNAME + '='
512 * symbol + DB_MAXSCRIPT.
513 */
514 len = DB_MAXSCRIPTNAME + DB_MAXSCRIPTLEN + 1;
515 buffer = malloc(len, M_TEMP, M_WAITOK | M_ZERO);
516 error = sysctl_handle_string(oidp, buffer, len, req);
517 if (error)
518 goto out;
519
520 /*
521 * Argument will be in form scriptname=script, so split into the
522 * scriptname and script.
523 */
524 script = buffer;
525 scriptname = strsep(&script, "=");
526 if (script == NULL) {
527 error = EINVAL;
528 goto out;
529 }
530 mtx_lock(&db_script_mtx);
531 error = db_script_set(scriptname, script);
532 mtx_unlock(&db_script_mtx);
533out:
534 free(buffer, M_TEMP);
535 return (error);
536}
537SYSCTL_PROC(_debug_ddb_scripting, OID_AUTO, script,
538 CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE, 0, 0,
539 sysctl_debug_ddb_scripting_script, "A",

Callers

nothing calls this directly

Calls 7

mallocFunction · 0.85
sysctl_handle_stringFunction · 0.85
strsepFunction · 0.85
db_script_setFunction · 0.85
mtx_lockFunction · 0.50
mtx_unlockFunction · 0.50
freeFunction · 0.50

Tested by

no test coverage detected