mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [patch 5/9] signalfd/timerfd v3 - signalfd compat code ...
@ 2007-03-11 23:04 Davide Libenzi
  2007-03-14 15:19 ` Frank Seidel
  0 siblings, 1 reply; 3+ messages in thread
From: Davide Libenzi @ 2007-03-11 23:04 UTC (permalink / raw)
  To: Linux Kernel Mailing List; +Cc: Andrew Morton, Linus Torvalds, Oleg Nesterov

This patch implement the necessary compat code for the signalfd system call.


Signed-off-by: Davide Libenzi <davidel@xmailserver.org>


- Davide



Index: linux-2.6.20.ep2/fs/compat.c
===================================================================
--- linux-2.6.20.ep2.orig/fs/compat.c	2007-03-11 14:28:28.000000000 -0700
+++ linux-2.6.20.ep2/fs/compat.c	2007-03-11 14:28:48.000000000 -0700
@@ -46,6 +46,7 @@
 #include <linux/rwsem.h>
 #include <linux/tsacct_kern.h>
 #include <linux/highmem.h>
+#include <linux/signal.h>
 #include <linux/poll.h>
 #include <linux/mm.h>
 
@@ -2235,3 +2236,24 @@
 	return sys_ni_syscall();
 }
 #endif
+
+asmlinkage long compat_sys_signalfd(int ufd,
+				    const compat_sigset_t __user *sigmask,
+				    compat_size_t sigsetsize)
+{
+	compat_sigset_t ss32;
+	sigset_t tmp;
+	sigset_t __user *ksigmask;
+
+	if (sigsetsize != sizeof(compat_sigset_t))
+		return -EINVAL;
+	if (copy_from_user(&ss32, sigmask, sizeof(ss32)))
+		return -EFAULT;
+	sigset_from_compat(&tmp, &ss32);
+	ksigmask = compat_alloc_user_space(sizeof(sigset_t));
+	if (copy_to_user(ksigmask, &tmp, sizeof(sigset_t)))
+		return -EFAULT;
+
+	return sys_signalfd(ufd, ksigmask, sizeof(sigset_t));
+}
+


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch 5/9] signalfd/timerfd v3 - signalfd compat code ...
  2007-03-11 23:04 [patch 5/9] signalfd/timerfd v3 - signalfd compat code Davide Libenzi
@ 2007-03-14 15:19 ` Frank Seidel
  2007-03-14 15:29   ` Davide Libenzi
  0 siblings, 1 reply; 3+ messages in thread
From: Frank Seidel @ 2007-03-14 15:19 UTC (permalink / raw)
  To: Linux Kernel Mailing List

On Monday 12 March 2007 20:19:27 Davide Libenzi wrote:
Hi,
i'm not (at least until yet) really that familiar with the kernel, but 
currently trying to get into it also via reading of code and patches 
here. So please don't take my comments in this (and posibly following)
mails to serious. ;-)

> +asmlinkage long compat_sys_signalfd(int ufd,
> +                                 const compat_sigset_t __user 
*sigmask,
> +                                 compat_size_t sigsetsize)
> +{
> +     compat_sigset_t ss32;
> +     sigset_t tmp;
> +     sigset_t __user *ksigmask;
> +
Would it be good to put this in a

if (sigmask) {

like its e.g. done in compat_sys_epoll_pwait or would this be
totally useless here?

> +     if (sigsetsize != sizeof(compat_sigset_t))
> +             return -EINVAL;
> +     if (copy_from_user(&ss32, sigmask, sizeof(ss32)))
> +             return -EFAULT;
> ...

Have fun,
Frank

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch 5/9] signalfd/timerfd v3 - signalfd compat code ...
  2007-03-14 15:19 ` Frank Seidel
@ 2007-03-14 15:29   ` Davide Libenzi
  0 siblings, 0 replies; 3+ messages in thread
From: Davide Libenzi @ 2007-03-14 15:29 UTC (permalink / raw)
  To: Frank Seidel; +Cc: Linux Kernel Mailing List

[-- Attachment #1: Type: TEXT/PLAIN, Size: 959 bytes --]

On Wed, 14 Mar 2007, Frank Seidel wrote:

> On Monday 12 March 2007 20:19:27 Davide Libenzi wrote:
> Hi,
> i'm not (at least until yet) really that familiar with the kernel, but 
> currently trying to get into it also via reading of code and patches 
> here. So please don't take my comments in this (and posibly following)
> mails to serious. ;-)
> 
> > +asmlinkage long compat_sys_signalfd(int ufd,
> > +                                 const compat_sigset_t __user 
> *sigmask,
> > +                                 compat_size_t sigsetsize)
> > +{
> > +     compat_sigset_t ss32;
> > +     sigset_t tmp;
> > +     sigset_t __user *ksigmask;
> > +
> Would it be good to put this in a
> 
> if (sigmask) {
> 
> like its e.g. done in compat_sys_epoll_pwait or would this be
> totally useless here?

On the contrary or epoll_pwait (same family of ppoll/pselect), the sigmask 
is needed here, by the API definition.



- Davide


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-03-14 15:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-11 23:04 [patch 5/9] signalfd/timerfd v3 - signalfd compat code Davide Libenzi
2007-03-14 15:19 ` Frank Seidel
2007-03-14 15:29   ` Davide Libenzi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®