]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
flag parameters: paccept w/out set_restore_sigmask
authorUlrich Drepper <drepper@redhat.com>
Thu, 24 Jul 2008 04:29:21 +0000 (21:29 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 24 Jul 2008 17:47:27 +0000 (10:47 -0700)
Some platforms do not have support to restore the signal mask in the
return path from a syscall.  For those platforms syscalls like pselect are
not defined at all.  This is, I think, not a good choice for paccept()
since paccept() adds more value on top of accept() than just the signal
mask handling.

Therefore this patch defines a scaled down version of the sys_paccept
function for those platforms.  It returns -EINVAL in case the signal mask
is non-NULL but behaves the same otherwise.

Note that I explicitly included <linux/thread_info.h>.  I saw that it is
currently included but indirectly two levels down.  There is too much risk
in relying on this.  The header might change and then suddenly the
function definition would change without anyone immediately noticing.

Signed-off-by: Ulrich Drepper <drepper@redhat.com>
Cc: Davide Libenzi <davidel@xmailserver.org>
Cc: Michael Kerrisk <mtk.manpages@googlemail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/net.h
net/socket.c

index 3a9b06d4d0fe5d0f2acf265b83f93b70f8eca419..39a23af059b4acc5ca7a115ff2eba2da2b097ff3 100644 (file)
@@ -102,6 +102,9 @@ enum sock_type {
 
 /* Flags for socket, socketpair, paccept */
 #define SOCK_CLOEXEC   O_CLOEXEC
+#ifndef SOCK_NONBLOCK
+#define SOCK_NONBLOCK  O_NONBLOCK
+#endif
 
 #endif /* ARCH_HAS_SOCKET_TYPES */
 
index a0ce8ad722524b8290ffc6f046e66c9ab2365728..d163adff95bf6991d730eb8af291fbe5651989a4 100644 (file)
@@ -69,6 +69,7 @@
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <linux/mutex.h>
+#include <linux/thread_info.h>
 #include <linux/wanrouter.h>
 #include <linux/if_bridge.h>
 #include <linux/if_frad.h>
@@ -1504,6 +1505,7 @@ out_fd:
        goto out_put;
 }
 
+#ifdef HAVE_SET_RESTORE_SIGMASK
 asmlinkage long sys_paccept(int fd, struct sockaddr __user *upeer_sockaddr,
                            int __user *upeer_addrlen,
                            const sigset_t __user *sigmask,
@@ -1541,6 +1543,21 @@ asmlinkage long sys_paccept(int fd, struct sockaddr __user *upeer_sockaddr,
 
        return ret;
 }
+#else
+asmlinkage long sys_paccept(int fd, struct sockaddr __user *upeer_sockaddr,
+                           int __user *upeer_addrlen,
+                           const sigset_t __user *sigmask,
+                           size_t sigsetsize, int flags)
+{
+       /* The platform does not support restoring the signal mask in the
+        * return path.  So we do not allow using paccept() with a signal
+        * mask.  */
+       if (sigmask)
+               return -EINVAL;
+
+       return do_accept(fd, upeer_sockaddr, upeer_addrlen, flags);
+}
+#endif
 
 asmlinkage long sys_accept(int fd, struct sockaddr __user *upeer_sockaddr,
                           int __user *upeer_addrlen)