summaryrefslogtreecommitdiff
path: root/ipc.c
diff options
context:
space:
mode:
authorJakub Bogusz <qboosh@pld-linux.org>2009-10-07 22:25:10 +0200
committerDmitry V. Levin <ldv@altlinux.org>2009-10-08 15:13:06 +0000
commit002e985526a6e6451f8cdaca88e34f4777377848 (patch)
treead8dff38fa941a83ce5724cd15835626d823979f /ipc.c
parentc1a5b7e8c42086635d09ce8adc7f8b3dd018c999 (diff)
downloadstrace-002e985526a6e6451f8cdaca88e34f4777377848.tar.gz
Add pretty printing of sembuf argument to semop() and semtimedop()
* ipc.c (semop_flags): New xlat structure. (sys_semop, sys_semtimedop): Add pretty printing of sembuf argument.
Diffstat (limited to 'ipc.c')
-rw-r--r--ipc.c74
1 files changed, 66 insertions, 8 deletions
diff --git a/ipc.c b/ipc.c
index afae0c811..b25c28bdc 100644
--- a/ipc.c
+++ b/ipc.c
@@ -152,6 +152,12 @@ static const struct xlat msg_flags[] = {
{ 0, NULL },
};
+static const struct xlat semop_flags[] = {
+ { SEM_UNDO, "SEM_UNDO" },
+ { IPC_NOWAIT, "IPC_NOWAIT" },
+ { 0, NULL },
+};
+
int sys_msgget(tcp)
struct tcb *tcp;
{
@@ -273,14 +279,40 @@ struct tcb *tcp;
int sys_semop(tcp)
struct tcb *tcp;
{
+ int i;
+
if (entering(tcp)) {
tprintf("%lu", tcp->u_arg[0]);
if (indirect_ipccall(tcp)) {
- tprintf(", %#lx", tcp->u_arg[3]);
- tprintf(", %lu", tcp->u_arg[1]);
+ tprintf(", %#lx {", tcp->u_arg[3]);
+ for(i = 0; i < tcp->u_arg[1]; i++) {
+ struct sembuf sb;
+ if(i != 0)
+ tprintf(", ");
+ if (umove(tcp, tcp->u_arg[3]+i*sizeof(struct sembuf), &sb) < 0)
+ tprintf("{???}");
+ else {
+ tprintf("{%u, %d, ", sb.sem_num, sb.sem_op);
+ printflags(semop_flags, sb.sem_flg, "SEM_???");
+ tprintf("}");
+ }
+ }
+ tprintf("}, %lu", tcp->u_arg[1]);
} else {
- tprintf(", %#lx", tcp->u_arg[1]);
- tprintf(", %lu", tcp->u_arg[2]);
+ tprintf(", %#lx {", tcp->u_arg[1]);
+ for(i = 0; i < tcp->u_arg[2]; i++) {
+ struct sembuf sb;
+ if(i != 0)
+ tprintf(", ");
+ if(umove(tcp, tcp->u_arg[1]+i*sizeof(struct sembuf), &sb) < 0)
+ tprintf("{???}");
+ else {
+ tprintf("{%u, %d, ", sb.sem_num, sb.sem_op);
+ printflags(semop_flags, sb.sem_flg, "SEM_???");
+ tprintf("}");
+ }
+ }
+ tprintf("}, %lu", tcp->u_arg[2]);
}
}
return 0;
@@ -290,15 +322,41 @@ struct tcb *tcp;
int sys_semtimedop(tcp)
struct tcb *tcp;
{
+ int i;
+
if (entering(tcp)) {
tprintf("%lu", tcp->u_arg[0]);
if (indirect_ipccall(tcp)) {
- tprintf(", %#lx", tcp->u_arg[3]);
- tprintf(", %lu, ", tcp->u_arg[1]);
+ tprintf(", %#lx {", tcp->u_arg[3]);
+ for(i = 0; i < tcp->u_arg[1]; i++) {
+ struct sembuf sb;
+ if(i != 0)
+ tprintf(", ");
+ if(umove(tcp, tcp->u_arg[3]+i*sizeof(struct sembuf), &sb) < 0)
+ tprintf("{???}");
+ else {
+ tprintf("{%u, %d, ", sb.sem_num, sb.sem_op);
+ printflags(semop_flags, sb.sem_flg, "SEM_???");
+ tprintf("}");
+ }
+ }
+ tprintf("}, %lu, ", tcp->u_arg[1]);
printtv(tcp, tcp->u_arg[5]);
} else {
- tprintf(", %#lx", tcp->u_arg[1]);
- tprintf(", %lu, ", tcp->u_arg[2]);
+ tprintf(", %#lx {", tcp->u_arg[1]);
+ for(i = 0; i < tcp->u_arg[2]; i++) {
+ struct sembuf sb;
+ if(i != 0)
+ tprintf(", ");
+ if(umove(tcp, tcp->u_arg[1]+i*sizeof(struct sembuf), &sb) < 0)
+ tprintf("{???}");
+ else {
+ tprintf("{%u, %d, ", sb.sem_num, sb.sem_op);
+ printflags(semop_flags, sb.sem_flg, "SEM_???");
+ tprintf("}");
+ }
+ }
+ tprintf("}, %lu, ", tcp->u_arg[2]);
printtv(tcp, tcp->u_arg[3]);
}
}