2007-01-11 Dmitry V. Levin <ldv@altlinux.org>
Fix open(2) flags parser.
* defs.h (tprint_open_modes): New function.
* desc.c (sprint_open_modes): New function.
(sys_fcntl): Use tprint_open_modes() and sprint_open_modes().
* file.c (openmodes): Split xlat into open_access_modes and
open_mode_flags.
(tprint_open_modes): New function.
(decode_open): Use it.
* ipc.c (sys_mq_open, printmqattr): Likewise.
Fixes RH#222385.
diff --git a/ipc.c b/ipc.c
index 365fae2..548d2e1 100644
--- a/ipc.c
+++ b/ipc.c
@@ -67,7 +67,6 @@
# define IPC_64 0x100
#endif
-extern const struct xlat openmodes[];
extern void printsigevent(struct tcb *tcp, long arg);
static const struct xlat msgctl_flags[] = {
@@ -414,14 +413,14 @@
#endif /* defined(LINUX) || defined(SUNOS4) || defined(FREEBSD) */
#ifdef LINUX
-int sys_mq_open(tcp)
-struct tcb *tcp;
+int
+sys_mq_open(struct tcb *tcp)
{
if (entering(tcp)) {
printpath(tcp, tcp->u_arg[0]);
tprintf(", ");
/* flags */
- printflags(openmodes, tcp->u_arg[1] + 1, "O_???");
+ tprint_open_modes(tcp, tcp->u_arg[1]);
if (tcp->u_arg[1] & O_CREAT) {
# ifndef HAVE_MQUEUE_H
tprintf(", %lx", tcp->u_arg[2]);
@@ -440,8 +439,8 @@
return 0;
}
-int sys_mq_timedsend(tcp)
-struct tcb *tcp;
+int
+sys_mq_timedsend(struct tcb *tcp)
{
if (entering(tcp)) {
tprintf("%ld, ", tcp->u_arg[0]);
@@ -452,8 +451,8 @@
return 0;
}
-int sys_mq_timedreceive(tcp)
-struct tcb *tcp;
+int
+sys_mq_timedreceive(struct tcb *tcp)
{
if (entering(tcp))
tprintf("%ld, ", tcp->u_arg[0]);
@@ -465,8 +464,8 @@
return 0;
}
-int sys_mq_notify(tcp)
-struct tcb *tcp;
+int
+sys_mq_notify(struct tcb *tcp)
{
if (entering(tcp)) {
tprintf("%ld, ", tcp->u_arg[0]);
@@ -475,9 +474,8 @@
return 0;
}
-static void printmqattr(tcp, addr)
-struct tcb *tcp;
-long addr;
+static void
+printmqattr(struct tcb *tcp, long addr)
{
if (addr == 0)
tprintf("NULL");
@@ -491,15 +489,15 @@
return;
}
tprintf("{mq_flags=");
- printflags(openmodes, attr.mq_flags + 1, "O_???");
+ tprint_open_modes(tcp, attr.mq_flags);
tprintf(", mq_maxmsg=%ld, mq_msgsize=%ld, mq_curmsg=%ld}",
attr.mq_maxmsg, attr.mq_msgsize, attr.mq_curmsgs);
# endif
}
}
-int sys_mq_getsetattr(tcp)
-struct tcb *tcp;
+int
+sys_mq_getsetattr(struct tcb *tcp)
{
if (entering(tcp)) {
tprintf("%ld, ", tcp->u_arg[0]);