Re: [PATCH 3/3] generic sys_ipc wrapper

Arnd Bergmann
2010-01-06T19:56:52Z

On Wednesday 06 January 2010 18:21:52 Christoph Hellwig wrote:
>
> Add a generic implementation of the ipc demultiplexer syscall. Except for
> s390 and sparc64 all implementations of the sys_ipc are nearly identical.

Very nice patch, too bad we didn't already do that ages ago ;)

> + switch (version) {
> + default: {
> + ulong raddr;
> + ret = do_shmat(first, (char __user *)ptr,
> + second, &raddr);
> + if (ret)
> + return ret;
> + return put_user(raddr, (ulong __user *) third);
> + }
> +
> +#if defined(__i386__) || defined(__frv__) || defined(__mips__) ||\
> + defined(__mn10300__)
> + case 1:
> + /* iBCS2 emulator entry point */
> + if (!segment_eq(get_fs(), get_ds()))
> + return -EINVAL;
> + /*
> + * The "(ulong *) third" is valid _only_ because of
> + * the kernel segment thing.
> + */
> + return do_shmat(first, (char __user *) ptr, second,
> + (unsigned long *)third);
> +#endif
> +#if defined(__arm__) || defined(__sparc__)
> + case 1:
> + /* Of course, we don't support iBCS2! */
> + return -EINVAL;
> +#endif
> + }

This would not build on any of the architecture mentioned, because of
incorrect placement of curly braces, but as Al mentioned it should just
go away entirely.

> Index: linux-2.6/arch/powerpc/include/asm/syscalls.h
> ===================================================================
> --- linux-2.6.orig/arch/powerpc/include/asm/syscalls.h 2010-01-04 15:44:58.578028035 +0100
> +++ linux-2.6/arch/powerpc/include/asm/syscalls.h 2010-01-04 15:45:57.408253467 +0100
> @@ -35,8 +35,6 @@ asmlinkage long sys_pipe2(int __user *fi
> asmlinkage long sys_rt_sigaction(int sig,
> const struct sigaction __user *act,
> struct sigaction __user *oact, size_t sigsetsize);
> -asmlinkage int sys_ipc(uint call, int first, unsigned long second,
> - long third, void __user *ptr, long fifth);
> asmlinkage long ppc64_personality(unsigned long personality);
> asmlinkage int ppc_rtas(struct rtas_args __user *uargs);
> asmlinkage time_t sys64_time(time_t __user * tloc);

I did not see you add the prototype back into include/linux/syscalls.h,
which is required for building some architectures, including ppc64 with
SPU support.

Arnd