summaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/sysv')
-rw-r--r--sysdeps/unix/sysv/linux/dl-osinfo.h2
-rw-r--r--sysdeps/unix/sysv/linux/gethostid.c18
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/getcontext.S12
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S10
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/clone.S20
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/socket.S36
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h4
7 files changed, 79 insertions, 23 deletions
diff --git a/sysdeps/unix/sysv/linux/dl-osinfo.h b/sysdeps/unix/sysv/linux/dl-osinfo.h
index 5abc3c47c8..abc67fcdcf 100644
--- a/sysdeps/unix/sysv/linux/dl-osinfo.h
+++ b/sysdeps/unix/sysv/linux/dl-osinfo.h
@@ -65,7 +65,7 @@ dl_fatal (const char *str)
|| (reslen = __read (fd, bufmem, sizeof (bufmem))) <= 0) \
/* This also didn't work. We give up since we cannot \
make sure the library can actually work. */ \
- FATAL ("FATAL: cannot determine library version\n"); \
+ FATAL ("FATAL: cannot determine kernel version\n"); \
__close (fd); \
buf[MIN (reslen, (ssize_t) sizeof (bufmem) - 1)] = '\0'; \
} \
diff --git a/sysdeps/unix/sysv/linux/gethostid.c b/sysdeps/unix/sysv/linux/gethostid.c
index c7f894033d..f44a9afbf2 100644
--- a/sysdeps/unix/sysv/linux/gethostid.c
+++ b/sysdeps/unix/sysv/linux/gethostid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,1996,1998-2001,2003 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1998-2001,2003,2004 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
@@ -33,6 +33,7 @@ sethostid (id)
{
int fd;
ssize_t written;
+ int32_t id32 = id;
/* Test for appropriate rights to set host ID. */
if (__libc_enable_secure)
@@ -41,16 +42,23 @@ sethostid (id)
return -1;
}
+ /* Make sure the ID is not too large. Needed for bi-arch support. */
+ if (id32 != id)
+ {
+ __set_errno (EOVERFLOW);
+ return -1;
+ }
+
/* Open file for writing. Everybody is allowed to read this file. */
fd = open_not_cancel (HOSTIDFILE, O_CREAT|O_WRONLY|O_TRUNC, 0644);
if (fd < 0)
return -1;
- written = write_not_cancel (fd, &id, sizeof (id));
+ written = write_not_cancel (fd, &id32, sizeof (id32));
close_not_cancel_no_status (fd);
- return written != sizeof (id) ? -1 : 0;
+ return written != sizeof (id32) ? -1 : 0;
}
#else
@@ -66,7 +74,7 @@ gethostid ()
size_t buflen;
char *buffer;
struct hostent hostbuf, *hp;
- unsigned long int id;
+ int32_t id;
struct in_addr in;
int herr;
int fd;
@@ -110,6 +118,6 @@ gethostid ()
/* For the return value to be not exactly the IP address we do some
bit fiddling. */
- return in.s_addr << 16 | in.s_addr >> 16;
+ return (int32_t) (in.s_addr << 16 | in.s_addr >> 16);
}
#endif
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/getcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/getcontext.S
index 0f392366eb..61e0f8ed11 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/getcontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/getcontext.S
@@ -125,7 +125,7 @@ ENTRY(__novec_getcontext)
stfd fp26,(SIGCONTEXT_FP_REGS+(PT_R26*8))(r3)
stfd fp27,(SIGCONTEXT_FP_REGS+(PT_R27*8))(r3)
stfd fp28,(SIGCONTEXT_FP_REGS+(PT_R28*8))(r3)
- stfd fp29,(SIGCONTEXT_GP_REGS+(PT_R29*8))(r3)
+ stfd fp29,(SIGCONTEXT_FP_REGS+(PT_R29*8))(r3)
mffs fp0
stfd fp30,(SIGCONTEXT_FP_REGS+(PT_R30*8))(r3)
stfd fp31,(SIGCONTEXT_FP_REGS+(PT_R31*8))(r3)
@@ -263,7 +263,7 @@ ENTRY(__getcontext)
stfd fp26,(SIGCONTEXT_FP_REGS+(PT_R26*8))(r3)
stfd fp27,(SIGCONTEXT_FP_REGS+(PT_R27*8))(r3)
stfd fp28,(SIGCONTEXT_FP_REGS+(PT_R28*8))(r3)
- stfd fp29,(SIGCONTEXT_GP_REGS+(PT_R29*8))(r3)
+ stfd fp29,(SIGCONTEXT_FP_REGS+(PT_R29*8))(r3)
mffs fp0
stfd fp30,(SIGCONTEXT_FP_REGS+(PT_R30*8))(r3)
stfd fp31,(SIGCONTEXT_FP_REGS+(PT_R31*8))(r3)
@@ -275,17 +275,17 @@ ENTRY(__getcontext)
ld r5,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r5)
# else
ld r5,0(r5) /* Load extern _dl_hwcap. */
-# endif
+# endif
la r10,(SIGCONTEXT_V_RESERVE+8)(r3)
la r9,(SIGCONTEXT_V_RESERVE+24)(r3)
-
+
andis. r5,r5,(PPC_FEATURE_HAS_ALTIVEC >> 16)
-
+
clrrdi r10,r10,4
beq L(has_no_vec)
clrrdi r9,r9,4
mr r5,r10 /* Capture *v_regs value in r5. */
-
+
stvx v0,0,r10
stvx v1,0,r9
addi r10,r10,32
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S
index 6644c8abff..f99df951a2 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S
@@ -125,7 +125,7 @@ ENTRY(__novec_swapcontext)
stfd fp26,(SIGCONTEXT_FP_REGS+(PT_R26*8))(r3)
stfd fp27,(SIGCONTEXT_FP_REGS+(PT_R27*8))(r3)
stfd fp28,(SIGCONTEXT_FP_REGS+(PT_R28*8))(r3)
- stfd fp29,(SIGCONTEXT_GP_REGS+(PT_R29*8))(r3)
+ stfd fp29,(SIGCONTEXT_FP_REGS+(PT_R29*8))(r3)
mffs fp0
stfd fp30,(SIGCONTEXT_FP_REGS+(PT_R30*8))(r3)
stfd fp31,(SIGCONTEXT_FP_REGS+(PT_R31*8))(r3)
@@ -386,7 +386,7 @@ ENTRY(__swapcontext)
stfd fp26,(SIGCONTEXT_FP_REGS+(PT_R26*8))(r3)
stfd fp27,(SIGCONTEXT_FP_REGS+(PT_R27*8))(r3)
stfd fp28,(SIGCONTEXT_FP_REGS+(PT_R28*8))(r3)
- stfd fp29,(SIGCONTEXT_GP_REGS+(PT_R29*8))(r3)
+ stfd fp29,(SIGCONTEXT_FP_REGS+(PT_R29*8))(r3)
mffs fp0
stfd fp30,(SIGCONTEXT_FP_REGS+(PT_R30*8))(r3)
stfd fp31,(SIGCONTEXT_FP_REGS+(PT_R31*8))(r3)
@@ -401,12 +401,12 @@ ENTRY(__swapcontext)
#endif
la r10,(SIGCONTEXT_V_RESERVE+8)(r3)
la r9,(SIGCONTEXT_V_RESERVE+24)(r3)
-
+
andis. r8,r8,(PPC_FEATURE_HAS_ALTIVEC >> 16)
clrrdi r10,r10,4
beq L(has_no_vec)
-
+
clrrdi r9,r9,4
mr r8,r10 /* Capture *v_regs value in r5. */
@@ -493,7 +493,7 @@ ENTRY(__swapcontext)
mfvscr v0
mfspr r0,VRSAVE
stvx v0,0,r10
- stw r0,0(9)
+ stw r0,0(r9)
L(has_no_vec):
/*
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S b/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S
index 5bebe35628..66cdbf3ca7 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S
@@ -1,4 +1,5 @@
-/* Copyright (C) 1996, 1997, 1998, 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998, 2000, 2003, 2004
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (rth@tamu.edu).
@@ -22,6 +23,10 @@
#include <asm/errno.h>
#include <asm/unistd.h>
+#include <tcb-offsets.h>
+
+#define CLONE_VM 0x00000100
+#define CLONE_THREAD 0x00010000
/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg,
pid_t *ptid, void *tls, pid_t *ctid); */
@@ -69,6 +74,19 @@ __clone:
.type __thread_start,@function
__thread_start:
+#ifdef RESET_PID
+ sethi %hi(CLONE_THREAD), %l0
+ andcc %i2, %l0, %g0
+ bne 1f
+ andcc %i2, CLONE_VM, %g0
+ bne,a 2f
+ mov -1,%o0
+ set __NR_getpid,%g1
+ ta 0x10
+2: st %o0,[%g7 + PID]
+ st %o0,[%g7 + TID]
+1:
+#endif
call %i0
mov %i3,%o0
call _exit,0
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/socket.S b/sysdeps/unix/sysv/linux/sparc/sparc64/socket.S
index 750c1258ed..575416ff3f 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/socket.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/socket.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 2002, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Miguel de Icaza <miguel@gnu.ai.mit.edu>, 1997.
@@ -17,7 +17,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)
@@ -63,7 +63,12 @@ ENTRY (__socket)
#endif
#endif
- mov P(SOCKOP_,socket), %o0 /* arg 1: socket subfunction */
+#if defined NEED_CANCELLATION && defined CENABLE
+ SINGLE_THREAD_P
+ cmp %g1, 0
+ bne .Lsocket_cancel
+#endif
+ mov P(SOCKOP_,socket), %o0 /* arg 1: socket subfunction */
add %sp, STACK_BIAS + 128, %o1 /* arg 2: parameter block */
LOADSYSCALL(socketcall)
ta 0x6d
@@ -73,6 +78,31 @@ ENTRY (__socket)
retl
nop
+#if defined NEED_CANCELLATION && defined CENABLE
+.Lsocket_cancel:
+ cfi_startproc
+ save %sp, -160, %sp
+ cfi_def_cfa_register (%fp)
+ cfi_window_save
+ cfi_register (%o7, %i7)
+ CENABLE
+ nop
+ mov %o0, %l0
+ add %sp, 160 + STACK_BIAS + 128, %o1
+ mov P(SOCKOP_,socket), %o0
+ LOADSYSCALL(socketcall)
+ ta 0x6d
+
+ bcs,pn %xcc, __syscall_error_handler2
+ mov %o0, %l1
+ CDISABLE
+ mov %l0, %o0
+ jmpl %i7 + 8, %g0
+ restore %g0, %l1, %o0
+ cfi_endproc
+ SYSCALL_ERROR_HANDLER2
+#endif
+
SYSCALL_ERROR_HANDLER
END (__socket)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h
index 37a68aaeba..3c6492aeca 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 2000, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson <richard@gnu.ai.mit.edu>, 1997.
@@ -85,7 +85,7 @@ SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler) \
sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %l7; \
call __sparc64.get_pic.l7; \
add %l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7; \
- ldx [%l7 + errno], %l0; \
+ ldx [%l7 + rtld_errno], %l0; \
st %i0, [%l0]; \
jmpl %i7+8, %g0; \
restore %g0, -1, %o0; \