]> granicus.if.org Git - strace/blobdiff - ipc.c
mips n32: fix preadv/pwritev offset decoding
[strace] / ipc.c
diff --git a/ipc.c b/ipc.c
index 0b91a526ad9a05e039bb666b56acf6bc73bc5add..4387772a3b223f60da14306a8db966ed3d461bb5 100644 (file)
--- a/ipc.c
+++ b/ipc.c
 
 extern void printsigevent(struct tcb *tcp, long arg);
 
-static const struct xlat msgctl_flags[] = {
-       { IPC_RMID,     "IPC_RMID"      },
-       { IPC_SET,      "IPC_SET"       },
-       { IPC_STAT,     "IPC_STAT"      },
-       { IPC_INFO,     "IPC_INFO"      },
-       { MSG_STAT,     "MSG_STAT"      },
-       { MSG_INFO,     "MSG_INFO"      },
-       { 0,            NULL            },
-};
-
-static const struct xlat semctl_flags[] = {
-       { IPC_RMID,     "IPC_RMID"      },
-       { IPC_SET,      "IPC_SET"       },
-       { IPC_STAT,     "IPC_STAT"      },
-       { IPC_INFO,     "IPC_INFO"      },
-       { SEM_STAT,     "SEM_STAT"      },
-       { SEM_INFO,     "SEM_INFO"      },
-       { GETPID,       "GETPID"        },
-       { GETVAL,       "GETVAL"        },
-       { GETALL,       "GETALL"        },
-       { GETNCNT,      "GETNCNT"       },
-       { GETZCNT,      "GETZCNT"       },
-       { SETVAL,       "SETVAL"        },
-       { SETALL,       "SETALL"        },
-       { 0,            NULL            },
-};
-
-static const struct xlat shmctl_flags[] = {
-       { IPC_RMID,     "IPC_RMID"      },
-       { IPC_SET,      "IPC_SET"       },
-       { IPC_STAT,     "IPC_STAT"      },
-       { IPC_INFO,     "IPC_INFO"      },
-       { SHM_STAT,     "SHM_STAT"      },
-       { SHM_INFO,     "SHM_INFO"      },
-#ifdef SHM_LOCK
-       { SHM_LOCK,     "SHM_LOCK"      },
-#endif
-#ifdef SHM_UNLOCK
-       { SHM_UNLOCK,   "SHM_UNLOCK"    },
-#endif
-       { 0,            NULL            },
-};
-
-static const struct xlat resource_flags[] = {
-       { IPC_CREAT,    "IPC_CREAT"     },
-       { IPC_EXCL,     "IPC_EXCL"      },
-       { IPC_NOWAIT,   "IPC_NOWAIT"    },
-       { 0,            NULL            },
-};
-
-static const struct xlat shm_resource_flags[] = {
-       { IPC_CREAT,    "IPC_CREAT"     },
-       { IPC_EXCL,     "IPC_EXCL"      },
-#ifdef SHM_HUGETLB
-       { SHM_HUGETLB,  "SHM_HUGETLB"   },
-#endif
-       { 0,            NULL            },
-};
-
-static const struct xlat shm_flags[] = {
-       { SHM_REMAP,    "SHM_REMAP"     },
-       { SHM_RDONLY,   "SHM_RDONLY"    },
-       { SHM_RND,      "SHM_RND"       },
-       { 0,            NULL            },
-};
-
-static const struct xlat msg_flags[] = {
-       { MSG_NOERROR,  "MSG_NOERROR"   },
-       { MSG_EXCEPT,   "MSG_EXCEPT"    },
-       { IPC_NOWAIT,   "IPC_NOWAIT"    },
-       { 0,            NULL            },
-};
-
-static const struct xlat semop_flags[] = {
-       { SEM_UNDO,     "SEM_UNDO"      },
-       { IPC_NOWAIT,   "IPC_NOWAIT"    },
-       { 0,            NULL            },
-};
+#include "xlat/msgctl_flags.h"
+#include "xlat/semctl_flags.h"
+#include "xlat/shmctl_flags.h"
+#include "xlat/resource_flags.h"
+#include "xlat/shm_resource_flags.h"
+#include "xlat/shm_flags.h"
+#include "xlat/ipc_msg_flags.h"
+#include "xlat/semop_flags.h"
 
 int sys_msgget(struct tcb *tcp)
 {
@@ -167,16 +97,7 @@ int sys_msgget(struct tcb *tcp)
 static int
 indirect_ipccall(struct tcb *tcp)
 {
-#ifdef X86_64
-       return current_personality == 1;
-#endif
-#if defined IA64
-       return tcp->scno < 1024; /* ia32 emulation syscalls are low */
-#endif
-#if defined(ALPHA) || defined(MIPS) || defined(HPPA) || defined(__ARM_EABI__) || defined(AARCH64)
-       return 0;
-#endif
-       return 1;
+       return tcp->s_ent->sys_flags & TRACE_INDIRECT_SUBCALL;
 }
 
 int sys_msgctl(struct tcb *tcp)
@@ -203,7 +124,7 @@ tprint_msgsnd(struct tcb *tcp, long addr, unsigned long count,
                tprints("}");
        }
        tprintf(", %lu, ", count);
-       printflags(msg_flags, flags, "MSG_???");
+       printflags(ipc_msg_flags, flags, "MSG_???");
 }
 
 int sys_msgsnd(struct tcb *tcp)
@@ -254,11 +175,11 @@ int sys_msgrcv(struct tcb *tcp)
                                tprint_msgrcv(tcp, (long) tmp.msgp,
                                        tcp->u_arg[1], tmp.msgtyp);
                        }
-                       printflags(msg_flags, tcp->u_arg[2], "MSG_???");
+                       printflags(ipc_msg_flags, tcp->u_arg[2], "MSG_???");
                } else {
                        tprint_msgrcv(tcp, tcp->u_arg[1],
                                tcp->u_arg[2], tcp->u_arg[3]);
-                       printflags(msg_flags, tcp->u_arg[4], "MSG_???");
+                       printflags(ipc_msg_flags, tcp->u_arg[4], "MSG_???");
                }
        }
        return 0;