summaryrefslogtreecommitdiffstats
path: root/sys-utils/ipcutils.c
diff options
context:
space:
mode:
authorSami Kerola2012-11-11 23:31:21 +0100
committerKarel Zak2012-11-23 14:58:22 +0100
commit2bd2f79dde4298347c0f252603e5a1d06791f9bf (patch)
tree63e2fbfa6a033d085590c82d588e51b4863b1e90 /sys-utils/ipcutils.c
parentipcs: clean up do_msg(), and add ipc_msg_get_info() (diff)
downloadkernel-qcow2-util-linux-2bd2f79dde4298347c0f252603e5a1d06791f9bf.tar.gz
kernel-qcow2-util-linux-2bd2f79dde4298347c0f252603e5a1d06791f9bf.tar.xz
kernel-qcow2-util-linux-2bd2f79dde4298347c0f252603e5a1d06791f9bf.zip
ipcs: make individual message queue id printing to use /proc
[kzak@redhat.com: - fix msgctl() call, move q_qbytes to ipc_msg_get_info] Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils/ipcutils.c')
-rw-r--r--sys-utils/ipcutils.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sys-utils/ipcutils.c b/sys-utils/ipcutils.c
index 772863c54..7d1f0d1ef 100644
--- a/sys-utils/ipcutils.c
+++ b/sys-utils/ipcutils.c
@@ -362,6 +362,7 @@ int ipc_msg_get_info(int id, struct msg_data **msgds)
int i, maxid;
struct msg_data *p;
struct msqid_ds dummy;
+ struct msqid_ds msgseg;
p = *msgds = xcalloc(1, sizeof(struct msg_data));
p->next = NULL;
@@ -394,6 +395,12 @@ int ipc_msg_get_info(int id, struct msg_data **msgds)
if (id > -1) {
/* ID specified */
if (id == p->msg_perm.id) {
+ /*
+ * FIXME: q_qbytes are not in /proc
+ *
+ */
+ if (msgctl(id, IPC_STAT, &msgseg) != -1)
+ p->q_qbytes = msgseg.msg_qbytes;
i = 1;
break;
} else
@@ -421,10 +428,9 @@ int ipc_msg_get_info(int id, struct msg_data **msgds)
while (i <= maxid) {
int msgid;
- struct msqid_ds msgseg;
struct ipc_perm *ipcp = &msgseg.msg_perm;
- msgid = msgctl(id, MSG_STAT, &msgseg);
+ msgid = msgctl(i, MSG_STAT, &msgseg);
if (msgid < 0) {
if (-1 < id) {
free(*msgds);
@@ -448,6 +454,7 @@ int ipc_msg_get_info(int id, struct msg_data **msgds)
p->q_stime = msgseg.msg_stime;
p->q_rtime = msgseg.msg_rtime;
p->q_ctime = msgseg.msg_ctime;
+ p->q_qbytes = msgseg.msg_qbytes;
if (id < 0) {
p->next = xcalloc(1, sizeof(struct msg_data));