diff options
author | Jakub Jelinek <jakub@redhat.com> | 2005-02-08 10:05:09 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2005-02-08 10:05:09 +0000 |
commit | d585b66fa4d11059948f466c9080a6826932358d (patch) | |
tree | 8b06692920852c297635b46a7d616c3066f95fac /sysdeps/unix/sysv | |
parent | e7cbcee4982d8caa809a91c9cfef5fda67445f0a (diff) | |
download | glibc-d585b66fa4d11059948f466c9080a6826932358d.tar glibc-d585b66fa4d11059948f466c9080a6826932358d.tar.gz glibc-d585b66fa4d11059948f466c9080a6826932358d.tar.bz2 glibc-d585b66fa4d11059948f466c9080a6826932358d.zip |
Updated to fedora-glibc-20050208T0948cvs/fedora-glibc-2_3_4-6
Diffstat (limited to 'sysdeps/unix/sysv')
-rw-r--r-- | sysdeps/unix/sysv/linux/alpha/oldglob.c | 3 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/dl-execstack.c | 26 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/futimes.c | 66 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/sysdep.h | 37 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/init-first.c | 1 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/kernel-features.h | 7 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S | 10 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S | 10 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/syslog.c | 10 |
9 files changed, 130 insertions, 40 deletions
diff --git a/sysdeps/unix/sysv/linux/alpha/oldglob.c b/sysdeps/unix/sysv/linux/alpha/oldglob.c index 9d39176f6b..6d9b79f2c3 100644 --- a/sysdeps/unix/sysv/linux/alpha/oldglob.c +++ b/sysdeps/unix/sysv/linux/alpha/oldglob.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998, 2000, 2004 Free Software Foundation, Inc. +/* Copyright (C) 1998, 2000, 2004, 2005 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 @@ -91,6 +91,7 @@ __old_globfree (old_glob_t *pglob) /* We only need these two symbols. */ correct.gl_pathc = pglob->gl_pathc; correct.gl_pathv = pglob->gl_pathv; + correct.gl_offs = pglob->gl_offs; globfree (&correct); } diff --git a/sysdeps/unix/sysv/linux/dl-execstack.c b/sysdeps/unix/sysv/linux/dl-execstack.c index 6ef9679045..b38d0c4238 100644 --- a/sysdeps/unix/sysv/linux/dl-execstack.c +++ b/sysdeps/unix/sysv/linux/dl-execstack.c @@ -1,5 +1,5 @@ /* Stack executability handling for GNU dynamic linker. Linux version. - Copyright (C) 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 2003, 2004, 2005 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 @@ -24,6 +24,7 @@ #include <stdbool.h> #include <stackinfo.h> #include <caller.h> +#include <sysdep.h> #include "kernel-features.h" @@ -38,6 +39,7 @@ _dl_make_stack_executable (void **stack_endp) /* This gives us the highest/lowest page that needs to be changed. */ uintptr_t page = ((uintptr_t) *stack_endp & -(intptr_t) GLRO(dl_pagesize)); + int result = 0; /* Challenge the caller. */ if (__builtin_expect (__check_caller (RETURN_ADDRESS (0), @@ -60,7 +62,10 @@ _dl_make_stack_executable (void **stack_endp) no_growsupdown = true; else # endif - return errno; + { + result = errno; + goto out; + } } #endif @@ -85,7 +90,10 @@ _dl_make_stack_executable (void **stack_endp) else { if (errno != ENOMEM) /* Unexpected failure mode. */ - return errno; + { + result = errno; + goto out; + } if (size == GLRO(dl_pagesize)) /* We just tried to mprotect the top hole page and failed. @@ -108,7 +116,10 @@ _dl_make_stack_executable (void **stack_endp) else { if (errno != ENOMEM) /* Unexpected failure mode. */ - return errno; + { + result = errno; + goto out; + } if (size == GLRO(dl_pagesize)) /* We just tried to mprotect the lowest hole page and failed. @@ -133,6 +144,11 @@ _dl_make_stack_executable (void **stack_endp) /* Remember that we changed the permission. */ GL(dl_stack_flags) |= PF_X; - return 0; + out: +#ifdef check_consistency + check_consistency (); +#endif + + return result; } rtld_hidden_def (_dl_make_stack_executable) diff --git a/sysdeps/unix/sysv/linux/futimes.c b/sysdeps/unix/sysv/linux/futimes.c index f43f568ec1..0c4be2b67f 100644 --- a/sysdeps/unix/sysv/linux/futimes.c +++ b/sysdeps/unix/sysv/linux/futimes.c @@ -1,5 +1,5 @@ /* futimes -- change access and modification times of open file. Linux version. - Copyright (C) 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2005 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 @@ -23,6 +23,7 @@ #include <utime.h> #include <sys/time.h> #include <stdio-common/_itoa.h> +#include <fcntl.h> #include "kernel-features.h" @@ -40,31 +41,58 @@ __futimes (int fd, const struct timeval tvp[2]) char *cp = _itoa_word ((unsigned int) fd, fname + sizeof (fname) - 1, 10, 0); cp = memcpy (cp - sizeof (selffd) + 1, selffd, sizeof (selffd) - 1); + int result; #ifdef __NR_utimes - int result = INLINE_SYSCALL (utimes, 2, cp, tvp); + result = INLINE_SYSCALL (utimes, 2, cp, tvp); # ifndef __ASSUME_UTIMES - if (result != -1 || errno != ENOSYS) + if (result == -1 && errno == ENOSYS) # endif - return result; #endif - - /* The utimes() syscall does not exist or is not available in the - used kernel. Use utime(). For this we have to convert to the - data format utime() expects. */ + { + /* The utimes() syscall does not exist or is not available in the + used kernel. Use utime(). For this we have to convert to the + data format utime() expects. */ #ifndef __ASSUME_UTIMES - struct utimbuf buf; - struct utimbuf *times; + struct utimbuf buf; + struct utimbuf *times; - if (tvp != NULL) - { - times = &buf; - buf.actime = tvp[0].tv_sec + (tvp[0].tv_usec + 500000) / 1000000; - buf.modtime = tvp[1].tv_sec + (tvp[1].tv_usec + 500000) / 1000000; - } - else - times = NULL; + if (tvp != NULL) + { + times = &buf; + buf.actime = tvp[0].tv_sec + (tvp[0].tv_usec + 500000) / 1000000; + buf.modtime = tvp[1].tv_sec + (tvp[1].tv_usec + 500000) / 1000000; + } + else + times = NULL; - return INLINE_SYSCALL (utime, 2, cp, times); + result = INLINE_SYSCALL (utime, 2, cp, times); #endif + } + + if (result == -1) + /* Check for errors that result from failing to find /proc. + This means we can't do futimes at all, so return ENOSYS + rather than some confusing error. */ + switch (errno) + { + case EACCES: + if (tvp == NULL) /* Could be a path problem or a file problem. */ + break; + /*FALLTHROUGH*/ + case ELOOP: + case ENAMETOOLONG: + case ENOTDIR: + __set_errno (ENOSYS); + break; + + case ENOENT: + /* Validate the file descriptor by letting fcntl set errno to + EBADF if it's bogus. Otherwise it's a /proc issue. */ + if (INLINE_SYSCALL (fcntl, 3, fd, F_GETFD, 0) != -1) + __set_errno (ENOSYS); + break; + } + + return result; } weak_alias (__futimes, futimes) diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h index af75d4c51a..6bea9d2044 100644 --- a/sysdeps/unix/sysv/linux/i386/sysdep.h +++ b/sysdeps/unix/sysv/linux/i386/sysdep.h @@ -1,5 +1,5 @@ -/* Copyright (C) 1992,1993,1995-2000,2002,2003,2004 - Free Software Foundation, Inc. +/* Copyright (C) 1992,1993,1995,1996,1997,1998,1999,2000,2002,2003,2004,2005 + Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper, <drepper@gnu.org>, August 1995. @@ -154,9 +154,17 @@ __i686.get_pc_thunk.reg: \ movl SYSCALL_ERROR_ERRNO@GOTNTPOFF(%ecx), %ecx; \ xorl %edx, %edx; \ subl %eax, %edx; \ - movl %edx, %gs:0(%ecx); \ + SYSCALL_ERROR_HANDLER_TLS_STORE (%edx, %ecx); \ orl $-1, %eax; \ jmp L(pseudo_end); +# ifndef NO_TLS_DIRECT_SEG_REFS +# define SYSCALL_ERROR_HANDLER_TLS_STORE(src, destoff) \ + movl src, %gs:(destoff) +# else +# define SYSCALL_ERROR_HANDLER_TLS_STORE(src, destoff) \ + addl %gs:0, destoff; \ + movl src, (destoff) +# endif # else # define SYSCALL_ERROR_HANDLER \ 0:pushl %ebx; \ @@ -532,6 +540,29 @@ asm (".L__X'%ebx = 1\n\t" # define EXTRAVAR_5 #endif +/* Consistency check for position-independent code. */ +#ifdef __PIC__ +# define check_consistency() \ + ({ int __res; \ + __asm__ __volatile__ \ + ("call __i686.get_pc_thunk.cx;" \ + "addl $_GLOBAL_OFFSET_TABLE_, %%ecx;" \ + "subl %%ebx, %%ecx;" \ + "je 1f;" \ + "ud2;" \ + "1:\n" \ + ".section .gnu.linkonce.t.__i686.get_pc_thunk.cx,\"ax\",@progbits;" \ + ".globl __i686.get_pc_thunk.cx;" \ + ".hidden __i686.get_pc_thunk.cx;" \ + ".type __i686.get_pc_thunk.cx,@function;" \ + "__i686.get_pc_thunk.cx:" \ + "movl (%%esp), %%ecx;" \ + "ret;" \ + ".previous" \ + : "=c" (__res)); \ + __res; }) +#endif + #endif /* __ASSEMBLER__ */ #endif /* linux/i386/sysdep.h */ diff --git a/sysdeps/unix/sysv/linux/init-first.c b/sysdeps/unix/sysv/linux/init-first.c index 7f0b963cb7..b061a848c6 100644 --- a/sysdeps/unix/sysv/linux/init-first.c +++ b/sysdeps/unix/sysv/linux/init-first.c @@ -40,7 +40,6 @@ char **__libc_argv attribute_hidden; void -attribute_hidden __libc_init_first (int argc, char **argv, char **envp) { #ifdef SHARED diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h index f499a712c4..83ebe0cf74 100644 --- a/sysdeps/unix/sysv/linux/kernel-features.h +++ b/sysdeps/unix/sysv/linux/kernel-features.h @@ -1,6 +1,6 @@ /* Set flags signalling availability of kernel features based on given kernel version number. - Copyright (C) 1999-2003, 2004 Free Software Foundation, Inc. + Copyright (C) 1999-2003, 2004, 2005 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 @@ -79,6 +79,11 @@ # define __ASSUME_SIOCGIFNAME 1 #endif +/* MSG_NOSIGNAL was at least available with Linux 2.2.0. */ +#if __LINUX_KERNEL_VERSION >= 131584 +# define __ASSUME_MSG_NOSIGNAL 1 +#endif + /* On x86 another `getrlimit' syscall was added in 2.3.25. */ #if __LINUX_KERNEL_VERSION >= 131865 && defined __i386__ # define __ASSUME_NEW_GETRLIMIT_SYSCALL 1 diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S index 6514f442a6..7eaaad20a4 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S @@ -1,5 +1,5 @@ /* Switch to context. - Copyright (C) 2002, 2004 Free Software Foundation, Inc. + Copyright (C) 2002, 2004, 2005 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 @@ -47,7 +47,7 @@ ENTRY(__novec_setcontext) * of a procedure call (makecontext), so we don't need to restore * msr and ctr. We don't restore r13 since it will be used as * the TLS pointer. */ - lwz r0,(SIGCONTEXT_GP_REGS+(PT_MSR*8))(r31) + ld r0,(SIGCONTEXT_GP_REGS+(PT_MSR*8))(r31) cmpdi r0,0 bne L(nv_do_sigret) @@ -104,7 +104,7 @@ ENTRY(__novec_setcontext) ld r4,(SIGCONTEXT_GP_REGS+(PT_R4*8))(r31) ld r0,(SIGCONTEXT_GP_REGS+(PT_CCR*8))(r31) ld r5,(SIGCONTEXT_GP_REGS+(PT_R5*8))(r31) - mfcr r0 + mtcr r0 ld r6,(SIGCONTEXT_GP_REGS+(PT_R6*8))(r31) ld r7,(SIGCONTEXT_GP_REGS+(PT_R7*8))(r31) ld r8,(SIGCONTEXT_GP_REGS+(PT_R8*8))(r31) @@ -213,7 +213,7 @@ ENTRY(__setcontext) * of a procedure call (makecontext), so we don't need to restore * msr and ctr. We don't restore r13 since it will be used as * the TLS pointer. */ - lwz r0,(SIGCONTEXT_GP_REGS+(PT_MSR*8))(r31) + ld r0,(SIGCONTEXT_GP_REGS+(PT_MSR*8))(r31) cmpdi r0,0 bne L(do_sigret) @@ -380,11 +380,11 @@ L(has_no_vec): ld r4,(SIGCONTEXT_GP_REGS+(PT_R4*8))(r31) ld r0,(SIGCONTEXT_GP_REGS+(PT_CCR*8))(r31) ld r5,(SIGCONTEXT_GP_REGS+(PT_R5*8))(r31) - mfcr r0 ld r6,(SIGCONTEXT_GP_REGS+(PT_R6*8))(r31) ld r7,(SIGCONTEXT_GP_REGS+(PT_R7*8))(r31) ld r8,(SIGCONTEXT_GP_REGS+(PT_R8*8))(r31) ld r9,(SIGCONTEXT_GP_REGS+(PT_R9*8))(r31) + mtcr r0 ld r10,(SIGCONTEXT_GP_REGS+(PT_R10*8))(r31) ld r11,(SIGCONTEXT_GP_REGS+(PT_R11*8))(r31) ld r12,(SIGCONTEXT_GP_REGS+(PT_R12*8))(r31) diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S index f99df951a2..772adacfe4 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S @@ -1,5 +1,5 @@ /* Save current context and install the given one. - Copyright (C) 2002, 2004 Free Software Foundation, Inc. + Copyright (C) 2002, 2004, 2005 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 @@ -150,7 +150,7 @@ ENTRY(__novec_swapcontext) * of a procedure call (makecontext), so we don't need to restore * msr and ctr. We don't restore r13 since it will be used as * the TLS pointer. */ - lwz r0,(SIGCONTEXT_GP_REGS+(PT_MSR*8))(r31) + ld r0,(SIGCONTEXT_GP_REGS+(PT_MSR*8))(r31) cmpdi r0,0 bne L(nv_do_sigret) @@ -199,7 +199,7 @@ ENTRY(__novec_swapcontext) ld r4,(SIGCONTEXT_GP_REGS+(PT_R4*8))(r31) ld r0,(SIGCONTEXT_GP_REGS+(PT_CCR*8))(r31) ld r5,(SIGCONTEXT_GP_REGS+(PT_R5*8))(r31) - mfcr r0 + mtcr r0 ld r6,(SIGCONTEXT_GP_REGS+(PT_R6*8))(r31) ld r7,(SIGCONTEXT_GP_REGS+(PT_R7*8))(r31) ld r8,(SIGCONTEXT_GP_REGS+(PT_R8*8))(r31) @@ -521,7 +521,7 @@ L(has_no_vec): * of a procedure call (makecontext), so we don't need to restore * msr and ctr. We don't restore r13 since it will be used as * the TLS pointer. */ - lwz r0,(SIGCONTEXT_GP_REGS+(PT_MSR*8))(r31) + ld r0,(SIGCONTEXT_GP_REGS+(PT_MSR*8))(r31) cmpdi r0,0 bne L(do_sigret) @@ -681,11 +681,11 @@ L(has_no_vec2): ld r4,(SIGCONTEXT_GP_REGS+(PT_R4*8))(r31) ld r0,(SIGCONTEXT_GP_REGS+(PT_CCR*8))(r31) ld r5,(SIGCONTEXT_GP_REGS+(PT_R5*8))(r31) - mfcr r0 ld r6,(SIGCONTEXT_GP_REGS+(PT_R6*8))(r31) ld r7,(SIGCONTEXT_GP_REGS+(PT_R7*8))(r31) ld r8,(SIGCONTEXT_GP_REGS+(PT_R8*8))(r31) ld r9,(SIGCONTEXT_GP_REGS+(PT_R9*8))(r31) + mtcr r0 ld r10,(SIGCONTEXT_GP_REGS+(PT_R10*8))(r31) ld r11,(SIGCONTEXT_GP_REGS+(PT_R11*8))(r31) ld r12,(SIGCONTEXT_GP_REGS+(PT_R12*8))(r31) diff --git a/sysdeps/unix/sysv/linux/syslog.c b/sysdeps/unix/sysv/linux/syslog.c new file mode 100644 index 0000000000..eaaa9839dc --- /dev/null +++ b/sysdeps/unix/sysv/linux/syslog.c @@ -0,0 +1,10 @@ +#include "kernel-features.h" + +#if __ASSUME_MSG_NOSIGNAL +# define NO_SIGPIPE +# define send_flags MSG_NOSIGNAL +#else +# define send_flags 0 +#endif + +#include <sysdeps/generic/syslog.c> |