about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@suse.de>2002-12-27 22:15:56 +0000
committerAndreas Schwab <schwab@suse.de>2002-12-27 22:15:56 +0000
commit4f172c25f1c39e86b433075d36f3e6c19e06f136 (patch)
tree9d325e034d5c7125028d6da3fceae77fb1caf6df
parent9f2567656cc8feb171bf241c06f378d57dc1cd1f (diff)
downloadglibc-4f172c25f1c39e86b433075d36f3e6c19e06f136.tar.gz
glibc-4f172c25f1c39e86b433075d36f3e6c19e06f136.tar.xz
glibc-4f172c25f1c39e86b433075d36f3e6c19e06f136.zip
*** empty log message ***
2002-12-27  Andreas Schwab  <schwab@suse.de>

	* sysdeps/unix/sysv/linux/m68k/socket.S: Add cancellation support. 
-rw-r--r--ChangeLog4
-rw-r--r--linuxthreads/sysdeps/unix/sysv/linux/m68k/sysdep-cancel.h1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/socket.S42
3 files changed, 46 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index f24dbc3a75..28503a9ec6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2002-12-27  Andreas Schwab  <schwab@suse.de>
+
+	* sysdeps/unix/sysv/linux/m68k/socket.S: Add cancellation support. 
+
 2002-12-27  Jakub Jelinek  <jakub@redhat.com>
 
 	* malloc/arena.c (ptmalloc_init): Don't call next_env_entry if
diff --git a/linuxthreads/sysdeps/unix/sysv/linux/m68k/sysdep-cancel.h b/linuxthreads/sysdeps/unix/sysv/linux/m68k/sysdep-cancel.h
index 1f1f65fa4d..fb6e92c37a 100644
--- a/linuxthreads/sysdeps/unix/sysv/linux/m68k/sysdep-cancel.h
+++ b/linuxthreads/sysdeps/unix/sysv/linux/m68k/sysdep-cancel.h
@@ -37,6 +37,7 @@
   .Lpseudo_cancel:							      \
     CENABLE;								      \
     DOCARGS_##args							      \
+    move.l %d0, -(%sp);							      \
     move.l &SYS_ify (syscall_name), %d0;				      \
     trap &0;								      \
     move.l %d0, %d2;							      \
diff --git a/sysdeps/unix/sysv/linux/m68k/socket.S b/sysdeps/unix/sysv/linux/m68k/socket.S
index 3592d2a580..1d10f33e17 100644
--- a/sysdeps/unix/sysv/linux/m68k/socket.S
+++ b/sysdeps/unix/sysv/linux/m68k/socket.S
@@ -16,7 +16,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include <sysdep.h>
+#include <sysdep-cancel.h>
 #include <socketcall.h>
 
 #define P(a, b) P2(a, b)
@@ -41,6 +41,10 @@
 
 .globl __socket
 ENTRY (__socket)
+#if defined NEED_CANCELLATION && defined CENABLE
+	SINGLE_THREAD_P
+	jne 1f
+#endif
 
 	/* Save registers.  */
 	move.l %d2, %a0
@@ -64,6 +68,42 @@ ENTRY (__socket)
 
 	/* Successful; return the syscall's value.  */
 	rts
+
+#if defined NEED_CANCELLATION && defined CENABLE
+1:	/* Enable asynchronous cancellation.  */
+	CENABLE
+
+	/* Save registers.  */
+	move.l %d2, -(%sp)
+	move.l %d0, -(%sp)
+
+	move.l #SYS_ify (socketcall), %d0 /* System call number in %d0.  */
+
+	/* Use ## so `socket' is a separate token that might be #define'd.  */
+	move.l #P (SOCKOP_,socket), %d1	/* Subcode is first arg to syscall.  */
+	lea 4+8(%sp), %a1		/* Address of args is 2nd arg.  */
+	move.l %a1, %d2
+
+	/* Do the system call trap.  */
+	trap #0
+
+	/* Restore cancellation.  */
+	move.l %d0, %d2
+	CDISABLE
+	addq.l #4, %sp
+	move.l %d2, %d0
+
+	/* Restore registers.  */
+	move.l (%sp)+, %d2
+
+	/* %d0 is < 0 if there was an error.  */
+	tst.l %d0
+	jmi SYSCALL_ERROR_LABEL
+
+	/* Successful; return the syscall's value.  */
+	rts
+#endif
+	
 PSEUDO_END (__socket)
 
 #ifndef NO_WEAK_ALIAS