Replace <asm/uaccess.h> with <linux/uaccess.h> globally
[linux-block.git] / arch / s390 / kernel / sys_s390.c
CommitLineData
1da177e4 1/*
1da177e4 2 * S390 version
a53c8fab 3 * Copyright IBM Corp. 1999, 2000
1da177e4
LT
4 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
5 * Thomas Spatzier (tspat@de.ibm.com)
6 *
7 * Derived from "arch/i386/kernel/sys_i386.c"
8 *
9 * This file contains various random system calls that
10 * have a non-standard calling sequence on the Linux/s390
11 * platform.
12 */
13
14#include <linux/errno.h>
15#include <linux/sched.h>
16#include <linux/mm.h>
4e950f6f 17#include <linux/fs.h>
1da177e4 18#include <linux/smp.h>
1da177e4
LT
19#include <linux/sem.h>
20#include <linux/msg.h>
21#include <linux/shm.h>
22#include <linux/stat.h>
23#include <linux/syscalls.h>
24#include <linux/mman.h>
25#include <linux/file.h>
26#include <linux/utsname.h>
1da177e4 27#include <linux/personality.h>
fe74290d 28#include <linux/unistd.h>
cba4fbbf 29#include <linux/ipc.h>
7c0f6ba6 30#include <linux/uaccess.h>
a806170e 31#include "entry.h"
1da177e4 32
1da177e4 33/*
a4679373
CH
34 * Perform the mmap() system call. Linux for S/390 isn't able to handle more
35 * than 5 system call parameters, so this system call uses a memory block
36 * for parameter passing.
1da177e4
LT
37 */
38
a4679373 39struct s390_mmap_arg_struct {
1da177e4
LT
40 unsigned long addr;
41 unsigned long len;
42 unsigned long prot;
43 unsigned long flags;
44 unsigned long fd;
45 unsigned long offset;
46};
47
a4679373 48SYSCALL_DEFINE1(mmap2, struct s390_mmap_arg_struct __user *, arg)
1da177e4 49{
a4679373 50 struct s390_mmap_arg_struct a;
1da177e4
LT
51 int error = -EFAULT;
52
53 if (copy_from_user(&a, arg, sizeof(a)))
54 goto out;
f8b72560 55 error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset);
1da177e4
LT
56out:
57 return error;
58}
59
1da177e4 60/*
3a3954ce 61 * sys_ipc() is the de-multiplexer for the SysV IPC calls.
1da177e4 62 */
baed7fc9 63SYSCALL_DEFINE5(s390_ipc, uint, call, int, first, unsigned long, second,
26689452 64 unsigned long, third, void __user *, ptr)
1da177e4 65{
3a3954ce
HC
66 if (call >> 16)
67 return -EINVAL;
68 /* The s390 sys_ipc variant has only five parameters instead of six
69 * like the generic variant. The only difference is the handling of
70 * the SEMTIMEDOP subcall where on s390 the third parameter is used
71 * as a pointer to a struct timespec where the generic variant uses
72 * the fifth parameter.
73 * Therefore we can call the generic variant by simply passing the
74 * third parameter also as fifth parameter.
75 */
76 return sys_ipc(call, first, second, third, ptr, third);
1da177e4
LT
77}
78
3a110370 79SYSCALL_DEFINE1(s390_personality, unsigned int, personality)
1da177e4 80{
3a110370 81 unsigned int ret;
1da177e4 82
5ab37e1b
JK
83 if (personality(current->personality) == PER_LINUX32 &&
84 personality(personality) == PER_LINUX)
85 personality |= PER_LINUX32;
1da177e4 86 ret = sys_personality(personality);
5ab37e1b
JK
87 if (personality(ret) == PER_LINUX32)
88 ret &= ~PER_LINUX32;
1da177e4
LT
89
90 return ret;
91}