summaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/sysv')
-rw-r--r--sysdeps/unix/sysv/linux/check_pf.c5
-rw-r--r--sysdeps/unix/sysv/linux/dl-osinfo.h29
-rw-r--r--sysdeps/unix/sysv/linux/futimesat.c23
-rw-r--r--sysdeps/unix/sysv/linux/i386/dl-cache.h59
-rw-r--r--sysdeps/unix/sysv/linux/ia64/dl-cache.h27
-rw-r--r--sysdeps/unix/sysv/linux/ia64/dl-procinfo.c5
-rw-r--r--sysdeps/unix/sysv/linux/ia64/dl-procinfo.h5
-rw-r--r--sysdeps/unix/sysv/linux/ia64/ldd-rewrite.sed2
-rw-r--r--sysdeps/unix/sysv/linux/netlinkaccess.h18
-rw-r--r--sysdeps/unix/sysv/linux/paths.h2
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/fxstat.c2
-rw-r--r--sysdeps/unix/sysv/linux/tcsetattr.c32
12 files changed, 182 insertions, 27 deletions
diff --git a/sysdeps/unix/sysv/linux/check_pf.c b/sysdeps/unix/sysv/linux/check_pf.c
index e694342998..586f1cb169 100644
--- a/sysdeps/unix/sysv/linux/check_pf.c
+++ b/sysdeps/unix/sysv/linux/check_pf.c
@@ -27,13 +27,10 @@
#include <unistd.h>
#include <sys/socket.h>
-#include <asm/types.h>
-#include <linux/netlink.h>
-#include <linux/rtnetlink.h>
-
#include <not-cancel.h>
#include <kernel-features.h>
+#include "netlinkaccess.h"
#ifndef IFA_F_HOMEADDRESS
# define IFA_F_HOMEADDRESS 0
diff --git a/sysdeps/unix/sysv/linux/dl-osinfo.h b/sysdeps/unix/sysv/linux/dl-osinfo.h
index df07869bc5..430166a578 100644
--- a/sysdeps/unix/sysv/linux/dl-osinfo.h
+++ b/sysdeps/unix/sysv/linux/dl-osinfo.h
@@ -17,10 +17,13 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <errno.h>
#include <kernel-features.h>
#include <dl-sysdep.h>
#include <fcntl.h>
#include <stdint.h>
+#include <hp-timing.h>
+#include <endian.h>
#ifndef MIN
# define MIN(a,b) (((a)<(b))?(a):(b))
@@ -80,6 +83,32 @@ _dl_setup_stack_chk_guard (void *dl_random)
unsigned char *p = (unsigned char *) &ret;
p[sizeof (ret) - 1] = 255;
p[sizeof (ret) - 2] = '\n';
+#ifdef HP_TIMING_NOW
+ hp_timing_t hpt;
+ HP_TIMING_NOW (hpt);
+ hpt = (hpt & 0xffff) << 8;
+ ret ^= hpt;
+#endif
+ uintptr_t stk;
+ /* Avoid GCC being too smart. */
+ asm ("" : "=r" (stk) : "r" (p));
+ stk &= 0x7ffff0;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ stk <<= (__WORDSIZE - 23);
+#elif __WORDSIZE == 64
+ stk <<= 31;
+#endif
+ ret ^= stk;
+ /* Avoid GCC being too smart. */
+ p = (unsigned char *) &errno;
+ asm ("" : "=r" (stk) : "r" (p));
+ stk &= 0x7fff00;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ stk <<= (__WORDSIZE - 29);
+#else
+ stk >>= 8;
+#endif
+ ret ^= stk;
}
else
#endif
diff --git a/sysdeps/unix/sysv/linux/futimesat.c b/sysdeps/unix/sysv/linux/futimesat.c
index bb83e74faf..8292533afb 100644
--- a/sysdeps/unix/sysv/linux/futimesat.c
+++ b/sysdeps/unix/sysv/linux/futimesat.c
@@ -37,14 +37,14 @@ futimesat (fd, file, tvp)
{
int result;
+ if (file == NULL)
+ return __futimes (fd, tvp);
+
#ifdef __NR_futimesat
# ifndef __ASSUME_ATFCTS
if (__have_atfcts >= 0)
# endif
{
- if (file == NULL)
- return __futimes (fd, tvp);
-
result = INLINE_SYSCALL (futimesat, 3, fd, file, tvp);
# ifndef __ASSUME_ATFCTS
if (result == -1 && errno == ENOSYS)
@@ -58,22 +58,7 @@ futimesat (fd, file, tvp)
#ifndef __ASSUME_ATFCTS
char *buf = NULL;
- if (file == NULL)
- {
- static const char procfd[] = "/proc/self/fd/%d";
- /* Buffer for the path name we are going to use. It consists of
- - the string /proc/self/fd/
- - the file descriptor number.
- The final NUL is included in the sizeof. A bit of overhead
- due to the format elements compensates for possible negative
- numbers. */
- size_t buflen = sizeof (procfd) + sizeof (int) * 3;
- buf = alloca (buflen);
-
- __snprintf (buf, buflen, procfd, fd);
- file = buf;
- }
- else if (fd != AT_FDCWD && file[0] != '/')
+ if (fd != AT_FDCWD && file[0] != '/')
{
size_t filelen = strlen (file);
if (__builtin_expect (filelen == 0, 0))
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/netlinkaccess.h b/sysdeps/unix/sysv/linux/netlinkaccess.h
index 92310b77df..48903d3725 100644
--- a/sysdeps/unix/sysv/linux/netlinkaccess.h
+++ b/sysdeps/unix/sysv/linux/netlinkaccess.h
@@ -25,6 +25,24 @@
#include <kernel-features.h>
+#ifndef IFA_MAX
+/* 2.6.19 kernel headers helpfully removed some macros and
+ moved lots of stuff into new headers, some of which aren't
+ included by linux/rtnetlink.h. */
+#include <linux/if_addr.h>
+#endif
+
+#ifndef IFA_RTA
+# define IFA_RTA(r) \
+ ((struct rtattr*) ((char*)(r) + NLMSG_ALIGN (sizeof (struct ifaddrmsg))))
+# define IFA_PAYLOAD(n) NLMSG_PAYLOAD (n, sizeof (struct ifaddrmsg))
+#endif
+
+#ifndef IFLA_RTA
+# define IFLA_RTA(r) \
+ ((struct rtattr*) ((char*)(r) + NLMSG_ALIGN (sizeof (struct ifinfomsg))))
+# define IFLA_PAYLOAD(n) NLMSG_PAYLOAD (n, sizeof (struct ifinfomsg))
+#endif
struct netlink_res
{
diff --git a/sysdeps/unix/sysv/linux/paths.h b/sysdeps/unix/sysv/linux/paths.h
index f4860f24d9..1b01c0d179 100644
--- a/sysdeps/unix/sysv/linux/paths.h
+++ b/sysdeps/unix/sysv/linux/paths.h
@@ -62,7 +62,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/sparc/sparc64/fxstat.c b/sysdeps/unix/sysv/linux/sparc/sparc64/fxstat.c
index 6b374777b8..e328ccbab0 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/fxstat.c
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/fxstat.c
@@ -1 +1 @@
-#include "../../fxstat.c"
+#include "../../i386/fxstat.c"
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)