[uClibc-cvs] svn commit: trunk/uClibc/libc/sysdeps/linux/sparc

vapier at uclibc.org vapier at uclibc.org
Sat Jul 9 00:57:49 UTC 2005


Author: vapier
Date: 2005-07-08 18:57:49 -0600 (Fri, 08 Jul 2005)
New Revision: 10772

Log:
import the __syscall_error trick for errno handling

Added:
   trunk/uClibc/libc/sysdeps/linux/sparc/__syscall_error.c

Modified:
   trunk/uClibc/libc/sysdeps/linux/sparc/Makefile
   trunk/uClibc/libc/sysdeps/linux/sparc/clone.S


Changeset:
Modified: trunk/uClibc/libc/sysdeps/linux/sparc/Makefile
===================================================================
--- trunk/uClibc/libc/sysdeps/linux/sparc/Makefile	2005-07-09 00:54:07 UTC (rev 10771)
+++ trunk/uClibc/libc/sysdeps/linux/sparc/Makefile	2005-07-09 00:57:49 UTC (rev 10772)
@@ -27,7 +27,7 @@
 	urem.S udiv.S umul.S sdiv.S rem.S
 SOBJS=$(patsubst %.S,%.o, $(SSRC))
 
-CSRC=brk.c
+CSRC=brk.c __syscall_error.c
 COBJS=$(patsubst %.c,%.o, $(CSRC))
 
 OBJS=$(SOBJS) $(MOBJ) $(COBJS)

Added: trunk/uClibc/libc/sysdeps/linux/sparc/__syscall_error.c
===================================================================
--- trunk/uClibc/libc/sysdeps/linux/sparc/__syscall_error.c	2005-07-09 00:54:07 UTC (rev 10771)
+++ trunk/uClibc/libc/sysdeps/linux/sparc/__syscall_error.c	2005-07-09 00:57:49 UTC (rev 10772)
@@ -0,0 +1,29 @@
+/* Wrapper for setting errno.
+   Copyright (C) 1997, 1998, 1999, 2000 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.  */
+
+#include <errno.h>
+#include <features.h>
+
+/* This routine is jumped to by all the syscall handlers, to stash
+ * an error number into errno.  */
+int attribute_hidden __syscall_error(int err_no)
+{
+	__set_errno(err_no);
+	return -1;
+}

Modified: trunk/uClibc/libc/sysdeps/linux/sparc/clone.S
===================================================================
--- trunk/uClibc/libc/sysdeps/linux/sparc/clone.S	2005-07-09 00:54:07 UTC (rev 10771)
+++ trunk/uClibc/libc/sysdeps/linux/sparc/clone.S	2005-07-09 00:57:49 UTC (rev 10772)
@@ -20,7 +20,6 @@
 /* clone() is even more special than fork() as it mucks with stacks
    and invokes a function in the right context after its all over.  */
 
-#include <asm/errno.h>
 #include <asm/unistd.h>
 
 /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
@@ -35,27 +34,23 @@
 
 	/* sanity check arguments */
 	tst	%i0
-	be	.Lerror
+	be	__error
 	orcc	%i1,%g0,%o1
-	be	.Lerror
+	be	__error
 	mov	%i2,%o0
 
 	/* Do the system call */
 	set	__NR_clone,%g1
 	ta	0x10
-	bcs	.Lerror
+	bcs	__error
 	tst	%o1
 	bne	__thread_start
 	nop
 	ret
 	restore %o0,%g0,%o0
 
-.Lerror:
-	call	__errno_location
-	or	%g0,EINVAL,%i0
-	st	%i0,[%o0]
-	ret
-	restore %g0,-1,%o0
+__error:
+	jmp __syscall_error
 
 .size __clone,.-__clone
 




More information about the uClibc-cvs mailing list