Commit 851f8c30 authored by Stephen Rothwell's avatar Stephen Rothwell Committed by Linus Torvalds

[PATCH] compat_sys_sigpending and compat_sys_sigprocmask

This creates compat_sys_sigpending and compat_sys_sigprocmask and
patches sent to maintainers remove all the arch specific versions.
parent e898a4d6
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* Kernel compatibililty routines for e.g. 32 bit syscall support * Kernel compatibililty routines for e.g. 32 bit syscall support
* on 64 bit kernels. * on 64 bit kernels.
* *
* Copyright (C) 2002 Stephen Rothwell, IBM Corporation * Copyright (C) 2002-2003 Stephen Rothwell, IBM Corporation
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/compat.h> #include <linux/compat.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/time.h> #include <linux/time.h>
#include <linux/signal.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
...@@ -166,3 +167,44 @@ asmlinkage long compat_sys_times(struct compat_tms *tbuf) ...@@ -166,3 +167,44 @@ asmlinkage long compat_sys_times(struct compat_tms *tbuf)
} }
return compat_jiffies_to_clock_t(jiffies); return compat_jiffies_to_clock_t(jiffies);
} }
/*
* Assumption: old_sigset_t and compat_old_sigset_t are both
* types that can be passed to put_user()/get_user().
*/
extern asmlinkage long sys_sigpending(old_sigset_t *);
asmlinkage long compat_sys_sigpending(compat_old_sigset_t *set)
{
old_sigset_t s;
long ret;
mm_segment_t old_fs = get_fs();
set_fs(KERNEL_DS);
ret = sys_sigpending(&s);
set_fs(old_fs);
if (ret == 0)
ret = put_user(s, set);
return ret;
}
extern asmlinkage long sys_sigprocmask(int, old_sigset_t *, old_sigset_t *);
asmlinkage long compat_sys_sigprocmask(int how, compat_old_sigset_t *set,
compat_old_sigset_t *oset)
{
old_sigset_t s;
long ret;
mm_segment_t old_fs;
if (set && get_user(s, set))
return -EFAULT;
old_fs = get_fs();
set_fs(KERNEL_DS);
ret = sys_sigprocmask(how, set ? &s : NULL, oset ? &s : NULL);
set_fs(old_fs);
if (ret == 0)
ret = put_user(s, oset);
return ret;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment