int dump_ipc_ns(int ns_id) { int ret; struct cr_imgset *imgset; imgset = cr_imgset_open(ns_id, IPCNS, O_DUMP); if (imgset == NULL) return -1; ret = dump_ipc_data(imgset); if (ret < 0) { pr_err("Failed to write IPC namespace data\n"); goto err; } err: close_cr_imgset(&imgset); return ret < 0 ? -1 : 0; }
int dump_ipc_ns(int ns_pid, int ns_id) { int ret; struct cr_fdset *fdset; fdset = cr_fdset_open(ns_id, IPCNS, O_DUMP); if (fdset == NULL) return -1; ret = switch_ns(ns_pid, &ipc_ns_desc, NULL); if (ret < 0) goto err; ret = dump_ipc_data(fdset); if (ret < 0) { pr_err("Failed to write IPC namespace data\n"); goto err; } err: close_cr_fdset(&fdset); return ret < 0 ? -1 : 0; }