This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix MIPS accept4


sysdeps/unix/sysv/linux/internal_accept4.S expects socket.S to be
present if __NR_socketcall is defined (which it is on MIPS o32, even
though there are separate syscalls as well) and __NR_accept4 isn't.
MIPS does not have socket.S, since it uses separate syscalls, but
though the accept4 syscall should be added soon present kernel headers
do not have it.  This patch creates a dummy internal_accept4.S for
MIPS o32, and an accept4.c wrapper that undefines __NR_socketcall so
that the main accept4.c falls back to the ENOSYS implementation if
__NR_accept4 isn't defined; it doesn't seem worthwhile to have a
special socketcall-based assembly implementation just for o32 on a few
kernels in the range between accept4 being available via socketcall
and the accept4 syscall being available.

I'll apply this patch to 2.10 branch as well since internal_accept4.S was 
added to the libc 2.10 branch.

diff --git a/ChangeLog.mips b/ChangeLog.mips
index 282c65d..9afd961 100644
--- a/ChangeLog.mips
+++ b/ChangeLog.mips
@@ -1,3 +1,8 @@
+2009-08-03  Joseph Myers  <joseph@codesourcery.com>
+
+	* sysdeps/unix/sysv/linux/mips/mips32/accept4.c,
+	sysdeps/unix/sysv/linux/mips/mips32/internal_accept4.S: New.
+
 2009-07-20  Aurelien Jarno  <aurelien@aurel32.net>
 
 	* sysdeps/unix/sysv/linux/mips/kernel-features.h: Define
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/accept4.c b/sysdeps/unix/sysv/linux/mips/mips32/accept4.c
new file mode 100644
index 0000000..98a41f9
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/mips32/accept4.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* Avoid accept4.c trying to use a definition based on the socketcall
+   syscall and internal_accept4.S.  */
+
+#include <errno.h>
+#include <signal.h>
+#include <sys/socket.h>
+
+#include <sysdep-cancel.h>
+#include <sys/syscall.h>
+#include <kernel-features.h>
+
+#undef __NR_socketcall
+
+#include <sysdeps/unix/sysv/linux/accept4.c>
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/internal_accept4.S b/sysdeps/unix/sysv/linux/mips/mips32/internal_accept4.S
new file mode 100644
index 0000000..30434d7
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/mips32/internal_accept4.S
@@ -0,0 +1,2 @@
+/* MIPS does not have socket.S and the socketcall syscall should
+   generally be avoided, though it exists.  */

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]