On Tue, Nov 13, 2012 at 11:31:54AM +0000, Markos Chandras wrote: > From: Markos Chandras <markos.chand...@imgtec.com> > > New architectures don't define ARCH_WANT_IPC_PARSE_VERSION in their kernel. > This means that every cmd passed to semctl,msgctl and shmctl is IPC_64 by > default. We need to prevent uClibc from XOR'ing this flag to the cmd otherwise > it will break the syscalls in the kernel. > > Signed-off-by: Markos Chandras <markos.chand...@imgtec.com> > --- > extra/Configs/Config.in.arch | 9 +++++++++ > libc/misc/sysvipc/ipc.h | 8 ++++++++ > libc/misc/sysvipc/msgq.c | 3 ++- > libc/misc/sysvipc/sem.c | 4 +++- > libc/misc/sysvipc/shm.c | 4 +++- > 5 files changed, 25 insertions(+), 3 deletions(-) > > diff --git a/extra/Configs/Config.in.arch b/extra/Configs/Config.in.arch > index ec541f4..f985472 100644 > --- a/extra/Configs/Config.in.arch > +++ b/extra/Configs/Config.in.arch > @@ -42,6 +42,15 @@ if ARCH_USE_MMU > comment "Using ELF file format" > endif > > +config ARCH_HAS_NO_OLD_IPC > + bool "Disable support for the old IPC interface" > + default n > + help > + New architectures do not define the ARCH_WANT_IPC_PARSE_VERSION > + in their kernel, which means they have no support for the old IPC > + interface. For these architectures, these symbol must be defined > + in order to have functional semctl, shmctl and msgctl system calls > +
Why is this a configure option? It's constant for a given arch... > config UCLIBC_SHARED_FLAT_ID > int "Shared library ID" > default 1 > diff --git a/libc/misc/sysvipc/ipc.h b/libc/misc/sysvipc/ipc.h > index 339d136..9f664f4 100644 > --- a/libc/misc/sysvipc/ipc.h > +++ b/libc/misc/sysvipc/ipc.h > @@ -9,6 +9,14 @@ > # define __IPC_64 0x0 > #endif > > +/* New architectures don't have the OLD_IPC interface */ > +#ifdef __ARCH_HAS_NO_OLD_IPC__ > +#define PROCESS_IPC_CMD(cmd) > +#else > +#define PROCESS_IPC_CMD(cmd) \ > + { int *p = &cmd; *p = (*p) | __IPC_64; } > +#endif > + > #ifdef __NR_ipc > > /* The actual system call: all functions are multiplexed by this. */ > diff --git a/libc/misc/sysvipc/msgq.c b/libc/misc/sysvipc/msgq.c > index 185cd26..0523a10 100644 > --- a/libc/misc/sysvipc/msgq.c > +++ b/libc/misc/sysvipc/msgq.c > @@ -18,7 +18,8 @@ static __inline__ _syscall3(int, __libc_msgctl, int, msqid, > int, cmd, struct msq > int msgctl(int msqid, int cmd, struct msqid_ds *buf) > { > #ifdef __NR_msgctl > - return __libc_msgctl(msqid, cmd | __IPC_64, buf); > + PROCESS_IPC_CMD(cmd) > + return __libc_msgctl(msqid, cmd, buf); Wouldn't it be a lot easier just to define __IPC_64 to 0 on archs that don't use it? Rich _______________________________________________ uClibc mailing list uClibc@uclibc.org http://lists.busybox.net/mailman/listinfo/uclibc