* [PATCH 15/40] compat: convert fs compat to use COMPAT_SYSCALL_DEFINE#N() macros
[not found] <1277287401-28571-1-git-send-email-imunsie@au1.ibm.com>
@ 2010-06-23 10:02 ` Ian Munsie
2010-06-23 10:03 ` [PATCH 31/40] trace syscalls: Convert various generic compat syscalls Ian Munsie
` (2 subsequent siblings)
3 siblings, 0 replies; 16+ messages in thread
From: Ian Munsie @ 2010-06-23 10:02 UTC (permalink / raw)
To: linux-kernel, linuxppc-dev
Cc: Jason Baron, Frederic Weisbecker, Steven Rostedt, Ingo Molnar,
Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
Ian Munsie, Alexander Viro, Andrew Morton, Jeff Moyer,
David Howells, Oleg Nesterov, linux-fsdevel
From: Jason Baron <jbaron@redhat.com>
convert the fs/compat.c file to use the COMPAT_SYSCALL_DEFINE#N() macros to tie
them into the generic compat layer.
Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Ian Munsie <imunsie@au1.ibm.com>
---
fs/compat.c | 147 +++++++++++++++++++++++++++++------------------------------
1 files changed, 72 insertions(+), 75 deletions(-)
diff --git a/fs/compat.c b/fs/compat.c
index 6490d21..df0b502 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -76,7 +76,7 @@ int compat_printk(const char *fmt, ...)
* Not all architectures have sys_utime, so implement this in terms
* of sys_utimes.
*/
-asmlinkage long compat_sys_utime(char __user *filename, struct compat_utimbuf __user *t)
+COMPAT_SYSCALL_DEFINE2(utime, char __user *, filename, struct compat_utimbuf __user *, t)
{
struct timespec tv[2];
@@ -90,7 +90,7 @@ asmlinkage long compat_sys_utime(char __user *filename, struct compat_utimbuf __
return do_utimes(AT_FDCWD, filename, t ? tv : NULL, 0);
}
-asmlinkage long compat_sys_utimensat(unsigned int dfd, char __user *filename, struct compat_timespec __user *t, int flags)
+COMPAT_SYSCALL_DEFINE4(utimensat, unsigned int, dfd, char __user *, filename, struct compat_timespec __user *, t, int, flags)
{
struct timespec tv[2];
@@ -105,7 +105,7 @@ asmlinkage long compat_sys_utimensat(unsigned int dfd, char __user *filename, st
return do_utimes(dfd, filename, t ? tv : NULL, flags);
}
-asmlinkage long compat_sys_futimesat(unsigned int dfd, char __user *filename, struct compat_timeval __user *t)
+COMPAT_SYSCALL_DEFINE3(futimesat, unsigned int, dfd, char __user *, filename, struct compat_timeval __user *, t)
{
struct timespec tv[2];
@@ -124,7 +124,7 @@ asmlinkage long compat_sys_futimesat(unsigned int dfd, char __user *filename, st
return do_utimes(dfd, filename, t ? tv : NULL, 0);
}
-asmlinkage long compat_sys_utimes(char __user *filename, struct compat_timeval __user *t)
+COMPAT_SYSCALL_DEFINE2(utimes, char __user *, filename, struct compat_timeval __user *, t)
{
return compat_sys_futimesat(AT_FDCWD, filename, t);
}
@@ -168,8 +168,8 @@ static int cp_compat_stat(struct kstat *stat, struct compat_stat __user *ubuf)
return err;
}
-asmlinkage long compat_sys_newstat(char __user * filename,
- struct compat_stat __user *statbuf)
+COMPAT_SYSCALL_DEFINE2(newstat, char __user *, filename,
+ struct compat_stat __user *, statbuf)
{
struct kstat stat;
int error;
@@ -180,8 +180,8 @@ asmlinkage long compat_sys_newstat(char __user * filename,
return cp_compat_stat(&stat, statbuf);
}
-asmlinkage long compat_sys_newlstat(char __user * filename,
- struct compat_stat __user *statbuf)
+COMPAT_SYSCALL_DEFINE2(newlstat, char __user *, filename,
+ struct compat_stat __user *, statbuf)
{
struct kstat stat;
int error;
@@ -193,8 +193,8 @@ asmlinkage long compat_sys_newlstat(char __user * filename,
}
#ifndef __ARCH_WANT_STAT64
-asmlinkage long compat_sys_newfstatat(unsigned int dfd, char __user *filename,
- struct compat_stat __user *statbuf, int flag)
+COMPAT_SYSCALL_DEFINE4(newfstatat, unsigned int, dfd, char __user *, filename,
+ struct compat_stat __user *, statbuf, int, flag)
{
struct kstat stat;
int error;
@@ -206,8 +206,8 @@ asmlinkage long compat_sys_newfstatat(unsigned int dfd, char __user *filename,
}
#endif
-asmlinkage long compat_sys_newfstat(unsigned int fd,
- struct compat_stat __user * statbuf)
+COMPAT_SYSCALL_DEFINE2(newfstat, unsigned int, fd,
+ struct compat_stat __user *, statbuf)
{
struct kstat stat;
int error = vfs_fstat(fd, &stat);
@@ -258,7 +258,7 @@ static int put_compat_statfs(struct compat_statfs __user *ubuf, struct kstatfs *
* The following statfs calls are copies of code from fs/open.c and
* should be checked against those from time to time
*/
-asmlinkage long compat_sys_statfs(const char __user *pathname, struct compat_statfs __user *buf)
+COMPAT_SYSCALL_DEFINE2(statfs, const char __user *, pathname, struct compat_statfs __user *, buf)
{
struct path path;
int error;
@@ -274,7 +274,7 @@ asmlinkage long compat_sys_statfs(const char __user *pathname, struct compat_sta
return error;
}
-asmlinkage long compat_sys_fstatfs(unsigned int fd, struct compat_statfs __user *buf)
+COMPAT_SYSCALL_DEFINE2(fstatfs, unsigned int, fd, struct compat_statfs __user *, buf)
{
struct file * file;
struct kstatfs tmp;
@@ -323,7 +323,7 @@ static int put_compat_statfs64(struct compat_statfs64 __user *ubuf, struct kstat
return 0;
}
-asmlinkage long compat_sys_statfs64(const char __user *pathname, compat_size_t sz, struct compat_statfs64 __user *buf)
+COMPAT_SYSCALL_DEFINE3(statfs64, const char __user *, pathname, compat_size_t, sz, struct compat_statfs64 __user *, buf)
{
struct path path;
int error;
@@ -342,7 +342,7 @@ asmlinkage long compat_sys_statfs64(const char __user *pathname, compat_size_t s
return error;
}
-asmlinkage long compat_sys_fstatfs64(unsigned int fd, compat_size_t sz, struct compat_statfs64 __user *buf)
+COMPAT_SYSCALL_DEFINE3(fstatfs64, unsigned int, fd, compat_size_t, sz, struct compat_statfs64 __user *, buf)
{
struct file * file;
struct kstatfs tmp;
@@ -368,7 +368,7 @@ out:
* Given how simple this syscall is that apporach is more maintainable
* than the various conversion hacks.
*/
-asmlinkage long compat_sys_ustat(unsigned dev, struct compat_ustat __user *u)
+COMPAT_SYSCALL_DEFINE2(ustat, unsigned, dev, struct compat_ustat __user *, u)
{
struct super_block *sb;
struct compat_ustat tmp;
@@ -443,8 +443,8 @@ static int put_compat_flock64(struct flock *kfl, struct compat_flock64 __user *u
}
#endif
-asmlinkage long compat_sys_fcntl64(unsigned int fd, unsigned int cmd,
- unsigned long arg)
+COMPAT_SYSCALL_DEFINE3(fcntl64, unsigned int, fd, unsigned int, cmd,
+ unsigned long, arg)
{
mm_segment_t old_fs;
struct flock f;
@@ -512,16 +512,15 @@ asmlinkage long compat_sys_fcntl64(unsigned int fd, unsigned int cmd,
return ret;
}
-asmlinkage long compat_sys_fcntl(unsigned int fd, unsigned int cmd,
- unsigned long arg)
+COMPAT_SYSCALL_DEFINE3(fcntl, unsigned int, fd, unsigned int, cmd,
+ unsigned long, arg)
{
if ((cmd == F_GETLK64) || (cmd == F_SETLK64) || (cmd == F_SETLKW64))
return -EINVAL;
return compat_sys_fcntl64(fd, cmd, arg);
}
-asmlinkage long
-compat_sys_io_setup(unsigned nr_reqs, u32 __user *ctx32p)
+COMPAT_SYSCALL_DEFINE2(io_setup, unsigned, nr_reqs, u32 __user *, ctx32p)
{
long ret;
aio_context_t ctx64;
@@ -540,12 +539,11 @@ compat_sys_io_setup(unsigned nr_reqs, u32 __user *ctx32p)
return ret;
}
-asmlinkage long
-compat_sys_io_getevents(aio_context_t ctx_id,
- unsigned long min_nr,
- unsigned long nr,
- struct io_event __user *events,
- struct compat_timespec __user *timeout)
+COMPAT_SYSCALL_DEFINE5(io_getevents, aio_context_t, ctx_id,
+ unsigned long, min_nr,
+ unsigned long, nr,
+ struct io_event __user *, events,
+ struct compat_timespec __user *, timeout)
{
long ret;
struct timespec t;
@@ -658,8 +656,7 @@ copy_iocb(long nr, u32 __user *ptr32, struct iocb __user * __user *ptr64)
#define MAX_AIO_SUBMITS (PAGE_SIZE/sizeof(struct iocb *))
-asmlinkage long
-compat_sys_io_submit(aio_context_t ctx_id, int nr, u32 __user *iocb)
+COMPAT_SYSCALL_DEFINE3(io_submit, aio_context_t, ctx_id, int, nr, u32 __user *, iocb)
{
struct iocb __user * __user *iocb64;
long ret;
@@ -836,9 +833,9 @@ static int do_nfs4_super_data_conv(void *raw_data)
#define NCPFS_NAME "ncpfs"
#define NFS4_NAME "nfs4"
-asmlinkage long compat_sys_mount(char __user * dev_name, char __user * dir_name,
- char __user * type, unsigned long flags,
- void __user * data)
+COMPAT_SYSCALL_DEFINE5(mount, char __user *, dev_name, char __user *, dir_name,
+ char __user *, type, unsigned long, flags,
+ void __user *, data)
{
char *kernel_type;
unsigned long data_page;
@@ -937,8 +934,9 @@ efault:
return -EFAULT;
}
-asmlinkage long compat_sys_old_readdir(unsigned int fd,
- struct compat_old_linux_dirent __user *dirent, unsigned int count)
+COMPAT_SYSCALL_DEFINE3(old_readdir, unsigned int, fd,
+ struct compat_old_linux_dirent __user *, dirent,
+ unsigned int, count)
{
int error;
struct file *file;
@@ -1017,8 +1015,9 @@ efault:
return -EFAULT;
}
-asmlinkage long compat_sys_getdents(unsigned int fd,
- struct compat_linux_dirent __user *dirent, unsigned int count)
+COMPAT_SYSCALL_DEFINE3(getdents, unsigned int, fd,
+ struct compat_linux_dirent __user *, dirent,
+ unsigned int, count)
{
struct file * file;
struct compat_linux_dirent __user * lastdirent;
@@ -1105,8 +1104,9 @@ efault:
return -EFAULT;
}
-asmlinkage long compat_sys_getdents64(unsigned int fd,
- struct linux_dirent64 __user * dirent, unsigned int count)
+COMPAT_SYSCALL_DEFINE3(getdents64, unsigned int, fd,
+ struct linux_dirent64 __user *, dirent,
+ unsigned int, count)
{
struct file * file;
struct linux_dirent64 __user * lastdirent;
@@ -1316,9 +1316,8 @@ compat_sys_pwritev(unsigned long fd, const struct compat_iovec __user *vec,
return ret;
}
-asmlinkage long
-compat_sys_vmsplice(int fd, const struct compat_iovec __user *iov32,
- unsigned int nr_segs, unsigned int flags)
+COMPAT_SYSCALL_DEFINE4(vmsplice, int, fd, const struct compat_iovec __user *, iov32,
+ unsigned int, nr_segs, unsigned int, flags)
{
unsigned i;
struct iovec __user *iov;
@@ -1340,8 +1339,7 @@ compat_sys_vmsplice(int fd, const struct compat_iovec __user *iov32,
* Exactly like fs/open.c:sys_open(), except that it doesn't set the
* O_LARGEFILE flag.
*/
-asmlinkage long
-compat_sys_open(const char __user *filename, int flags, int mode)
+COMPAT_SYSCALL_DEFINE3(open, const char __user *, filename, int, flags, int, mode)
{
return do_sys_open(AT_FDCWD, filename, flags, mode);
}
@@ -1350,8 +1348,7 @@ compat_sys_open(const char __user *filename, int flags, int mode)
* Exactly like fs/open.c:sys_openat(), except that it doesn't set the
* O_LARGEFILE flag.
*/
-asmlinkage long
-compat_sys_openat(unsigned int dfd, const char __user *filename, int flags, int mode)
+COMPAT_SYSCALL_DEFINE4(openat, unsigned int, dfd, const char __user *, filename, int, flags, int, mode)
{
return do_sys_open(dfd, filename, flags, mode);
}
@@ -1793,9 +1790,9 @@ out_nofds:
return ret;
}
-asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp,
- compat_ulong_t __user *outp, compat_ulong_t __user *exp,
- struct compat_timeval __user *tvp)
+COMPAT_SYSCALL_DEFINE5(select, int, n, compat_ulong_t __user *, inp,
+ compat_ulong_t __user *, outp, compat_ulong_t __user *, exp,
+ struct compat_timeval __user *, tvp)
{
struct timespec end_time, *to = NULL;
struct compat_timeval tv;
@@ -1888,9 +1885,9 @@ static long do_compat_pselect(int n, compat_ulong_t __user *inp,
return ret;
}
-asmlinkage long compat_sys_pselect6(int n, compat_ulong_t __user *inp,
- compat_ulong_t __user *outp, compat_ulong_t __user *exp,
- struct compat_timespec __user *tsp, void __user *sig)
+COMPAT_SYSCALL_DEFINE6(pselect6, int, n, compat_ulong_t __user *, inp,
+ compat_ulong_t __user *, outp, compat_ulong_t __user *, exp,
+ struct compat_timespec __user *, tsp, void __user *, sig)
{
compat_size_t sigsetsize = 0;
compat_uptr_t up = 0;
@@ -1907,9 +1904,9 @@ asmlinkage long compat_sys_pselect6(int n, compat_ulong_t __user *inp,
sigsetsize);
}
-asmlinkage long compat_sys_ppoll(struct pollfd __user *ufds,
- unsigned int nfds, struct compat_timespec __user *tsp,
- const compat_sigset_t __user *sigmask, compat_size_t sigsetsize)
+COMPAT_SYSCALL_DEFINE5(ppoll, struct pollfd __user *, ufds,
+ unsigned int, nfds, struct compat_timespec __user *, tsp,
+ const compat_sigset_t __user *, sigmask, compat_size_t, sigsetsize)
{
compat_sigset_t ss32;
sigset_t ksigmask, sigsaved;
@@ -2137,9 +2134,9 @@ static int compat_nfs_getfh_res_trans(union nfsctl_res *kres,
return (err) ? -EFAULT : 0;
}
-asmlinkage long compat_sys_nfsservctl(int cmd,
- struct compat_nfsctl_arg __user *arg,
- union compat_nfsctl_res __user *res)
+COMPAT_SYSCALL_DEFINE3(nfsservctl, int, cmd,
+ struct compat_nfsctl_arg __user *, arg,
+ union compat_nfsctl_res __user *, res)
{
struct nfsctl_arg *karg;
union nfsctl_res *kres;
@@ -2215,11 +2212,11 @@ long asmlinkage compat_sys_nfsservctl(int cmd, void *notused, void *notused2)
#ifdef CONFIG_EPOLL
#ifdef HAVE_SET_RESTORE_SIGMASK
-asmlinkage long compat_sys_epoll_pwait(int epfd,
- struct compat_epoll_event __user *events,
- int maxevents, int timeout,
- const compat_sigset_t __user *sigmask,
- compat_size_t sigsetsize)
+COMPAT_SYSCALL_DEFINE6(epoll_pwait, int, epfd,
+ struct compat_epoll_event __user *, events,
+ int, maxevents, int, timeout,
+ const compat_sigset_t __user *, sigmask,
+ compat_size_t, sigsetsize)
{
long err;
compat_sigset_t csigmask;
@@ -2264,9 +2261,9 @@ asmlinkage long compat_sys_epoll_pwait(int epfd,
#ifdef CONFIG_SIGNALFD
-asmlinkage long compat_sys_signalfd4(int ufd,
- const compat_sigset_t __user *sigmask,
- compat_size_t sigsetsize, int flags)
+COMPAT_SYSCALL_DEFINE4(signalfd4, int, ufd,
+ const compat_sigset_t __user *, sigmask,
+ compat_size_t, sigsetsize, int, flags)
{
compat_sigset_t ss32;
sigset_t tmp;
@@ -2284,9 +2281,9 @@ asmlinkage long compat_sys_signalfd4(int ufd,
return sys_signalfd4(ufd, ksigmask, sizeof(sigset_t), flags);
}
-asmlinkage long compat_sys_signalfd(int ufd,
- const compat_sigset_t __user *sigmask,
- compat_size_t sigsetsize)
+COMPAT_SYSCALL_DEFINE3(signalfd, int, ufd,
+ const compat_sigset_t __user *, sigmask,
+ compat_size_t, sigsetsize)
{
return compat_sys_signalfd4(ufd, sigmask, sigsetsize, 0);
}
@@ -2294,9 +2291,9 @@ asmlinkage long compat_sys_signalfd(int ufd,
#ifdef CONFIG_TIMERFD
-asmlinkage long compat_sys_timerfd_settime(int ufd, int flags,
- const struct compat_itimerspec __user *utmr,
- struct compat_itimerspec __user *otmr)
+COMPAT_SYSCALL_DEFINE4(timerfd_settime, int, ufd, int, flags,
+ const struct compat_itimerspec __user *, utmr,
+ struct compat_itimerspec __user *, otmr)
{
int error;
struct itimerspec t;
@@ -2315,8 +2312,8 @@ asmlinkage long compat_sys_timerfd_settime(int ufd, int flags,
return error;
}
-asmlinkage long compat_sys_timerfd_gettime(int ufd,
- struct compat_itimerspec __user *otmr)
+COMPAT_SYSCALL_DEFINE2(timerfd_gettime, int, ufd,
+ struct compat_itimerspec __user *, otmr)
{
int error;
struct itimerspec t;
--
1.7.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 31/40] trace syscalls: Convert various generic compat syscalls
[not found] <1277287401-28571-1-git-send-email-imunsie@au1.ibm.com>
2010-06-23 10:02 ` [PATCH 15/40] compat: convert fs compat to use COMPAT_SYSCALL_DEFINE#N() macros Ian Munsie
@ 2010-06-23 10:03 ` Ian Munsie
2010-06-23 10:19 ` Andi Kleen
2010-06-23 10:03 ` [PATCH 32/40] trace syscalls: Record metadata for syscalls with their own wrappers Ian Munsie
2010-06-23 10:03 ` [PATCH 34/40] trace syscalls: Convert generic syscalls without long return type Ian Munsie
3 siblings, 1 reply; 16+ messages in thread
From: Ian Munsie @ 2010-06-23 10:03 UTC (permalink / raw)
To: linux-kernel, linuxppc-dev
Cc: Jason Baron, Frederic Weisbecker, Steven Rostedt, Ingo Molnar,
Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
Ian Munsie, Alexander Viro, Andrew Morton, Jeff Moyer,
David Howells, Oleg Nesterov, Arnd Bergmann, David S. Miller,
Greg Kroah-Hartman, Dinakar Guniguntala, Thomas Gleixner,
Ingo Molnar, Eric Biederman, Simon Kagstrom <simon.kags
From: Ian Munsie <imunsie@au1.ibm.com>
This patch converts numerous trivial compat syscalls through the generic
kernel code to use the COMPAT_SYSCALL_DEFINE family of macros.
Signed-off-by: Ian Munsie <imunsie@au1.ibm.com>
---
fs/compat.c | 2 +-
fs/compat_ioctl.c | 4 ++--
ipc/compat_mq.c | 24 ++++++++++++------------
kernel/futex_compat.c | 19 ++++++++++---------
kernel/kexec.c | 8 ++++----
kernel/ptrace.c | 4 ++--
kernel/sysctl_binary.c | 2 +-
mm/mempolicy.c | 19 ++++++++++---------
net/compat.c | 28 ++++++++++++++--------------
9 files changed, 56 insertions(+), 54 deletions(-)
diff --git a/fs/compat.c b/fs/compat.c
index df0b502..9897b7b 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -1823,7 +1823,7 @@ struct compat_sel_arg_struct {
compat_uptr_t tvp;
};
-asmlinkage long compat_sys_old_select(struct compat_sel_arg_struct __user *arg)
+COMPAT_SYSCALL_DEFINE1(old_select, struct compat_sel_arg_struct __user *, arg)
{
struct compat_sel_arg_struct a;
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index 641640d..60d7e91 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -1674,8 +1674,8 @@ static int compat_ioctl_check_table(unsigned int xcmd)
return ioctl_pointer[i] == xcmd;
}
-asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd,
- unsigned long arg)
+COMPAT_SYSCALL_DEFINE3(ioctl, unsigned int, fd, unsigned int, cmd,
+ unsigned long, arg)
{
struct file *filp;
int error = -EBADF;
diff --git a/ipc/compat_mq.c b/ipc/compat_mq.c
index d8d1e9f..53593d3 100644
--- a/ipc/compat_mq.c
+++ b/ipc/compat_mq.c
@@ -46,9 +46,9 @@ static inline int put_compat_mq_attr(const struct mq_attr *attr,
| __put_user(attr->mq_curmsgs, &uattr->mq_curmsgs);
}
-asmlinkage long compat_sys_mq_open(const char __user *u_name,
- int oflag, compat_mode_t mode,
- struct compat_mq_attr __user *u_attr)
+COMPAT_SYSCALL_DEFINE4(mq_open, const char __user *, u_name,
+ int, oflag, compat_mode_t, mode,
+ struct compat_mq_attr __user *, u_attr)
{
void __user *p = NULL;
if (u_attr && oflag & O_CREAT) {
@@ -75,10 +75,10 @@ static int compat_prepare_timeout(struct timespec __user * *p,
return 0;
}
-asmlinkage long compat_sys_mq_timedsend(mqd_t mqdes,
- const char __user *u_msg_ptr,
- size_t msg_len, unsigned int msg_prio,
- const struct compat_timespec __user *u_abs_timeout)
+COMPAT_SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes,
+ const char __user *, u_msg_ptr,
+ size_t, msg_len, unsigned int, msg_prio,
+ const struct compat_timespec __user *, u_abs_timeout)
{
struct timespec __user *u_ts;
@@ -102,8 +102,8 @@ asmlinkage ssize_t compat_sys_mq_timedreceive(mqd_t mqdes,
u_msg_prio, u_ts);
}
-asmlinkage long compat_sys_mq_notify(mqd_t mqdes,
- const struct compat_sigevent __user *u_notification)
+COMPAT_SYSCALL_DEFINE2(mq_notify, mqd_t, mqdes,
+ const struct compat_sigevent __user *, u_notification)
{
struct sigevent __user *p = NULL;
if (u_notification) {
@@ -119,9 +119,9 @@ asmlinkage long compat_sys_mq_notify(mqd_t mqdes,
return sys_mq_notify(mqdes, p);
}
-asmlinkage long compat_sys_mq_getsetattr(mqd_t mqdes,
- const struct compat_mq_attr __user *u_mqstat,
- struct compat_mq_attr __user *u_omqstat)
+COMPAT_SYSCALL_DEFINE3(mq_getsetattr, mqd_t, mqdes,
+ const struct compat_mq_attr __user *, u_mqstat,
+ struct compat_mq_attr __user *, u_omqstat)
{
struct mq_attr mqstat;
struct mq_attr __user *p = compat_alloc_user_space(2 * sizeof(*p));
diff --git a/kernel/futex_compat.c b/kernel/futex_compat.c
index d49afb2..d798c9f 100644
--- a/kernel/futex_compat.c
+++ b/kernel/futex_compat.c
@@ -10,6 +10,7 @@
#include <linux/compat.h>
#include <linux/nsproxy.h>
#include <linux/futex.h>
+#include <linux/syscalls.h>
#include <asm/uaccess.h>
@@ -114,9 +115,9 @@ void compat_exit_robust_list(struct task_struct *curr)
}
}
-asmlinkage long
-compat_sys_set_robust_list(struct compat_robust_list_head __user *head,
- compat_size_t len)
+COMPAT_SYSCALL_DEFINE2(set_robust_list,
+ struct compat_robust_list_head __user *, head,
+ compat_size_t, len)
{
if (!futex_cmpxchg_enabled)
return -ENOSYS;
@@ -129,9 +130,9 @@ compat_sys_set_robust_list(struct compat_robust_list_head __user *head,
return 0;
}
-asmlinkage long
-compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr,
- compat_size_t __user *len_ptr)
+COMPAT_SYSCALL_DEFINE3(get_robust_list, int, pid,
+ compat_uptr_t __user *, head_ptr,
+ compat_size_t __user *, len_ptr)
{
struct compat_robust_list_head __user *head;
unsigned long ret;
@@ -170,9 +171,9 @@ err_unlock:
return ret;
}
-asmlinkage long compat_sys_futex(u32 __user *uaddr, int op, u32 val,
- struct compat_timespec __user *utime, u32 __user *uaddr2,
- u32 val3)
+COMPAT_SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val,
+ struct compat_timespec __user *, utime, u32 __user *, uaddr2,
+ u32, val3)
{
struct timespec ts;
ktime_t t, *tp = NULL;
diff --git a/kernel/kexec.c b/kernel/kexec.c
index 474a847..0b261ed 100644
--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -1024,10 +1024,10 @@ out:
}
#ifdef CONFIG_COMPAT
-asmlinkage long compat_sys_kexec_load(unsigned long entry,
- unsigned long nr_segments,
- struct compat_kexec_segment __user *segments,
- unsigned long flags)
+COMPAT_SYSCALL_DEFINE4(kexec_load, unsigned long, entry,
+ unsigned long, nr_segments,
+ struct compat_kexec_segment __user *, segments,
+ unsigned long, flags)
{
struct compat_kexec_segment in;
struct kexec_segment out, __user *ksegments;
diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index 74a3d69..0d91d7f 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -826,8 +826,8 @@ int compat_ptrace_request(struct task_struct *child, compat_long_t request,
return ret;
}
-asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid,
- compat_long_t addr, compat_long_t data)
+COMPAT_SYSCALL_DEFINE4(ptrace, compat_long_t, request, compat_long_t, pid,
+ compat_long_t, addr, compat_long_t, data)
{
struct task_struct *child;
long ret;
diff --git a/kernel/sysctl_binary.c b/kernel/sysctl_binary.c
index 1357c57..fb061c7 100644
--- a/kernel/sysctl_binary.c
+++ b/kernel/sysctl_binary.c
@@ -1502,7 +1502,7 @@ struct compat_sysctl_args {
compat_ulong_t __unused[4];
};
-asmlinkage long compat_sys_sysctl(struct compat_sysctl_args __user *args)
+COMPAT_SYSCALL_DEFINE1(sysctl, struct compat_sysctl_args __user *, args)
{
struct compat_sysctl_args tmp;
compat_size_t __user *compat_oldlenp;
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 5d6fb33..b9fbceb 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1372,10 +1372,10 @@ SYSCALL_DEFINE5(get_mempolicy, int __user *, policy,
#ifdef CONFIG_COMPAT
-asmlinkage long compat_sys_get_mempolicy(int __user *policy,
- compat_ulong_t __user *nmask,
- compat_ulong_t maxnode,
- compat_ulong_t addr, compat_ulong_t flags)
+COMPAT_SYSCALL_DEFINE5(get_mempolicy, int __user *, policy,
+ compat_ulong_t __user *, nmask,
+ compat_ulong_t, maxnode,
+ compat_ulong_t, addr, compat_ulong_t, flags)
{
long err;
unsigned long __user *nm = NULL;
@@ -1400,8 +1400,9 @@ asmlinkage long compat_sys_get_mempolicy(int __user *policy,
return err;
}
-asmlinkage long compat_sys_set_mempolicy(int mode, compat_ulong_t __user *nmask,
- compat_ulong_t maxnode)
+COMPAT_SYSCALL_DEFINE3(set_mempolicy, int, mode,
+ compat_ulong_t __user *, nmask,
+ compat_ulong_t, maxnode)
{
long err = 0;
unsigned long __user *nm = NULL;
@@ -1423,9 +1424,9 @@ asmlinkage long compat_sys_set_mempolicy(int mode, compat_ulong_t __user *nmask,
return sys_set_mempolicy(mode, nm, nr_bits+1);
}
-asmlinkage long compat_sys_mbind(compat_ulong_t start, compat_ulong_t len,
- compat_ulong_t mode, compat_ulong_t __user *nmask,
- compat_ulong_t maxnode, compat_ulong_t flags)
+COMPAT_SYSCALL_DEFINE6(mbind, compat_ulong_t, start, compat_ulong_t, len,
+ compat_ulong_t, mode, compat_ulong_t __user *, nmask,
+ compat_ulong_t, maxnode, compat_ulong_t, flags)
{
long err = 0;
unsigned long __user *nm = NULL;
diff --git a/net/compat.c b/net/compat.c
index ec24d9e..eb861c6 100644
--- a/net/compat.c
+++ b/net/compat.c
@@ -385,8 +385,8 @@ static int compat_sock_setsockopt(struct socket *sock, int level, int optname,
return sock_setsockopt(sock, level, optname, optval, optlen);
}
-asmlinkage long compat_sys_setsockopt(int fd, int level, int optname,
- char __user *optval, unsigned int optlen)
+COMPAT_SYSCALL_DEFINE5(setsockopt, int, fd, int, level, int, optname,
+ char __user *, optval, unsigned int, optlen)
{
int err;
struct socket *sock;
@@ -498,8 +498,8 @@ int compat_sock_get_timestampns(struct sock *sk, struct timespec __user *usersta
}
EXPORT_SYMBOL(compat_sock_get_timestampns);
-asmlinkage long compat_sys_getsockopt(int fd, int level, int optname,
- char __user *optval, int __user *optlen)
+COMPAT_SYSCALL_DEFINE5(getsockopt, int, fd, int, level, int, optname,
+ char __user *, optval, int __user *, optlen)
{
int err;
struct socket *sock;
@@ -731,31 +731,31 @@ static unsigned char nas[20]={AL(0),AL(3),AL(3),AL(3),AL(2),AL(3),
AL(4),AL(5)};
#undef AL
-asmlinkage long compat_sys_sendmsg(int fd, struct compat_msghdr __user *msg, unsigned flags)
+COMPAT_SYSCALL_DEFINE3(sendmsg, int, fd, struct compat_msghdr __user *, msg, unsigned, flags)
{
return sys_sendmsg(fd, (struct msghdr __user *)msg, flags | MSG_CMSG_COMPAT);
}
-asmlinkage long compat_sys_recvmsg(int fd, struct compat_msghdr __user *msg, unsigned int flags)
+COMPAT_SYSCALL_DEFINE3(recvmsg, int, fd, struct compat_msghdr __user *, msg, unsigned int, flags)
{
return sys_recvmsg(fd, (struct msghdr __user *)msg, flags | MSG_CMSG_COMPAT);
}
-asmlinkage long compat_sys_recv(int fd, void __user *buf, size_t len, unsigned flags)
+COMPAT_SYSCALL_DEFINE4(recv, int, fd, void __user *, buf, size_t, len, unsigned, flags)
{
return sys_recv(fd, buf, len, flags | MSG_CMSG_COMPAT);
}
-asmlinkage long compat_sys_recvfrom(int fd, void __user *buf, size_t len,
- unsigned flags, struct sockaddr __user *addr,
- int __user *addrlen)
+COMPAT_SYSCALL_DEFINE6(recvfrom, int, fd, void __user *, buf, size_t, len,
+ unsigned, flags, struct sockaddr __user *, addr,
+ int __user *, addrlen)
{
return sys_recvfrom(fd, buf, len, flags | MSG_CMSG_COMPAT, addr, addrlen);
}
-asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg,
- unsigned vlen, unsigned int flags,
- struct compat_timespec __user *timeout)
+COMPAT_SYSCALL_DEFINE5(recvmmsg, int, fd, struct compat_mmsghdr __user *, mmsg,
+ unsigned, vlen, unsigned int, flags,
+ struct compat_timespec __user *, timeout)
{
int datagrams;
struct timespec ktspec;
@@ -775,7 +775,7 @@ asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg,
return datagrams;
}
-asmlinkage long compat_sys_socketcall(int call, u32 __user *args)
+COMPAT_SYSCALL_DEFINE2(socketcall, int, call, u32 __user *, args)
{
int ret;
u32 a[6];
--
1.7.1
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 32/40] trace syscalls: Record metadata for syscalls with their own wrappers
[not found] <1277287401-28571-1-git-send-email-imunsie@au1.ibm.com>
2010-06-23 10:02 ` [PATCH 15/40] compat: convert fs compat to use COMPAT_SYSCALL_DEFINE#N() macros Ian Munsie
2010-06-23 10:03 ` [PATCH 31/40] trace syscalls: Convert various generic compat syscalls Ian Munsie
@ 2010-06-23 10:03 ` Ian Munsie
2010-06-23 10:03 ` [PATCH 34/40] trace syscalls: Convert generic syscalls without long return type Ian Munsie
3 siblings, 0 replies; 16+ messages in thread
From: Ian Munsie @ 2010-06-23 10:03 UTC (permalink / raw)
To: linux-kernel, linuxppc-dev
Cc: Jason Baron, Frederic Weisbecker, Steven Rostedt, Ingo Molnar,
Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
Ian Munsie, Martin Schwidefsky, Heiko Carstens, linux390,
Andrew Morton, Christoph Hellwig, Jesper Nilsson, David Howells,
Russell King, Alexander Viro, James Morris, Tetsuo Handa,
Eric Paris
From: Ian Munsie <imunsie@au1.ibm.com>
This patch adds support for syscalls using the SYSCALL_DEFINE macro
(i.e. ones that require a specialised syscall wrapper) to record their
meta-data for system call tracing.
The semantics of the SYSCALL_DEFINE macro therefore change to include
the number of arguments to the syscall and the arguments and types. All
instances of this macro have been updated to the new semantics.
Signed-off-by: Ian Munsie <imunsie@au1.ibm.com>
---
arch/s390/kernel/sys_s390.c | 4 ++--
fs/dcookies.c | 2 +-
fs/open.c | 6 +++---
fs/read_write.c | 8 ++++----
fs/sync.c | 8 ++++----
include/linux/syscalls.h | 9 +++++++--
ipc/sem.c | 2 +-
mm/fadvise.c | 4 ++--
mm/filemap.c | 2 +-
9 files changed, 25 insertions(+), 20 deletions(-)
diff --git a/arch/s390/kernel/sys_s390.c b/arch/s390/kernel/sys_s390.c
index 7b6b0f8..7773c87 100644
--- a/arch/s390/kernel/sys_s390.c
+++ b/arch/s390/kernel/sys_s390.c
@@ -185,8 +185,8 @@ SYSCALL_DEFINE1(s390_fadvise64_64, struct fadvise64_64_args __user *, args)
* to
* %r2: fd, %r3: mode, %r4/%r5: offset, 96(%r15)-103(%r15): len
*/
-SYSCALL_DEFINE(s390_fallocate)(int fd, int mode, loff_t offset,
- u32 len_high, u32 len_low)
+SYSCALL_DEFINE(s390_fallocate, 5, int, fd, int, mode, loff_t, offset,
+ u32, len_high, u32, len_low)
{
return sys_fallocate(fd, mode, offset, ((u64)len_high << 32) | len_low);
}
diff --git a/fs/dcookies.c b/fs/dcookies.c
index a21cabd..794cf94 100644
--- a/fs/dcookies.c
+++ b/fs/dcookies.c
@@ -145,7 +145,7 @@ out:
/* And here is where the userspace process can look up the cookie value
* to retrieve the path.
*/
-SYSCALL_DEFINE(lookup_dcookie)(u64 cookie64, char __user * buf, size_t len)
+SYSCALL_DEFINE(lookup_dcookie, 3, u64, cookie64, char __user *, buf, size_t, len)
{
unsigned long cookie = (unsigned long)cookie64;
int err = -EINVAL;
diff --git a/fs/open.c b/fs/open.c
index 5463266..4107638 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -185,7 +185,7 @@ SYSCALL_DEFINE2(ftruncate, unsigned int, fd, unsigned long, length)
/* LFS versions of truncate are only needed on 32 bit machines */
#if BITS_PER_LONG == 32
-SYSCALL_DEFINE(truncate64)(const char __user * path, loff_t length)
+SYSCALL_DEFINE(truncate64, 2, const char __user *, path, loff_t, length)
{
return do_sys_truncate(path, length);
}
@@ -197,7 +197,7 @@ asmlinkage long SyS_truncate64(long path, loff_t length)
SYSCALL_ALIAS(sys_truncate64, SyS_truncate64);
#endif
-SYSCALL_DEFINE(ftruncate64)(unsigned int fd, loff_t length)
+SYSCALL_DEFINE(ftruncate64, 2, unsigned int, fd, loff_t, length)
{
long ret = do_sys_ftruncate(fd, length, 0);
/* avoid REGPARM breakage on x86: */
@@ -256,7 +256,7 @@ int do_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
return inode->i_op->fallocate(inode, mode, offset, len);
}
-SYSCALL_DEFINE(fallocate)(int fd, int mode, loff_t offset, loff_t len)
+SYSCALL_DEFINE(fallocate, 4, int, fd, int, mode, loff_t, offset, loff_t, len)
{
struct file *file;
int error = -EBADF;
diff --git a/fs/read_write.c b/fs/read_write.c
index 9c04852..5b4044f 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -423,8 +423,8 @@ SYSCALL_DEFINE3(write, unsigned int, fd, const char __user *, buf,
return ret;
}
-SYSCALL_DEFINE(pread64)(unsigned int fd, char __user *buf,
- size_t count, loff_t pos)
+SYSCALL_DEFINE(pread64, 4, unsigned int, fd, char __user *, buf,
+ size_t, count, loff_t, pos)
{
struct file *file;
ssize_t ret = -EBADF;
@@ -452,8 +452,8 @@ asmlinkage long SyS_pread64(long fd, long buf, long count, loff_t pos)
SYSCALL_ALIAS(sys_pread64, SyS_pread64);
#endif
-SYSCALL_DEFINE(pwrite64)(unsigned int fd, const char __user *buf,
- size_t count, loff_t pos)
+SYSCALL_DEFINE(pwrite64, 4, unsigned int, fd, const char __user *, buf,
+ size_t, count, loff_t, pos)
{
struct file *file;
ssize_t ret = -EBADF;
diff --git a/fs/sync.c b/fs/sync.c
index 15aa6f0..5cb8072 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -292,8 +292,8 @@ EXPORT_SYMBOL(generic_write_sync);
* already-instantiated disk blocks, there are no guarantees here that the data
* will be available after a crash.
*/
-SYSCALL_DEFINE(sync_file_range)(int fd, loff_t offset, loff_t nbytes,
- unsigned int flags)
+SYSCALL_DEFINE(sync_file_range, 4, int, fd, loff_t, offset, loff_t, nbytes,
+ unsigned int, flags)
{
int ret;
struct file *file;
@@ -387,8 +387,8 @@ SYSCALL_ALIAS(sys_sync_file_range, SyS_sync_file_range);
/* It would be nice if people remember that not all the world's an i386
when they introduce new system calls */
-SYSCALL_DEFINE(sync_file_range2)(int fd, unsigned int flags,
- loff_t offset, loff_t nbytes)
+SYSCALL_DEFINE(sync_file_range2, 4, int, fd, unsigned int, flags,
+ loff_t, offset, loff_t, nbytes)
{
return sys_sync_file_range(fd, offset, nbytes, flags);
}
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 1076ae8..d7eaa4b 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -251,7 +251,9 @@ extern struct trace_event_functions exit_syscall_print_funcs;
#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
-#define SYSCALL_DEFINE(name) static inline long SYSC_##name
+#define SYSCALL_DEFINE(name, x, ...) \
+ SYSCALL_METADATAx(sys_##name, sys_##name, x, syscall, __VA_ARGS__);\
+ static inline long SYSC_##name(__SC_DECL##x(__VA_ARGS__))
#define __SYSCALL_DEFINEx(x, name, ...) \
asmlinkage long sys##name(__SC_DECL##x(__VA_ARGS__)); \
@@ -266,7 +268,10 @@ extern struct trace_event_functions exit_syscall_print_funcs;
#else /* CONFIG_HAVE_SYSCALL_WRAPPERS */
-#define SYSCALL_DEFINE(name) asmlinkage long sys_##name
+#define SYSCALL_DEFINE(name, x, ...) \
+ SYSCALL_METADATAx(sys_##name, sys_##name, x, syscall, __VA_ARGS__);\
+ asmlinkage long sys_##name(__SC_DECL##x(__VA_ARGS__))
+
#define __SYSCALL_DEFINEx(x, name, ...) \
asmlinkage long sys##name(__SC_DECL##x(__VA_ARGS__))
diff --git a/ipc/sem.c b/ipc/sem.c
index 506c849..1a1716b 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -1074,7 +1074,7 @@ out_up:
return err;
}
-SYSCALL_DEFINE(semctl)(int semid, int semnum, int cmd, union semun arg)
+SYSCALL_DEFINE(semctl, 4, int, semid, int, semnum, int, cmd, union semun, arg)
{
int err = -EINVAL;
int version;
diff --git a/mm/fadvise.c b/mm/fadvise.c
index 8d723c9..5105afa 100644
--- a/mm/fadvise.c
+++ b/mm/fadvise.c
@@ -24,7 +24,7 @@
* POSIX_FADV_WILLNEED could set PG_Referenced, and POSIX_FADV_NOREUSE could
* deactivate the pages and clear PG_Referenced.
*/
-SYSCALL_DEFINE(fadvise64_64)(int fd, loff_t offset, loff_t len, int advice)
+SYSCALL_DEFINE(fadvise64_64, 4, int, fd, loff_t, offset, loff_t, len, int, advice)
{
struct file *file = fget(fd);
struct address_space *mapping;
@@ -144,7 +144,7 @@ SYSCALL_ALIAS(sys_fadvise64_64, SyS_fadvise64_64);
#ifdef __ARCH_WANT_SYS_FADVISE64
-SYSCALL_DEFINE(fadvise64)(int fd, loff_t offset, size_t len, int advice)
+SYSCALL_DEFINE(fadvise64, 4, int, fd, loff_t, offset, size_t, len, int, advice)
{
return sys_fadvise64_64(fd, offset, len, advice);
}
diff --git a/mm/filemap.c b/mm/filemap.c
index 20e5642..967d6bb 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1372,7 +1372,7 @@ do_readahead(struct address_space *mapping, struct file *filp,
return 0;
}
-SYSCALL_DEFINE(readahead)(int fd, loff_t offset, size_t count)
+SYSCALL_DEFINE(readahead, 3, int, fd, loff_t, offset, size_t, count)
{
ssize_t ret;
struct file *file;
--
1.7.1
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 34/40] trace syscalls: Convert generic syscalls without long return type
[not found] <1277287401-28571-1-git-send-email-imunsie@au1.ibm.com>
` (2 preceding siblings ...)
2010-06-23 10:03 ` [PATCH 32/40] trace syscalls: Record metadata for syscalls with their own wrappers Ian Munsie
@ 2010-06-23 10:03 ` Ian Munsie
3 siblings, 0 replies; 16+ messages in thread
From: Ian Munsie @ 2010-06-23 10:03 UTC (permalink / raw)
To: linux-kernel, linuxppc-dev
Cc: Jason Baron, Frederic Weisbecker, Steven Rostedt, Ingo Molnar,
Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
Ian Munsie, Alexander Viro, Andrew Morton, Jeff Moyer,
David Howells, Oleg Nesterov, linux-fsdevel
From: Ian Munsie <imunsie@au1.ibm.com>
This patch converts a number of syscalls from the generic code that had
return types other than long to use the new COMPAT_SYSCALL_DEFINEx_RET
macros so their metadata is recorded for tracing.
Signed-off-by: Ian Munsie <imunsie@au1.ibm.com>
---
fs/compat.c | 24 ++++++++++++------------
ipc/compat_mq.c | 8 ++++----
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/fs/compat.c b/fs/compat.c
index 9897b7b..edfa4b5 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -1224,9 +1224,9 @@ out:
return ret;
}
-asmlinkage ssize_t
-compat_sys_readv(unsigned long fd, const struct compat_iovec __user *vec,
- unsigned long vlen)
+COMPAT_SYSCALL_DEFINE3_RET(ssize_t, readv, unsigned long, fd,
+ const struct compat_iovec __user *, vec,
+ unsigned long, vlen)
{
struct file *file;
int fput_needed;
@@ -1240,9 +1240,9 @@ compat_sys_readv(unsigned long fd, const struct compat_iovec __user *vec,
return ret;
}
-asmlinkage ssize_t
-compat_sys_preadv(unsigned long fd, const struct compat_iovec __user *vec,
- unsigned long vlen, u32 pos_low, u32 pos_high)
+COMPAT_SYSCALL_DEFINE5_RET(ssize_t, preadv, unsigned long, fd,
+ const struct compat_iovec __user *, vec,
+ unsigned long, vlen, u32, pos_low, u32, pos_high)
{
loff_t pos = ((loff_t)pos_high << 32) | pos_low;
struct file *file;
@@ -1281,9 +1281,9 @@ out:
return ret;
}
-asmlinkage ssize_t
-compat_sys_writev(unsigned long fd, const struct compat_iovec __user *vec,
- unsigned long vlen)
+COMPAT_SYSCALL_DEFINE3_RET(ssize_t, writev, unsigned long, fd,
+ const struct compat_iovec __user *, vec,
+ unsigned long, vlen)
{
struct file *file;
int fput_needed;
@@ -1297,9 +1297,9 @@ compat_sys_writev(unsigned long fd, const struct compat_iovec __user *vec,
return ret;
}
-asmlinkage ssize_t
-compat_sys_pwritev(unsigned long fd, const struct compat_iovec __user *vec,
- unsigned long vlen, u32 pos_low, u32 pos_high)
+COMPAT_SYSCALL_DEFINE5_RET(ssize_t, pwritev, unsigned long, fd,
+ const struct compat_iovec __user *, vec,
+ unsigned long, vlen, u32, pos_low, u32, pos_high)
{
loff_t pos = ((loff_t)pos_high << 32) | pos_low;
struct file *file;
diff --git a/ipc/compat_mq.c b/ipc/compat_mq.c
index 53593d3..22a394e 100644
--- a/ipc/compat_mq.c
+++ b/ipc/compat_mq.c
@@ -89,10 +89,10 @@ COMPAT_SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes,
msg_prio, u_ts);
}
-asmlinkage ssize_t compat_sys_mq_timedreceive(mqd_t mqdes,
- char __user *u_msg_ptr,
- size_t msg_len, unsigned int __user *u_msg_prio,
- const struct compat_timespec __user *u_abs_timeout)
+COMPAT_SYSCALL_DEFINE5_RET(ssize_t, mq_timedreceive, mqd_t, mqdes,
+ char __user *, u_msg_ptr,
+ size_t, msg_len, unsigned int __user *, u_msg_prio,
+ const struct compat_timespec __user *, u_abs_timeout)
{
struct timespec __user *u_ts;
if (compat_prepare_timeout(&u_ts, u_abs_timeout))
--
1.7.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH 31/40] trace syscalls: Convert various generic compat syscalls
2010-06-23 10:03 ` [PATCH 31/40] trace syscalls: Convert various generic compat syscalls Ian Munsie
@ 2010-06-23 10:19 ` Andi Kleen
2010-06-23 10:29 ` Frederic Weisbecker
2010-06-23 10:30 ` KOSAKI Motohiro
0 siblings, 2 replies; 16+ messages in thread
From: Andi Kleen @ 2010-06-23 10:19 UTC (permalink / raw)
To: Ian Munsie
Cc: linux-kernel, linuxppc-dev, Jason Baron, Frederic Weisbecker,
Steven Rostedt, Ingo Molnar, Benjamin Herrenschmidt,
Paul Mackerras, Michael Ellerman, Alexander Viro, Andrew Morton,
Jeff Moyer, David Howells, Oleg Nesterov, Arnd Bergmann,
David S. Miller, Greg Kroah-Hartman, Dinakar Guniguntala,
Thomas Gleixner, Ingo Molnar, Eric Biederman, Simon Kagstrom,
WANG Cong, Sam Ravnborg
, Ian Munsie wrote:
> From: Ian Munsie<imunsie@au1.ibm.com>
>
> This patch converts numerous trivial compat syscalls through the generic
> kernel code to use the COMPAT_SYSCALL_DEFINE family of macros.
Why? This just makes the code look uglier and the functions harder
to grep for.
-Andi
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 31/40] trace syscalls: Convert various generic compat syscalls
2010-06-23 10:19 ` Andi Kleen
@ 2010-06-23 10:29 ` Frederic Weisbecker
2010-06-23 10:37 ` Andi Kleen
2010-06-23 10:30 ` KOSAKI Motohiro
1 sibling, 1 reply; 16+ messages in thread
From: Frederic Weisbecker @ 2010-06-23 10:29 UTC (permalink / raw)
To: Andi Kleen
Cc: Ian Munsie, linux-kernel, linuxppc-dev, Jason Baron,
Steven Rostedt, Ingo Molnar, Benjamin Herrenschmidt,
Paul Mackerras, Michael Ellerman, Alexander Viro, Andrew Morton,
Jeff Moyer, David Howells, Oleg Nesterov, Arnd Bergmann,
David S. Miller, Greg Kroah-Hartman, Dinakar Guniguntala,
Thomas Gleixner, Ingo Molnar, Eric Biederman, Simon Kagstrom,
WANG Cong, Sam Ravnborg, Rol
On Wed, Jun 23, 2010 at 12:19:38PM +0200, Andi Kleen wrote:
> , Ian Munsie wrote:
>> From: Ian Munsie<imunsie@au1.ibm.com>
>>
>> This patch converts numerous trivial compat syscalls through the generic
>> kernel code to use the COMPAT_SYSCALL_DEFINE family of macros.
>
> Why? This just makes the code look uglier and the functions harder
> to grep for.
Because it makes them usable with syscall tracing.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 31/40] trace syscalls: Convert various generic compat syscalls
2010-06-23 10:19 ` Andi Kleen
2010-06-23 10:29 ` Frederic Weisbecker
@ 2010-06-23 10:30 ` KOSAKI Motohiro
1 sibling, 0 replies; 16+ messages in thread
From: KOSAKI Motohiro @ 2010-06-23 10:30 UTC (permalink / raw)
To: Andi Kleen
Cc: kosaki.motohiro, Ian Munsie, linux-kernel, linuxppc-dev,
Jason Baron, Frederic Weisbecker, Steven Rostedt, Ingo Molnar,
Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
Alexander Viro, Andrew Morton, Jeff Moyer, David Howells,
Oleg Nesterov, Arnd Bergmann, David S. Miller, Greg Kroah-Hartman,
Dinakar Guniguntala, Thomas Gleixner, Ingo
> , Ian Munsie wrote:
> > From: Ian Munsie<imunsie@au1.ibm.com>
> >
> > This patch converts numerous trivial compat syscalls through the generic
> > kernel code to use the COMPAT_SYSCALL_DEFINE family of macros.
>
> Why? This just makes the code look uglier and the functions harder
> to grep for.
I guess trace-syscall feature need to override COMPAT_SYSCALL_DEFINE. but
It's only guess...
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 31/40] trace syscalls: Convert various generic compat syscalls
2010-06-23 10:29 ` Frederic Weisbecker
@ 2010-06-23 10:37 ` Andi Kleen
2010-06-23 11:38 ` Frederic Weisbecker
` (4 more replies)
0 siblings, 5 replies; 16+ messages in thread
From: Andi Kleen @ 2010-06-23 10:37 UTC (permalink / raw)
To: Frederic Weisbecker
Cc: Ian Munsie, linux-kernel, linuxppc-dev, Jason Baron,
Steven Rostedt, Ingo Molnar, Benjamin Herrenschmidt,
Paul Mackerras, Michael Ellerman, Alexander Viro, Andrew Morton,
Jeff Moyer, David Howells, Oleg Nesterov, Arnd Bergmann,
David S. Miller, Greg Kroah-Hartman, Dinakar Guniguntala,
Thomas Gleixner, Ingo Molnar, Eric Biederman, Simon Kagstrom,
WANG Cong, Sam Ravnborg
, Frederic Weisbecker wrote:
> On Wed, Jun 23, 2010 at 12:19:38PM +0200, Andi Kleen wrote:
>> , Ian Munsie wrote:
>>> From: Ian Munsie<imunsie@au1.ibm.com>
>>>
>>> This patch converts numerous trivial compat syscalls through the generic
>>> kernel code to use the COMPAT_SYSCALL_DEFINE family of macros.
>>
>> Why? This just makes the code look uglier and the functions harder
>> to grep for.
>
>
> Because it makes them usable with syscall tracing.
Ok that information is missing in the changelog then.
Also I hope the uglification<->usefullness factor is really worth it.
The patch is certainly no slouch on the uglification side.
It also has maintenance costs, e.g. I doubt ctags and cscope
will be able to deal with these kinds of macros, so it has a
high cost for everyone using these tools. For those
it would be actually better if you used separate annotation
that does not confuse standard C parsers.
-Andi
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 31/40] trace syscalls: Convert various generic compat syscalls
2010-06-23 10:37 ` Andi Kleen
@ 2010-06-23 11:38 ` Frederic Weisbecker
2010-06-23 12:35 ` Andi Kleen
2010-06-23 15:51 ` H. Peter Anvin
2010-06-24 12:05 ` Michal Marek
` (3 subsequent siblings)
4 siblings, 2 replies; 16+ messages in thread
From: Frederic Weisbecker @ 2010-06-23 11:38 UTC (permalink / raw)
To: Andi Kleen
Cc: Ian Munsie, linux-kernel, linuxppc-dev, Jason Baron,
Steven Rostedt, Ingo Molnar, Benjamin Herrenschmidt,
Paul Mackerras, Michael Ellerman, Alexander Viro, Andrew Morton,
Jeff Moyer, David Howells, Oleg Nesterov, Arnd Bergmann,
David S. Miller, Greg Kroah-Hartman, Dinakar Guniguntala,
Thomas Gleixner, Ingo Molnar, Eric Biederman, Simon Kagstrom,
WANG Cong, Sam Ravnborg, Rol
On Wed, Jun 23, 2010 at 12:37:44PM +0200, Andi Kleen wrote:
> , Frederic Weisbecker wrote:
>> On Wed, Jun 23, 2010 at 12:19:38PM +0200, Andi Kleen wrote:
>>> , Ian Munsie wrote:
>>>> From: Ian Munsie<imunsie@au1.ibm.com>
>>>>
>>>> This patch converts numerous trivial compat syscalls through the generic
>>>> kernel code to use the COMPAT_SYSCALL_DEFINE family of macros.
>>>
>>> Why? This just makes the code look uglier and the functions harder
>>> to grep for.
>>
>>
>> Because it makes them usable with syscall tracing.
>
> Ok that information is missing in the changelog then.
Agreed, the changelog lacks the purpose of what it does.
> Also I hope the uglification<->usefullness factor is really worth it.
> The patch is certainly no slouch on the uglification side.
It's worth because the kernel's syscall tracing is not complete, we lack all
the compat part.
These wrappers let us create TRACE_EVENT() for every syscalls automatically.
If we had to create them manually, the uglification would be way much more worse.
Most syscalls use the syscall wrappers already, so the uglification
is there mostly. We just forgot to uglify a bunch of them :)
> It also has maintenance costs, e.g. I doubt ctags and cscope
> will be able to deal with these kinds of macros, so it has a
> high cost for everyone using these tools. For those
> it would be actually better if you used separate annotation
> that does not confuse standard C parsers.
I haven't heard any complains about existing syscalls wrappers.
What kind of annotations could solve that?
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 31/40] trace syscalls: Convert various generic compat syscalls
2010-06-23 11:38 ` Frederic Weisbecker
@ 2010-06-23 12:35 ` Andi Kleen
2010-06-23 12:41 ` Christoph Hellwig
2010-06-23 15:51 ` H. Peter Anvin
1 sibling, 1 reply; 16+ messages in thread
From: Andi Kleen @ 2010-06-23 12:35 UTC (permalink / raw)
To: Frederic Weisbecker
Cc: Ian Munsie, linux-kernel, linuxppc-dev, Jason Baron,
Steven Rostedt, Ingo Molnar, Benjamin Herrenschmidt,
Paul Mackerras, Michael Ellerman, Alexander Viro, Andrew Morton,
Jeff Moyer, David Howells, Oleg Nesterov, Arnd Bergmann,
David S. Miller, Greg Kroah-Hartman, Dinakar Guniguntala,
Thomas Gleixner, Ingo Molnar, Eric Biederman, Simon Kagstrom,
WANG Cong, Sam Ravnborg
>
> I haven't heard any complains about existing syscalls wrappers.
At least for me they always interrupt my grepping.
>
> What kind of annotations could solve that?
If you put the annotation in a separate macro and leave the original
prototype alone. Then C parsers could still parse it.
-Andi
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 31/40] trace syscalls: Convert various generic compat syscalls
2010-06-23 12:35 ` Andi Kleen
@ 2010-06-23 12:41 ` Christoph Hellwig
0 siblings, 0 replies; 16+ messages in thread
From: Christoph Hellwig @ 2010-06-23 12:41 UTC (permalink / raw)
To: Andi Kleen
Cc: Frederic Weisbecker, Ian Munsie, linux-kernel, linuxppc-dev,
Jason Baron, Steven Rostedt, Ingo Molnar, Benjamin Herrenschmidt,
Paul Mackerras, Michael Ellerman, Alexander Viro, Andrew Morton,
Jeff Moyer, David Howells, Oleg Nesterov, Arnd Bergmann,
David S. Miller, Greg Kroah-Hartman, Dinakar Guniguntala,
Thomas Gleixner, Ingo Molnar, Eric Biederman, Simon Kagstrom,
WANG Cong
On Wed, Jun 23, 2010 at 02:35:38PM +0200, Andi Kleen wrote:
> >I haven't heard any complains about existing syscalls wrappers.
>
> At least for me they always interrupt my grepping.
>
> >
> >What kind of annotations could solve that?
>
> If you put the annotation in a separate macro and leave the original
> prototype alone. Then C parsers could still parse it.
I personally hate the way SYSCALL_DEFINE works with passion, mostly
for the grep reason, but also because it looks horribly ugly.
But there is no reason not to be consistent here. We already use
the wrappers for all native system calls, so leaving the compat
calls out doesn't make any sense. And I'd cheer for anyone who
comes up with a better scheme for the native and compat wrappers.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 31/40] trace syscalls: Convert various generic compat syscalls
2010-06-23 11:38 ` Frederic Weisbecker
2010-06-23 12:35 ` Andi Kleen
@ 2010-06-23 15:51 ` H. Peter Anvin
1 sibling, 0 replies; 16+ messages in thread
From: H. Peter Anvin @ 2010-06-23 15:51 UTC (permalink / raw)
To: Frederic Weisbecker
Cc: Andi Kleen, Ian Munsie, linux-kernel, linuxppc-dev, Jason Baron,
Steven Rostedt, Ingo Molnar, Benjamin Herrenschmidt,
Paul Mackerras, Michael Ellerman, Alexander Viro, Andrew Morton,
Jeff Moyer, David Howells, Oleg Nesterov, Arnd Bergmann,
David S. Miller, Greg Kroah-Hartman, Dinakar Guniguntala,
Thomas Gleixner, Ingo Molnar, Eric Biederman <ebie
On 06/23/2010 04:38 AM, Frederic Weisbecker wrote:
>
> I haven't heard any complains about existing syscalls wrappers.
>
Then you truly haven't been listening.
-hpa
--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 31/40] trace syscalls: Convert various generic compat syscalls
2010-06-23 10:37 ` Andi Kleen
2010-06-23 11:38 ` Frederic Weisbecker
2010-06-24 12:05 ` Michal Marek
@ 2010-06-24 12:05 ` Michal Marek
2010-06-24 12:05 ` Michal Marek
2010-06-24 12:05 ` Michal Marek
4 siblings, 0 replies; 16+ messages in thread
From: Michal Marek @ 2010-06-24 12:05 UTC (permalink / raw)
To: linux-mm; +Cc: linux-kernel, linuxppc-dev, linux-fsdevel, kexec, netdev
On 23.6.2010 12:37, Andi Kleen wrote:
> It also has maintenance costs, e.g. I doubt ctags and cscope
> will be able to deal with these kinds of macros, so it has a
> high cost for everyone using these tools.
FWIW, patch 16/40 of this series teaches 'make tags' to recognize these
macros: http://permalink.gmane.org/gmane.linux.kernel/1002103
Michal
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 31/40] trace syscalls: Convert various generic compat syscalls
2010-06-23 10:37 ` Andi Kleen
` (3 preceding siblings ...)
2010-06-24 12:05 ` Michal Marek
@ 2010-06-24 12:05 ` Michal Marek
4 siblings, 0 replies; 16+ messages in thread
From: Michal Marek @ 2010-06-24 12:05 UTC (permalink / raw)
To: linux-fsdevel
Cc: linux-mm, linux-kernel, linuxppc-dev, kexec, netdev, linux-mm,
linux-kernel, linux-fsdevel, kexec, netdev, linux-kernel,
linuxppc-dev, linux-fsdevel, kexec, netdev
On 23.6.2010 12:37, Andi Kleen wrote:
> It also has maintenance costs, e.g. I doubt ctags and cscope
> will be able to deal with these kinds of macros, so it has a
> high cost for everyone using these tools.
FWIW, patch 16/40 of this series teaches 'make tags' to recognize these
macros: http://permalink.gmane.org/gmane.linux.kernel/1002103
Michal
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 31/40] trace syscalls: Convert various generic compat syscalls
2010-06-23 10:37 ` Andi Kleen
` (2 preceding siblings ...)
2010-06-24 12:05 ` Michal Marek
@ 2010-06-24 12:05 ` Michal Marek
2010-06-24 12:05 ` Michal Marek
4 siblings, 0 replies; 16+ messages in thread
From: Michal Marek @ 2010-06-24 12:05 UTC (permalink / raw)
To: linuxppc-dev
Cc: linuxppc-dev, netdev, kexec, linux-kernel, linux-mm,
linux-fsdevel
On 23.6.2010 12:37, Andi Kleen wrote:
> It also has maintenance costs, e.g. I doubt ctags and cscope
> will be able to deal with these kinds of macros, so it has a
> high cost for everyone using these tools.
FWIW, patch 16/40 of this series teaches 'make tags' to recognize these
macros: http://permalink.gmane.org/gmane.linux.kernel/1002103
Michal
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 31/40] trace syscalls: Convert various generic compat syscalls
2010-06-23 10:37 ` Andi Kleen
2010-06-23 11:38 ` Frederic Weisbecker
@ 2010-06-24 12:05 ` Michal Marek
2010-06-24 12:05 ` Michal Marek
` (2 subsequent siblings)
4 siblings, 0 replies; 16+ messages in thread
From: Michal Marek @ 2010-06-24 12:05 UTC (permalink / raw)
To: linux-kernel
Cc: linux-mm, linuxppc-dev, linux-fsdevel, kexec, netdev,
linux-kernel, linuxppc-dev, linux-fsdevel, kexec, netdev
On 23.6.2010 12:37, Andi Kleen wrote:
> It also has maintenance costs, e.g. I doubt ctags and cscope
> will be able to deal with these kinds of macros, so it has a
> high cost for everyone using these tools.
FWIW, patch 16/40 of this series teaches 'make tags' to recognize these
macros: http://permalink.gmane.org/gmane.linux.kernel/1002103
Michal
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2010-06-24 12:25 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1277287401-28571-1-git-send-email-imunsie@au1.ibm.com>
2010-06-23 10:02 ` [PATCH 15/40] compat: convert fs compat to use COMPAT_SYSCALL_DEFINE#N() macros Ian Munsie
2010-06-23 10:03 ` [PATCH 31/40] trace syscalls: Convert various generic compat syscalls Ian Munsie
2010-06-23 10:19 ` Andi Kleen
2010-06-23 10:29 ` Frederic Weisbecker
2010-06-23 10:37 ` Andi Kleen
2010-06-23 11:38 ` Frederic Weisbecker
2010-06-23 12:35 ` Andi Kleen
2010-06-23 12:41 ` Christoph Hellwig
2010-06-23 15:51 ` H. Peter Anvin
2010-06-24 12:05 ` Michal Marek
2010-06-24 12:05 ` Michal Marek
2010-06-24 12:05 ` Michal Marek
2010-06-24 12:05 ` Michal Marek
2010-06-23 10:30 ` KOSAKI Motohiro
2010-06-23 10:03 ` [PATCH 32/40] trace syscalls: Record metadata for syscalls with their own wrappers Ian Munsie
2010-06-23 10:03 ` [PATCH 34/40] trace syscalls: Convert generic syscalls without long return type Ian Munsie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).