Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- char* GetStateOfQueue(int queue_id) {
- struct msqid_ds state = GetCurrentState(queue_id);
- struct ipc_perm perm = state.msg_perm;
- char* result = (char*) malloc(sizeof(char) * MSG_SIZE);
- int pos = 0;
- pos += AddToLineString(&result, pos, "ipc_perm:\n");
- pos += AddToLineString(&result, pos, " key = ");
- pos += AddToLineInt(&result, pos, perm.__key);
- pos += AddToLineString(&result, pos, "\n");
- pos += AddToLineString(&result, pos, " uid = ");
- pos += AddToLineInt(&result, pos, perm.uid);
- pos += AddToLineString(&result, pos, "\n");
- pos += AddToLineString(&result, pos, " gid = ");
- pos += AddToLineInt(&result, pos, perm.gid);
- pos += AddToLineString(&result, pos, "\n");
- pos += AddToLineString(&result, pos, " cuid = ");
- pos += AddToLineInt(&result, pos, perm.cuid);
- pos += AddToLineString(&result, pos, "\n");
- pos += AddToLineString(&result, pos, " cgid = ");
- pos += AddToLineInt(&result, pos, perm.cgid);
- pos += AddToLineString(&result, pos, "\n");
- pos += AddToLineString(&result, pos, " mode = ");
- pos += AddToLineInt(&result, pos, perm.mode);
- pos += AddToLineString(&result, pos, "\n");
- pos += AddToLineString(&result, pos, " seq = ");
- pos += AddToLineInt(&result, pos, perm.__seq);
- pos += AddToLineString(&result, pos, "\n");
- pos += AddToLineString(&result, pos, "\n");
- pos += AddToLineString(&result, pos, "msg_qnum = ");
- pos += AddToLineInt(&result, pos, state.msg_qnum);
- pos += AddToLineString(&result, pos, "\n");
- pos += AddToLineString(&result, pos, "msg_qbytes = ");
- pos += AddToLineInt(&result, pos, state.msg_qbytes);
- pos += AddToLineString(&result, pos, "\n");
- pos += AddToLineString(&result, pos, "msg_lspid = ");
- pos += AddToLineInt(&result, pos, state.msg_lspid);
- pos += AddToLineString(&result, pos, "\n");
- pos += AddToLineString(&result, pos, "msg_lrpid = ");
- pos += AddToLineInt(&result, pos, state.msg_lrpid);
- pos += AddToLineString(&result, pos, "\n");
- pos += AddToLineString(&result, pos, "msg_msg_stime = ");
- pos += AddToLineInt(&result, pos, state.msg_stime);
- pos += AddToLineString(&result, pos, "\n");
- pos += AddToLineString(&result, pos, "msg_rtime = ");
- pos += AddToLineInt(&result, pos, state.msg_rtime);
- pos += AddToLineString(&result, pos, "\n");
- pos += AddToLineString(&result, pos, "msg_ctime = ");
- pos += AddToLineInt(&result, pos, state.msg_ctime);
- pos += AddToLineString(&result, pos, "\n");
- pos += AddToLineString(&result, pos, "\0");
- return result;
- }
Add Comment
Please, Sign In to add comment