1 // SPDX-License-Identifier: GPL-2.0
4 * Copyright IBM Corp. 1999, 2000
5 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
6 * Thomas Spatzier (tspat@de.ibm.com)
8 * Derived from "arch/i386/kernel/sys_i386.c"
10 * This file contains various random system calls that
11 * have a non-standard calling sequence on the Linux/s390
15 #include <linux/errno.h>
16 #include <linux/sched.h>
19 #include <linux/smp.h>
20 #include <linux/sem.h>
21 #include <linux/msg.h>
22 #include <linux/shm.h>
23 #include <linux/stat.h>
24 #include <linux/syscalls.h>
25 #include <linux/mman.h>
26 #include <linux/file.h>
27 #include <linux/utsname.h>
28 #include <linux/personality.h>
29 #include <linux/unistd.h>
30 #include <linux/ipc.h>
31 #include <linux/uaccess.h>
35 * Perform the mmap() system call. Linux for S/390 isn't able to handle more
36 * than 5 system call parameters, so this system call uses a memory block
37 * for parameter passing.
40 struct s390_mmap_arg_struct
{
49 SYSCALL_DEFINE1(mmap2
, struct s390_mmap_arg_struct __user
*, arg
)
51 struct s390_mmap_arg_struct a
;
54 if (copy_from_user(&a
, arg
, sizeof(a
)))
56 error
= ksys_mmap_pgoff(a
.addr
, a
.len
, a
.prot
, a
.flags
, a
.fd
, a
.offset
);
63 * sys_ipc() is the de-multiplexer for the SysV IPC calls.
65 SYSCALL_DEFINE5(s390_ipc
, uint
, call
, int, first
, unsigned long, second
,
66 unsigned long, third
, void __user
*, ptr
)
70 /* The s390 sys_ipc variant has only five parameters instead of six
71 * like the generic variant. The only difference is the handling of
72 * the SEMTIMEDOP subcall where on s390 the third parameter is used
73 * as a pointer to a struct timespec where the generic variant uses
74 * the fifth parameter.
75 * Therefore we can call the generic variant by simply passing the
76 * third parameter also as fifth parameter.
78 return ksys_ipc(call
, first
, second
, third
, ptr
, third
);
80 #endif /* CONFIG_SYSVIPC */
82 SYSCALL_DEFINE1(s390_personality
, unsigned int, personality
)
84 unsigned int ret
= current
->personality
;
86 if (personality(current
->personality
) == PER_LINUX32
&&
87 personality(personality
) == PER_LINUX
)
88 personality
|= PER_LINUX32
;
90 if (personality
!= 0xffffffff)
91 set_personality(personality
);
93 if (personality(ret
) == PER_LINUX32
)
99 SYSCALL_DEFINE0(ni_syscall
)