static int og_knode_diag_dump(void *opt, void *pa, void *pb) { kbuf_s kb; kbuf_init(&kb, 4096); knode_foreach(do_dump, (void*)&kb, NULL); kopt_set_cur_str(opt, kb.buf); kbuf_release(&kb); return EC_OK; }
static void rpc_watch(int ses, void *opt, void *wch) { void *ua = kopt_wch_ua(wch); char *ini; kbuf_s kb; char *path = kopt_path(opt); klog("path:%s\n", path); if (kopt_getini_by_opt(opt, &ini)) return; kbuf_init(&kb, 4096); kbuf_addf(&kb, "wchnotify %s\r\n%s", path, ini); if (send_watch_message((rpc_client_s*)ua, kb.buf)) close_client((rpc_client_s*)ua); kmem_free(ini); kbuf_release(&kb); }