diff options
Diffstat (limited to 'sysdeps/unix/sysv')
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/dl-cache.h | 59 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/ia64/dl-cache.h | 27 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/ia64/dl-procinfo.c | 5 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/ia64/dl-procinfo.h | 5 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/ia64/ldd-rewrite.sed | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/paths.h | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h | 17 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h | 17 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/sparc/sparc32/setresgid.c | 1 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/sparc/sparc32/setresuid.c | 1 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/sparc/sysdep.h | 22 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/tcsetattr.c | 32 |
12 files changed, 172 insertions, 18 deletions
diff --git a/sysdeps/unix/sysv/linux/i386/dl-cache.h b/sysdeps/unix/sysv/linux/i386/dl-cache.h new file mode 100644 index 0000000000..38a1c7dfb4 --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/dl-cache.h @@ -0,0 +1,59 @@ +/* Support for reading /etc/ld.so.cache files written by Linux ldconfig. + Copyright (C) 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 + 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. */ + +static inline int +is_ia64 (void) +{ + unsigned int fl1, fl2; + + /* See if we can use cpuid. */ + __asm__ ("pushfl; pushfl; popl %0; movl %0,%1; xorl %2,%0;" + "pushl %0; popfl; pushfl; popl %0; popfl" + : "=&r" (fl1), "=&r" (fl2) + : "i" (0x00200000)); + if (((fl1 ^ fl2) & 0x00200000) == 0) + return 0; + + /* Host supports cpuid. See if cpuid gives capabilities, try + CPUID(0). Preserve %ebx and %ecx; cpuid insn clobbers these, we + don't need their CPUID values here, and %ebx may be the PIC + register. */ + __asm__ ("pushl %%ecx; pushl %%ebx; cpuid; popl %%ebx; popl %%ecx" + : "=a" (fl1) : "0" (0) : "edx", "cc"); + if (fl1 == 0) + return 0; + + /* Invoke CPUID(1), return %edx; caller can examine bits to + determine what's supported. */ + __asm__ ("pushl %%ecx; pushl %%ebx; cpuid; popl %%ebx; popl %%ecx" + : "=d" (fl2), "=a" (fl1) : "1" (1) : "cc"); + return (fl2 & (1 << 30)) != 0; +} + +#define arch_startup(argc, argv) \ + do { \ + /* On IA-64, try to execute 64-bit ldconfig if possible. \ + This is because the badly designed /emul/ia32-linux hack \ + will cause 32-bit ldconfig to do all sorts of weird things. */ \ + if (is_ia64 ()) \ + execv ("/emul/ia32-linux/../../sbin/ldconfig", \ + (char *const *) argv); \ + } while (0) + +#include_next <dl-cache.h> diff --git a/sysdeps/unix/sysv/linux/ia64/dl-cache.h b/sysdeps/unix/sysv/linux/ia64/dl-cache.h index b8e2790589..c2165706c0 100644 --- a/sysdeps/unix/sysv/linux/ia64/dl-cache.h +++ b/sysdeps/unix/sysv/linux/ia64/dl-cache.h @@ -22,4 +22,31 @@ #define _dl_cache_check_flags(flags) \ ((flags) == _DL_CACHE_DEFAULT_ID) +#define EMUL_HACK "/emul/ia32-linux" + +#define arch_startup(argc, argv) unlink (EMUL_HACK LD_SO_CACHE) + +#define add_arch_dirs(config_file) \ + do { \ + int save_verbose = opt_verbose; \ + opt_verbose = 0; \ + \ + parse_conf (config_file, EMUL_HACK, true); \ + \ + /* Always add the standard search paths. */ \ + add_system_dir (EMUL_HACK SLIBDIR); \ + if (strcmp (SLIBDIR, LIBDIR)) \ + add_system_dir (EMUL_HACK LIBDIR); \ + \ + char emul_config_file[strlen (config_file) \ + + sizeof EMUL_HACK]; \ + strcpy (mempcpy (emul_config_file, EMUL_HACK, \ + strlen (EMUL_HACK)), config_file); \ + \ + if (! access (emul_config_file, R_OK)) \ + parse_conf (emul_config_file, EMUL_HACK, true); \ + \ + opt_verbose = save_verbose; \ + } while (0) + #include_next <dl-cache.h> diff --git a/sysdeps/unix/sysv/linux/ia64/dl-procinfo.c b/sysdeps/unix/sysv/linux/ia64/dl-procinfo.c new file mode 100644 index 0000000000..7e26fecb3a --- /dev/null +++ b/sysdeps/unix/sysv/linux/ia64/dl-procinfo.c @@ -0,0 +1,5 @@ +#ifdef IS_IN_ldconfig +#include <sysdeps/i386/dl-procinfo.c> +#else +#include <sysdeps/generic/dl-procinfo.c> +#endif diff --git a/sysdeps/unix/sysv/linux/ia64/dl-procinfo.h b/sysdeps/unix/sysv/linux/ia64/dl-procinfo.h new file mode 100644 index 0000000000..b360b4288a --- /dev/null +++ b/sysdeps/unix/sysv/linux/ia64/dl-procinfo.h @@ -0,0 +1,5 @@ +#ifdef IS_IN_ldconfig +#include <sysdeps/unix/sysv/linux/i386/dl-procinfo.h> +#else +#include <sysdeps/generic/dl-procinfo.h> +#endif diff --git a/sysdeps/unix/sysv/linux/ia64/ldd-rewrite.sed b/sysdeps/unix/sysv/linux/ia64/ldd-rewrite.sed index 535d1671e3..1df27afd2d 100644 --- a/sysdeps/unix/sysv/linux/ia64/ldd-rewrite.sed +++ b/sysdeps/unix/sysv/linux/ia64/ldd-rewrite.sed @@ -1 +1 @@ -s_^\(RTLDLIST=\)\([^ ]*\)-ia64\(\.so\.[0-9.]*\)[ ]*$_\1"\2-ia64\3 \2\3"_ +s_^\(RTLDLIST=\)\([^ ]*\)-ia64\(\.so\.[0-9.]*\)[ ]*$_\1"\2-ia64\3 /emul/ia32-linux\2\3"_ diff --git a/sysdeps/unix/sysv/linux/paths.h b/sysdeps/unix/sysv/linux/paths.h index fb2c77e99b..a87831e74a 100644 --- a/sysdeps/unix/sysv/linux/paths.h +++ b/sysdeps/unix/sysv/linux/paths.h @@ -61,7 +61,7 @@ #define _PATH_TTY "/dev/tty" #define _PATH_UNIX "/boot/vmlinux" #define _PATH_UTMP "/var/run/utmp" -#define _PATH_VI "/usr/bin/vi" +#define _PATH_VI "/bin/vi" #define _PATH_WTMP "/var/log/wtmp" /* Provide trailing slash, since mostly used for building pathnames. */ diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h index d759e4a664..55a2cd7443 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h +++ b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000,01,02,03 Free Software Foundation, Inc. +/* Copyright (C) 2000,01,02,03,04 Free Software Foundation, Inc. Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). This file is part of the GNU C Library. @@ -207,7 +207,20 @@ asm volatile ( \ "svc 0\n\t" \ : "=d" (_ret) \ - : "d" (_nr), "i" (__NR_##name) ASMFMT_##nr \ + : "d" (_nr) ASMFMT_##nr \ + : "memory" ); \ + _ret; }) + +#undef INTERNAL_SYSCALL_NCS +#define INTERNAL_SYSCALL_NCS(no, err, nr, args...) \ + ({ \ + DECLARGS_##nr(args) \ + register unsigned long _nr asm("1") = (unsigned long)(no); \ + register int _ret asm("2"); \ + asm volatile ( \ + "svc 0\n\t" \ + : "=d" (_ret) \ + : "d" (_nr) ASMFMT_##nr \ : "memory" ); \ _ret; }) diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h index f0d7cbe2d9..c7f3a03f26 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h +++ b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h @@ -1,5 +1,5 @@ /* Assembler macros for 64 bit S/390. - Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). This file is part of the GNU C Library. @@ -209,7 +209,20 @@ asm volatile ( \ "svc 0\n\t" \ : "=d" (_ret) \ - : "d" (_nr), "i" (__NR_##name) ASMFMT_##nr \ + : "d" (_nr) ASMFMT_##nr \ + : "memory" ); \ + _ret; }) + +#undef INTERNAL_SYSCALL_NCS +#define INTERNAL_SYSCALL_NCS(no, err, nr, args...) \ + ({ \ + DECLARGS_##nr(args) \ + register unsigned long _nr asm("1") = (unsigned long)(no); \ + register long _ret asm("2"); \ + asm volatile ( \ + "svc 0\n\t" \ + : "=d" (_ret) \ + : "d" (_nr) ASMFMT_##nr \ : "memory" ); \ _ret; }) diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/setresgid.c b/sysdeps/unix/sysv/linux/sparc/sparc32/setresgid.c deleted file mode 100644 index daca1a4833..0000000000 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/setresgid.c +++ /dev/null @@ -1 +0,0 @@ -#include <sysdeps/unix/sysv/linux/i386/setresgid.c> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/setresuid.c b/sysdeps/unix/sysv/linux/sparc/sparc32/setresuid.c deleted file mode 100644 index 3aeabe9ad7..0000000000 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/setresuid.c +++ /dev/null @@ -1 +0,0 @@ -#include <sysdeps/unix/sysv/linux/i386/setresuid.c> diff --git a/sysdeps/unix/sysv/linux/sparc/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sysdep.h index 707109b01b..a60937976a 100644 --- a/sysdeps/unix/sysv/linux/sparc/sysdep.h +++ b/sysdeps/unix/sysv/linux/sparc/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek <jakub@redhat.com>, 2000. @@ -22,13 +22,17 @@ #undef INLINE_SYSCALL #define INLINE_SYSCALL(name, nr, args...) \ - inline_syscall##nr(__SYSCALL_STRING, name, args) + inline_syscall##nr(__SYSCALL_STRING, __NR_##name, args) #undef INTERNAL_SYSCALL_DECL #define INTERNAL_SYSCALL_DECL(err) do { } while (0) #undef INTERNAL_SYSCALL #define INTERNAL_SYSCALL(name, err, nr, args...) \ + inline_syscall##nr(__INTERNAL_SYSCALL_STRING, __NR_##name, args) + +#undef INTERNAL_SYSCALL_NCS +#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ inline_syscall##nr(__INTERNAL_SYSCALL_STRING, name, args) #undef INTERNAL_SYSCALL_ERROR_P @@ -41,7 +45,7 @@ #define inline_syscall0(string,name,dummy...) \ ({ \ register long __o0 __asm__ ("o0"); \ - register long __g1 __asm__ ("g1") = __NR_##name; \ + register long __g1 __asm__ ("g1") = name; \ __asm __volatile (string : "=r" (__g1), "=r" (__o0) : \ "0" (__g1) : \ __SYSCALL_CLOBBERS); \ @@ -51,7 +55,7 @@ #define inline_syscall1(string,name,arg1) \ ({ \ register long __o0 __asm__ ("o0") = (long)(arg1); \ - register long __g1 __asm__ ("g1") = __NR_##name; \ + register long __g1 __asm__ ("g1") = name; \ __asm __volatile (string : "=r" (__g1), "=r" (__o0) : \ "0" (__g1), "1" (__o0) : \ __SYSCALL_CLOBBERS); \ @@ -62,7 +66,7 @@ ({ \ register long __o0 __asm__ ("o0") = (long)(arg1); \ register long __o1 __asm__ ("o1") = (long)(arg2); \ - register long __g1 __asm__ ("g1") = __NR_##name; \ + register long __g1 __asm__ ("g1") = name; \ __asm __volatile (string : "=r" (__g1), "=r" (__o0) : \ "0" (__g1), "1" (__o0), "r" (__o1) : \ __SYSCALL_CLOBBERS); \ @@ -74,7 +78,7 @@ register long __o0 __asm__ ("o0") = (long)(arg1); \ register long __o1 __asm__ ("o1") = (long)(arg2); \ register long __o2 __asm__ ("o2") = (long)(arg3); \ - register long __g1 __asm__ ("g1") = __NR_##name; \ + register long __g1 __asm__ ("g1") = name; \ __asm __volatile (string : "=r" (__g1), "=r" (__o0) : \ "0" (__g1), "1" (__o0), "r" (__o1), \ "r" (__o2) : \ @@ -88,7 +92,7 @@ register long __o1 __asm__ ("o1") = (long)(arg2); \ register long __o2 __asm__ ("o2") = (long)(arg3); \ register long __o3 __asm__ ("o3") = (long)(arg4); \ - register long __g1 __asm__ ("g1") = __NR_##name; \ + register long __g1 __asm__ ("g1") = name; \ __asm __volatile (string : "=r" (__g1), "=r" (__o0) : \ "0" (__g1), "1" (__o0), "r" (__o1), \ "r" (__o2), "r" (__o3) : \ @@ -103,7 +107,7 @@ register long __o2 __asm__ ("o2") = (long)(arg3); \ register long __o3 __asm__ ("o3") = (long)(arg4); \ register long __o4 __asm__ ("o4") = (long)(arg5); \ - register long __g1 __asm__ ("g1") = __NR_##name; \ + register long __g1 __asm__ ("g1") = name; \ __asm __volatile (string : "=r" (__g1), "=r" (__o0) : \ "0" (__g1), "1" (__o0), "r" (__o1), \ "r" (__o2), "r" (__o3), "r" (__o4) : \ @@ -119,7 +123,7 @@ register long __o3 __asm__ ("o3") = (long)(arg4); \ register long __o4 __asm__ ("o4") = (long)(arg5); \ register long __o5 __asm__ ("o5") = (long)(arg6); \ - register long __g1 __asm__ ("g1") = __NR_##name; \ + register long __g1 __asm__ ("g1") = name; \ __asm __volatile (string : "=r" (__g1), "=r" (__o0) : \ "0" (__g1), "1" (__o0), "r" (__o1), \ "r" (__o2), "r" (__o3), "r" (__o4), \ diff --git a/sysdeps/unix/sysv/linux/tcsetattr.c b/sysdeps/unix/sysv/linux/tcsetattr.c index f73ec8883e..21e6ab2ede 100644 --- a/sysdeps/unix/sysv/linux/tcsetattr.c +++ b/sysdeps/unix/sysv/linux/tcsetattr.c @@ -49,6 +49,7 @@ tcsetattr (fd, optional_actions, termios_p) { struct __kernel_termios k_termios; unsigned long int cmd; + int retval; switch (optional_actions) { @@ -80,6 +81,35 @@ tcsetattr (fd, optional_actions, termios_p) memcpy (&k_termios.c_cc[0], &termios_p->c_cc[0], __KERNEL_NCCS * sizeof (cc_t)); - return INLINE_SYSCALL (ioctl, 3, fd, cmd, &k_termios); + retval = INLINE_SYSCALL (ioctl, 3, fd, cmd, &k_termios); + + if (retval == 0 && cmd == TCSETS) + { + /* The Linux kernel has a bug which silently ignore the invalid + c_cflag on pty. We have to check it here. */ + int save = errno; + retval = INLINE_SYSCALL (ioctl, 3, fd, TCGETS, &k_termios); + if (retval) + { + /* We cannot verify if the setting is ok. We don't return + an error (?). */ + __set_errno (save); + retval = 0; + } + else if ((termios_p->c_cflag & (PARENB | CREAD)) + != (k_termios.c_cflag & (PARENB | CREAD)) + || ((termios_p->c_cflag & CSIZE) + && ((termios_p->c_cflag & CSIZE) + != (k_termios.c_cflag & CSIZE)))) + { + /* It looks like the Linux kernel silently changed the + PARENB/CREAD/CSIZE bits in c_cflag. Report it as an + error. */ + __set_errno (EINVAL); + retval = -1; + } + } + + return retval; } libc_hidden_def (tcsetattr) |