--- /dev/null
+From: Richard Henderson <rth at twiddle dot net>
+
+Most of the patch concerns kernel-features.h, and using it in some
+syscalls added before 2.2.0. Some new usage of INLINE_SYSCALL in
+various places.
+
+
+ 2003-06-20 Richard Henderson <rth at redhat dot com>
+
+linuxthreads/
+ * sysdeps/unix/sysv/linux/alpha/Makefile (libpthread-routines):
+ Remove ptw-osf_sigprocmask.
+
+libc/
+ * sysdeps/unix/alpha/sysdep.h (INLINE_SYSCALL1): Use __builtin_expect.
+ * sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_ST_INO_64_BIT)
+ Unset for alpha.
+ (__ASSUME_TIMEVAL64): Set for alpha.
+ * sysdeps/unix/sysv/linux/alpha/Makefile (sysdep_routines): Remove
+ adjtimex, osf_sigprocmask, old_adjtimex.
+ * sysdeps/unix/sysv/linux/alpha/adjtime.c: Use INLINE_SYSCALL,
+ __ASSUME_TIMEVAL64. Reorg tv64 functions to avoid uninit variable.
+ * sysdeps/unix/sysv/linux/alpha/getitimer.S: Use __ASSUME_TIMEVAL64.
+ * sysdeps/unix/sysv/linux/alpha/getrusage.S: Likewise.
+ * sysdeps/unix/sysv/linux/alpha/gettimeofday.S: Likewise.
+ * sysdeps/unix/sysv/linux/alpha/select.S: Likewise.
+ * sysdeps/unix/sysv/linux/alpha/setitimer.S: Likewise.
+ * sysdeps/unix/sysv/linux/alpha/settimeofday.S: Likewise.
+ * sysdeps/unix/sysv/linux/alpha/utimes.S: Likewise.
+ * sysdeps/unix/sysv/linux/alpha/wait4.S: Likewise.
+ * sysdeps/unix/sysv/linux/alpha/ieee_get_fp_control.S: Streamline
+ PIC code sequence.
+ * sysdeps/unix/sysv/linux/alpha/ieee_set_fp_control.S: Likewise.
+ * sysdeps/unix/sysv/linux/alpha/sigaction.c: New file.
+ * sysdeps/unix/sysv/linux/alpha/sigprocmask.c: Use INLINE_SYSCALL.
+ * sysdeps/unix/sysv/linux/alpha/ustat.c: Likewise.
+ * sysdeps/unix/sysv/linux/alpha/xmknod.c: Likewise.
+ * sysdeps/unix/sysv/linux/alpha/syscalls.list: Remove osf_sigprocmask,
+ sys_ustat, sys_mknod, adjtimex, old_adjtimex.
+ * sysdeps/unix/sysv/linux/alpha/sysdep.h (INLINE_SYSCALL): Don't
+ defer to __syscall_name; error for rt_sigaction.
+ * sysdeps/unix/sysv/linux/alpha/xstatconv.c: Include kernel_stat.h.
+
+Index: linuxthreads/sysdeps/unix/sysv/linux/alpha/Makefile
+===================================================================
+RCS file: /cvs/glibc/libc/linuxthreads/sysdeps/unix/sysv/linux/alpha/Makefile,v
+retrieving revision 1.1
+diff -c -p -d -u -r1.1 Makefile
+--- linuxthreads/sysdeps/unix/sysv/linux/alpha/Makefile 6 Jan 2003 23:51:32 -0000 1.1
++++ linuxthreads/sysdeps/unix/sysv/linux/alpha/Makefile 20 Jun 2003 06:31:38 -0000
+@@ -1,3 +1,3 @@
+ ifeq ($(subdir),linuxthreads)
+-libpthread-routines += ptw-sysdep ptw-sigblock ptw-sigprocmask ptw-osf_sigprocmask
++libpthread-routines += ptw-sysdep ptw-sigblock ptw-sigprocmask
+ endif
+Index: sysdeps/unix/alpha/sysdep.h
+===================================================================
+RCS file: /cvs/glibc/libc/sysdeps/unix/alpha/sysdep.h,v
+retrieving revision 1.17
+diff -c -p -d -u -r1.17 sysdep.h
+--- sysdeps/unix/alpha/sysdep.h 23 Mar 2003 19:42:22 -0000 1.17
++++ sysdeps/unix/alpha/sysdep.h 20 Jun 2003 06:31:45 -0000
+@@ -152,7 +152,7 @@ __LABEL(name) \
+ ({ \
+ long _sc_ret, _sc_err; \
+ inline_syscall##nr(name, args); \
+- if (_sc_err) \
++ if (__builtin_expect (_sc_err, 0)) \
+ { \
+ __set_errno (_sc_ret); \
+ _sc_ret = -1L; \
+Index: sysdeps/unix/sysv/linux/kernel-features.h
+===================================================================
+RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/kernel-features.h,v
+retrieving revision 1.52
+diff -c -p -d -u -r1.52 kernel-features.h
+--- sysdeps/unix/sysv/linux/kernel-features.h 10 Jun 2003 02:28:19 -0000 1.52
++++ sysdeps/unix/sysv/linux/kernel-features.h 20 Jun 2003 06:31:46 -0000
+@@ -136,7 +136,7 @@
+ # define __ASSUME_IPC64 1
+ #endif
+
+-/* mips platforms had IPC64 all along. */
++/* MIPS platforms had IPC64 all along. */
+ #if defined __mips__
+ # define __ASSUME_IPC64 1
+ #endif
+@@ -156,7 +156,7 @@
+ /* The changed st_ino field appeared in 2.4.0-test6. But we cannot
+ distinguish this version from other 2.4.0 releases. Therefore play
+ save and assume it available is for 2.4.1 and up. */
+-#if __LINUX_KERNEL_VERSION >= 132097
++#if __LINUX_KERNEL_VERSION >= 132097 && !defined __alpha__
+ # define __ASSUME_ST_INO_64_BIT 1
+ #endif
+
+@@ -250,6 +250,11 @@
+ # define __ASSUME_ST_INO_64_BIT 1
+ # define __ASSUME_FCNTL64 1
+ # define __ASSUME_GETDENTS64_SYSCALL 1
++#endif
++
++/* Alpha switched to a 64-bit timeval sometime before 2.2.0. */
++#if __LINUX_KERNEL_VERSION >= 131584 && defined __alpha__
++# define __ASSUME_TIMEVAL64 1
+ #endif
+
+ #if defined __mips__ && defined _ABIN32 && _MIPS_SIM == _ABIN32
+Index: sysdeps/unix/sysv/linux/alpha/Makefile
+===================================================================
+RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/alpha/Makefile,v
+retrieving revision 1.20
+diff -c -p -d -u -r1.20 Makefile
+--- sysdeps/unix/sysv/linux/alpha/Makefile 24 Mar 2002 01:55:17 -0000 1.20
++++ sysdeps/unix/sysv/linux/alpha/Makefile 20 Jun 2003 06:31:47 -0000
+@@ -6,12 +6,12 @@ ifeq ($(subdir),misc)
+ sysdep_headers += alpha/ptrace.h alpha/regdef.h sys/io.h
+
+ sysdep_routines += ieee_get_fp_control ieee_set_fp_control \
+- ioperm osf_sigprocmask llseek adjtimex
++ ioperm llseek
+
+ # Support old timeval32 entry points
+ sysdep_routines += osf_select osf_gettimeofday osf_settimeofday \
+ osf_getitimer osf_setitimer osf_utimes \
+- osf_getrusage osf_wait4 old_adjtimex
++ osf_getrusage osf_wait4
+
+ # Support old ipc control
+ sysdep_routines += oldmsgctl oldsemctl oldshmctl
+Index: sysdeps/unix/sysv/linux/alpha/adjtime.c
+===================================================================
+RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/alpha/adjtime.c,v
+retrieving revision 1.7
+diff -c -p -d -u -r1.7 adjtime.c
+--- sysdeps/unix/sysv/linux/alpha/adjtime.c 7 Jan 2003 23:51:48 -0000 1.7
++++ sysdeps/unix/sysv/linux/alpha/adjtime.c 20 Jun 2003 06:31:47 -0000
+@@ -17,7 +17,11 @@
+ 02111-1307 USA. */
+
+ #include <shlib-compat.h>
++#include <sysdep.h>
++#include <sys/time.h>
++#include "kernel-features.h"
+
++#if !defined __ASSUME_TIMEVAL64 || SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
+ struct timeval32
+ {
+ int tv_sec, tv_usec;
+@@ -55,7 +59,7 @@ struct timex32 {
+ #define TIMEVAL timeval32
+ #define TIMEX timex32
+ #define ADJTIME __adjtime_tv32
+-#define ADJTIMEX(x) __adjtimex_tv32 (x)
++#define ADJTIMEX(x) INLINE_SYSCALL (old_adjtimex, 1, x)
+ #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
+ #define LINKAGE
+ #else
+@@ -63,13 +67,18 @@ struct timex32 {
+ #endif
+
+ LINKAGE int ADJTIME (const struct TIMEVAL *itv, struct TIMEVAL *otv);
+-extern int ADJTIMEX (struct TIMEX *);
+
+ #include <sysdeps/unix/sysv/linux/adjtime.c>
+
+ #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
++int __adjtimex_tv32 (struct timex32 *tx) { return ADJTIMEX (tx); }
++strong_alias (__adjtimex_tv32, __adjtimex_tv32_1);
++strong_alias (__adjtimex_tv32, __adjtimex_tv32_2);
++compat_symbol (libc, __adjtimex_tv32_1, __adjtimex, GLIBC_2_0);
++compat_symbol (libc, __adjtimex_tv32_2, adjtimex, GLIBC_2_0);
+ compat_symbol (libc, __adjtime_tv32, adjtime, GLIBC_2_0);
+ #endif
++#endif /* !__ASSUME_TIMEVAL64 || SHLIB_COMPAT */
+
+ #undef TIMEVAL
+ #define TIMEVAL timeval
+@@ -78,34 +87,38 @@ compat_symbol (libc, __adjtime_tv32, adj
+ #undef ADJTIME
+ #define ADJTIME __adjtime_tv64
+ #undef ADJTIMEX
+-#define ADJTIMEX(x) __syscall_adjtimex_tv64 (x)
++#define ADJTIMEX(x) INLINE_SYSCALL (adjtimex, 1, x)
+ #undef LINKAGE
+ #define LINKAGE static
+
+ LINKAGE int ADJTIME (const struct TIMEVAL *itv, struct TIMEVAL *otv);
+-extern int ADJTIMEX (struct TIMEX *);
+
+ #include <sysdeps/unix/sysv/linux/adjtime.c>
+-static int missing_adjtimex = 0;
++#include <stdbool.h>
++
++#if !defined __ASSUME_TIMEVAL64
++static bool missing_adjtimex;
+
+ int
+ __adjtime (itv, otv)
+ const struct timeval *itv;
+ struct timeval *otv;
+ {
++ struct timeval32 itv32, otv32;
+ int ret;
+
+- if (!missing_adjtimex)
++ switch (missing_adjtimex)
+ {
++ case false:
+ ret = __adjtime_tv64 (itv, otv);
+ if (ret && errno == ENOSYS)
+ missing_adjtimex = 1;
+- }
++ else
++ break;
+
+- if (missing_adjtimex)
+- {
+- struct timeval32 itv32, otv32;
++ /* FALLTHRU */
+
++ default:
+ itv32.tv_sec = itv->tv_sec;
+ itv32.tv_usec = itv->tv_usec;
+ ret = __adjtime_tv32 (&itv32, &otv32);
+@@ -114,31 +127,38 @@ __adjtime (itv, otv)
+ otv->tv_sec = otv32.tv_sec;
+ otv->tv_usec = otv32.tv_usec;
+ }
++ break;
+ }
+
+ return ret;
+ }
++#else
++strong_alias (__adjtime_tv64, __adjtime);
++#endif
+
+ versioned_symbol (libc, __adjtime, adjtime, GLIBC_2_1);
+
+-extern int __syscall_adjtimex_tv64 (struct timex *tx);
+-
+ int
+ __adjtimex_tv64 (struct timex *tx)
+ {
++#if defined __ASSUME_TIMEVAL64
++ return ADJTIMEX (tx);
++#else
++ struct timex32 tx32;
+ int ret;
+
+- if (!missing_adjtimex)
+- {
+- ret = __syscall_adjtimex_tv64 (tx);
+- if (ret && errno == ENOSYS)
++ switch (missing_adjtimex)
++ {
++ case false:
++ ret = ADJTIMEX (tx);
++ if (ret && errno == ENOSYS)
+ missing_adjtimex = 1;
+- }
++ else
++ break;
+
+- if (missing_adjtimex)
+- {
+- struct timex32 tx32;
++ /* FALLTHRU */
+
++ default:
+ tx32.modes = tx->modes;
+ tx32.offset = tx->offset;
+ tx32.freq = tx->freq;
+@@ -184,9 +204,11 @@ __adjtimex_tv64 (struct timex *tx)
+ tx->errcnt = tx32.errcnt;
+ tx->stbcnt = tx32.stbcnt;
+ }
++ break;
+ }
+
+ return ret;
++#endif
+ }
+
+ strong_alias (__adjtimex_tv64, __adjtimex_internal);
+Index: sysdeps/unix/sysv/linux/alpha/getitimer.S
+===================================================================
+RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/alpha/getitimer.S,v
+retrieving revision 1.5
+diff -c -p -d -u -r1.5 getitimer.S
+--- sysdeps/unix/sysv/linux/alpha/getitimer.S 8 Nov 2002 02:18:47 -0000 1.5
++++ sysdeps/unix/sysv/linux/alpha/getitimer.S 20 Jun 2003 06:31:47 -0000
+@@ -1,4 +1,4 @@
+-/* Copyright (C) 1998 Free Software Foundation, Inc.
++/* Copyright (C) 1998, 2003 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
+@@ -19,7 +19,21 @@
+ #include <sysdep.h>
+ #define _ERRNO_H 1
+ #include <bits/errno.h>
++#include "kernel-features.h"
+
++.text
++
++#if defined HAVE_ELF && defined PIC && defined DO_VERSIONING
++#define GETITIMER __getitimer_tv64
++#else
++#define GETITIMER getitimer
++#endif
++
++#if defined __ASSUME_TIMEVAL64
++PSEUDO(GETITIMER, getitimer, 2)
++ ret
++PSEUDO_END(GETITIMER)
++#else
+ /* The problem here is that initially we made struct timeval compatible with
+ OSF/1, using int32. But we defined time_t with uint64, and later found
+ that POSIX requires tv_sec to be time_t.
+@@ -30,14 +44,6 @@
+ functions which have RT equivalents. */
+ .comm __libc_missing_axp_tv64, 4
+
+-.text
+-
+-#if defined HAVE_ELF && defined PIC && defined DO_VERSIONING
+-#define GETITIMER __getitimer_tv64
+-#else
+-#define GETITIMER getitimer
+-#endif
+-
+ LEAF(GETITIMER, 16)
+ ldgp gp, 0(pv)
+ subq sp, 16, sp
+@@ -100,6 +106,7 @@ $error:
+ SYSCALL_ERROR_HANDLER
+
+ END(GETITIMER)
++#endif /* __ASSUME_TIMEVAL64 */
+
+ #if defined HAVE_ELF && defined PIC && defined DO_VERSIONING
+ default_symbol_version (__getitimer_tv64, getitimer, GLIBC_2.1)
+Index: sysdeps/unix/sysv/linux/alpha/getrusage.S
+===================================================================
+RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/alpha/getrusage.S,v
+retrieving revision 1.7
+diff -c -p -d -u -r1.7 getrusage.S
+--- sysdeps/unix/sysv/linux/alpha/getrusage.S 8 Nov 2002 02:18:47 -0000 1.7
++++ sysdeps/unix/sysv/linux/alpha/getrusage.S 20 Jun 2003 06:31:47 -0000
+@@ -1,4 +1,4 @@
+-/* Copyright (C) 1998 Free Software Foundation, Inc.
++/* Copyright (C) 1998, 2003 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
+@@ -19,7 +19,21 @@
+ #include <sysdep.h>
+ #define _ERRNO_H 1
+ #include <bits/errno.h>
++#include "kernel-features.h"
+
++.text
++
++#if defined HAVE_ELF && defined PIC && defined DO_VERSIONING
++#define GETRUSAGE __getrusage_tv64
++#else
++#define GETRUSAGE __getrusage
++#endif
++
++#if defined __ASSUME_TIMEVAL64
++PSEUDO(GETRUSAGE, getrusage, 2)
++ ret
++PSEUDO_END(GETRUSAGE)
++#else
+ /* The problem here is that initially we made struct timeval compatible with
+ OSF/1, using int32. But we defined time_t with uint64, and later found
+ that POSIX requires tv_sec to be time_t.
+@@ -30,14 +44,6 @@
+ functions which have RT equivalents. */
+ .comm __libc_missing_axp_tv64, 4
+
+-.text
+-
+-#if defined HAVE_ELF && defined PIC && defined DO_VERSIONING
+-#define GETRUSAGE __getrusage_tv64
+-#else
+-#define GETRUSAGE __getrusage
+-#endif
+-
+ LEAF(GETRUSAGE, 16)
+ ldgp gp, 0(pv)
+ subq sp, 16, sp
+@@ -132,6 +138,7 @@ $error:
+ SYSCALL_ERROR_HANDLER
+
+ END(GETRUSAGE)
++#endif /* __ASSUME_TIMEVAL64 */
+
+ #if defined HAVE_ELF && defined PIC && defined DO_VERSIONING
+ strong_alias(__getrusage_tv64, ____getrusage_tv64)
+Index: sysdeps/unix/sysv/linux/alpha/gettimeofday.S
+===================================================================
+RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/alpha/gettimeofday.S,v
+retrieving revision 1.7
+diff -c -p -d -u -r1.7 gettimeofday.S
+--- sysdeps/unix/sysv/linux/alpha/gettimeofday.S 6 Jun 2003 05:51:53 -0000 1.7
++++ sysdeps/unix/sysv/linux/alpha/gettimeofday.S 20 Jun 2003 06:31:47 -0000
+@@ -1,4 +1,4 @@
+-/* Copyright (C) 1998, 2002 Free Software Foundation, Inc.
++/* Copyright (C) 1998, 2002, 2003 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
+@@ -19,6 +19,21 @@
+ #include <sysdep.h>
+ #define _ERRNO_H 1
+ #include <bits/errno.h>
++#include "kernel-features.h"
++
++.text
++
++#if defined HAVE_ELF && defined PIC && defined DO_VERSIONING
++#define GETTIMEOFDAY __gettimeofday_tv64
++#else
++#define GETTIMEOFDAY __gettimeofday
++#endif
++
++#if defined __ASSUME_TIMEVAL64
++PSEUDO(GETTIMEOFDAY, gettimeofday, 2)
++ ret
++PSEUDO_END(GETTIMEOFDAY)
++#else
+
+ /* The problem here is that initially we made struct timeval compatible with
+ OSF/1, using int32. But we defined time_t with uint64, and later found
+@@ -30,14 +45,6 @@
+ functions which have RT equivalents. */
+ .comm __libc_missing_axp_tv64, 4
+
+-.text
+-
+-#if defined HAVE_ELF && defined PIC && defined DO_VERSIONING
+-#define GETTIMEOFDAY __gettimeofday_tv64
+-#else
+-#define GETTIMEOFDAY __gettimeofday
+-#endif
+-
+ LEAF(GETTIMEOFDAY, 16)
+ ldgp gp, 0(pv)
+ subq sp, 16, sp
+@@ -97,6 +104,7 @@ $error:
+ SYSCALL_ERROR_HANDLER
+
+ END(GETTIMEOFDAY)
++#endif /* __ASSUME_TIMEVAL64 */
+
+ #if defined HAVE_ELF && defined PIC && defined DO_VERSIONING
+ default_symbol_version (__gettimeofday_tv64, __gettimeofday, GLIBC_2.1)
+Index: sysdeps/unix/sysv/linux/alpha/ieee_get_fp_control.S
+===================================================================
+RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/alpha/ieee_get_fp_control.S,v
+retrieving revision 1.10
+diff -c -p -d -u -r1.10 ieee_get_fp_control.S
+--- sysdeps/unix/sysv/linux/alpha/ieee_get_fp_control.S 8 Nov 2002 02:18:47 -0000 1.10
++++ sysdeps/unix/sysv/linux/alpha/ieee_get_fp_control.S 20 Jun 2003 06:31:47 -0000
+@@ -1,4 +1,4 @@
+-/* Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
++/* Copyright (C) 1993, 1995, 1996, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Mosberger <davidm@azstarnet.com>, 1995.
+
+@@ -32,9 +32,13 @@ LEAF(__ieee_get_fp_control, 16)
+ jsr AT, (AT), _mcount
+ .set at
+ .prologue 1
+-#else
++#elif defined PIC
+ lda sp, -16(sp)
+ .prologue 0
++#else
++ ldgp gp, 0(pv)
++ lda sp, -16(sp)
++ .prologue 1
+ #endif
+
+ mov sp, a1
+@@ -48,10 +52,6 @@ LEAF(__ieee_get_fp_control, 16)
+ ret
+
+ $error:
+-#ifndef PROF
+- br gp, 1f
+-1: ldgp gp, 0(gp)
+-#endif
+ lda sp, 16(sp)
+ SYSCALL_ERROR_HANDLER
+
+Index: sysdeps/unix/sysv/linux/alpha/ieee_set_fp_control.S
+===================================================================
+RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/alpha/ieee_set_fp_control.S,v
+retrieving revision 1.11
+diff -c -p -d -u -r1.11 ieee_set_fp_control.S
+--- sysdeps/unix/sysv/linux/alpha/ieee_set_fp_control.S 8 Nov 2002 02:18:47 -0000 1.11
++++ sysdeps/unix/sysv/linux/alpha/ieee_set_fp_control.S 20 Jun 2003 06:31:47 -0000
+@@ -1,4 +1,4 @@
+-/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
++/* Copyright (C) 1993, 1995, 1996, 1997, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Mosberger <davidm@azstarnet.com>, 1995.
+
+@@ -30,9 +30,13 @@ LEAF(__ieee_set_fp_control, 16)
+ jsr AT, (AT), _mcount
+ .set at
+ .prologue 1
+-#else
++#elif defined PIC
+ lda sp, -16(sp)
+ .prologue 0
++#else
++ ldgp gp, 0(pv)
++ lda sp, -16(sp)
++ .prologue 1
+ #endif
+
+ stq a0, 0(sp)
+@@ -47,10 +51,6 @@ LEAF(__ieee_set_fp_control, 16)
+ ret
+
+ $error:
+-#ifndef PROF
+- br gp, 1f
+-1: ldgp gp, 0(gp)
+-#endif
+ lda sp, 16(sp)
+ SYSCALL_ERROR_HANDLER
+
+Index: sysdeps/unix/sysv/linux/alpha/select.S
+===================================================================
+RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/alpha/select.S,v
+retrieving revision 1.9
+diff -c -p -d -u -r1.9 select.S
+--- sysdeps/unix/sysv/linux/alpha/select.S 7 Jan 2003 00:48:34 -0000 1.9
++++ sysdeps/unix/sysv/linux/alpha/select.S 20 Jun 2003 06:31:47 -0000
+@@ -19,7 +19,21 @@
+ #include <sysdep-cancel.h>
+ #define _ERRNO_H 1
+ #include <bits/errno.h>
++#include "kernel-features.h"
++
++.text
++
++#if defined HAVE_ELF && defined PIC && defined DO_VERSIONING
++#define SELECT __select_tv64
++#else
++#define SELECT __select
++#endif
+
++#if defined __ASSUME_TIMEVAL64
++PSEUDO(SELECT, select, 5)
++ ret
++PSEUDO_END(SELECT)
++#else
+ /* The problem here is that initially we made struct timeval compatible with
+ OSF/1, using int32. But we defined time_t with uint64, and later found
+ that POSIX requires tv_sec to be time_t.
+@@ -30,14 +44,6 @@
+ functions which have RT equivalents. */
+ .comm __libc_missing_axp_tv64, 4
+
+-.text
+-
+-#if defined HAVE_ELF && defined PIC && defined DO_VERSIONING
+-#define SELECT __select_tv64
+-#else
+-#define SELECT __select
+-#endif
+-
+ LEAF(SELECT, 64)
+ ldgp gp, 0(pv)
+ subq sp, 64, sp
+@@ -210,6 +216,7 @@ $error:
+ SYSCALL_ERROR_HANDLER
+
+ END(SELECT)
++#endif /* __ASSUME_TIMEVAL64 */
+
+ #if defined HAVE_ELF && defined PIC && defined DO_VERSIONING
+ default_symbol_version (__select_tv64, __select, GLIBC_2.1)
+Index: sysdeps/unix/sysv/linux/alpha/setitimer.S
+===================================================================
+RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/alpha/setitimer.S,v
+retrieving revision 1.5
+diff -c -p -d -u -r1.5 setitimer.S
+--- sysdeps/unix/sysv/linux/alpha/setitimer.S 8 Nov 2002 02:18:47 -0000 1.5
++++ sysdeps/unix/sysv/linux/alpha/setitimer.S 20 Jun 2003 06:31:47 -0000
+@@ -1,4 +1,4 @@
+-/* Copyright (C) 1998 Free Software Foundation, Inc.
++/* Copyright (C) 1998, 2003 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
+@@ -19,7 +19,21 @@
+ #include <sysdep.h>
+ #define _ERRNO_H 1
+ #include <bits/errno.h>
++#include "kernel-features.h"
+
++.text
++
++#if defined HAVE_ELF && defined PIC && defined DO_VERSIONING
++#define SETITIMER __setitimer_tv64
++#else
++#define SETITIMER __setitimer
++#endif
++
++#if defined __ASSUME_TIMEVAL64
++PSEUDO(SETITIMER, setitimer, 3)
++ ret
++PSEUDO_END(SETITIMER)
++#else
+ /* The problem here is that initially we made struct timeval compatible with
+ OSF/1, using int32. But we defined time_t with uint64, and later found
+ that POSIX requires tv_sec to be time_t.
+@@ -30,14 +44,6 @@
+ functions which have RT equivalents. */
+ .comm __libc_missing_axp_tv64, 4
+
+-.text
+-
+-#if defined HAVE_ELF && defined PIC && defined DO_VERSIONING
+-#define SETITIMER __setitimer_tv64
+-#else
+-#define SETITIMER __setitimer
+-#endif
+-
+ LEAF(SETITIMER, 48)
+ ldgp gp, 0(pv)
+ subq sp, 48, sp
+@@ -116,6 +122,7 @@ $error:
+ SYSCALL_ERROR_HANDLER
+
+ END(SETITIMER)
++#endif /* __ASSUME_TIMEVAL64 */
+
+ #if defined HAVE_ELF && defined PIC && defined DO_VERSIONING
+ default_symbol_version (__setitimer_tv64, __setitimer, GLIBC_2.1)
+Index: sysdeps/unix/sysv/linux/alpha/settimeofday.S
+===================================================================
+RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/alpha/settimeofday.S,v
+retrieving revision 1.5
+diff -c -p -d -u -r1.5 settimeofday.S
+--- sysdeps/unix/sysv/linux/alpha/settimeofday.S 8 Nov 2002 02:18:47 -0000 1.5
++++ sysdeps/unix/sysv/linux/alpha/settimeofday.S 20 Jun 2003 06:31:48 -0000
+@@ -1,4 +1,4 @@
+-/* Copyright (C) 1998 Free Software Foundation, Inc.
++/* Copyright (C) 1998, 2003 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
+@@ -19,7 +19,21 @@
+ #include <sysdep.h>
+ #define _ERRNO_H 1
+ #include <bits/errno.h>
++#include "kernel-features.h"
+
++.text
++
++#if defined HAVE_ELF && defined PIC && defined DO_VERSIONING
++#define SETTIMEOFDAY __settimeofday_tv64
++#else
++#define SETTIMEOFDAY __settimeofday
++#endif
++
++#if defined __ASSUME_TIMEVAL64
++PSEUDO(SETTIMEOFDAY, settimeofday, 2)
++ ret
++PSEUDO_END(SETTIMEOFDAY)
++#else
+ /* The problem here is that initially we made struct timeval compatible with
+ OSF/1, using int32. But we defined time_t with uint64, and later found
+ that POSIX requires tv_sec to be time_t.
+@@ -30,14 +44,6 @@
+ functions which have RT equivalents. */
+ .comm __libc_missing_axp_tv64, 4
+
+-.text
+-
+-#if defined HAVE_ELF && defined PIC && defined DO_VERSIONING
+-#define SETTIMEOFDAY __settimeofday_tv64
+-#else
+-#define SETTIMEOFDAY __settimeofday
+-#endif
+-
+ LEAF(SETTIMEOFDAY, 16)
+ ldgp gp, 0(pv)
+ subq sp, 16, sp
+@@ -97,6 +103,7 @@ $error:
+ SYSCALL_ERROR_HANDLER
+
+ END(SETTIMEOFDAY)
++#endif /* __ASSUME_TIMEVAL64 */
+
+ #if defined HAVE_ELF && defined PIC && defined DO_VERSIONING
+ default_symbol_version (__settimeofday_tv64, __settimeofday, GLIBC_2.1)
+Index: sysdeps/unix/sysv/linux/alpha/sigaction.c
+===================================================================
+RCS file: sysdeps/unix/sysv/linux/alpha/sigaction.c
+diff -N sysdeps/unix/sysv/linux/alpha/sigaction.c
+--- /dev/null 1 Jan 1970 00:00:00 -0000
++++ sysdeps/unix/sysv/linux/alpha/sigaction.c 20 Jun 2003 06:31:48 -0000
+@@ -0,0 +1,33 @@
++/* Copyright (C) 2003 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. */
++
++#include <sysdep.h>
++
++/*
++ * In order to get the hidden arguments for rt_sigaction set up
++ * properly, we need to call the assembly version. Detect this in the
++ * INLINE_SYSCALL macro, and fail to expand inline in that case.
++ */
++
++#undef INLINE_SYSCALL
++#define INLINE_SYSCALL(name, nr, args...) \
++ (__NR_##name == __NR_rt_sigaction \
++ ? __syscall_rt_sigaction(args) \
++ : INLINE_SYSCALL1(name, nr, args))
++
++#include <sysdeps/unix/sysv/linux/sigaction.c>
+Index: sysdeps/unix/sysv/linux/alpha/sigprocmask.c
+===================================================================
+RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/alpha/sigprocmask.c,v
+retrieving revision 1.3
+diff -c -p -d -u -r1.3 sigprocmask.c
+--- sysdeps/unix/sysv/linux/alpha/sigprocmask.c 6 Jul 2001 04:56:13 -0000 1.3
++++ sysdeps/unix/sysv/linux/alpha/sigprocmask.c 20 Jun 2003 06:31:48 -0000
+@@ -1,4 +1,4 @@
+-/* Copyright (C) 1993, 1995, 1997 Free Software Foundation, Inc.
++/* Copyright (C) 1993, 1995, 1997, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Mosberger (davidm@azstarnet.com).
+
+@@ -17,14 +17,13 @@
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
++#include <errno.h>
+ #include <sysdep.h>
+ #include <signal.h>
+
+ /* When there is kernel support for more than 64 signals, we'll have to
+ switch to a new system call convention here. */
+
+-extern unsigned long __osf_sigprocmask (int how, unsigned long newmask);
+-
+ int
+ __sigprocmask (int how, const sigset_t *set, sigset_t *oset)
+ {
+@@ -32,15 +31,14 @@ __sigprocmask (int how, const sigset_t *
+ long result;
+
+ if (set)
+- {
+- setval = set->__val[0];
+- }
++ setval = set->__val[0];
+ else
+ {
+ setval = 0;
+ how = SIG_BLOCK; /* ensure blocked mask doesn't get changed */
+ }
+- result = __osf_sigprocmask (how, setval);
++
++ result = INLINE_SYSCALL (osf_sigprocmask, 2, how, setval);
+ if (result == -1)
+ /* If there are ever more than 63 signals, we need to recode this
+ in assembler since we wouldn't be able to distinguish a mask of
+Index: sysdeps/unix/sysv/linux/alpha/syscalls.list
+===================================================================
+RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/alpha/syscalls.list,v
+retrieving revision 1.56
+diff -c -p -d -u -r1.56 syscalls.list
+--- sysdeps/unix/sysv/linux/alpha/syscalls.list 6 Jun 2003 05:52:52 -0000 1.56
++++ sysdeps/unix/sysv/linux/alpha/syscalls.list 20 Jun 2003 06:31:48 -0000
+@@ -13,7 +13,6 @@ semtimedop - semtimedop i:ipip semtimedo
+ semget - semget i:iii __semget semget
+ oldsemctl EXTRA semctl i:iiii __old_semctl semctl@GLIBC_2.0
+
+-osf_sigprocmask - osf_sigprocmask 2 __osf_sigprocmask
+ sigstack - sigstack 2 sigstack
+ vfork - vfork 0 __vfork vfork
+
+@@ -34,10 +33,6 @@ truncate - truncate 2 truncate truncate6
+ readahead - readahead 3 __readahead readahead
+ sendfile - sendfile i:iipi sendfile sendfile64
+
+-# these are actually common with the x86:
+-sys_ustat ustat ustat i:ip __syscall_ustat
+-sys_mknod xmknod mknod i:sii __syscall_mknod
+-
+ # proper socket implementations:
+ accept - accept Ci:iBN __libc_accept __accept accept
+ bind - bind i:ipi __bind bind
+@@ -64,9 +59,6 @@ pciconfig_read EXTRA pciconfig_read 5 pc
+ pciconfig_write EXTRA pciconfig_write 5 pciconfig_write
+ pciconfig_iobase EXTRA pciconfig_iobase 3 __pciconfig_iobase pciconfig_iobase
+
+-# Wrapper for adjtimex.
+-adjtimex - syscall_adjtimex 1 __syscall_adjtimex syscall_adjtimex
+-
+ # support old timeval32 entry points
+ osf_select - osf_select C:5 __select_tv32 __select@GLIBC_2.0 select@GLIBC_2.0
+ osf_gettimeofday - osf_gettimeofday 2 __gettimeofday_tv32 __gettimeofday@GLIBC_2.0 gettimeofday@GLIBC_2.0
+@@ -76,7 +68,3 @@ osf_setitimer - osf_setitimer 3 __setiti
+ osf_utimes - osf_utimes 2 __utimes_tv32 utimes@GLIBC_2.0
+ osf_getrusage - osf_getrusage 2 __getrusage_tv32 getrusage@GLIBC_2.0
+ osf_wait4 - osf_wait4 2 __wait4_tv32 wait4@GLIBC_2.0
+-old_adjtimex - old_adjtimex 1 __adjtimex_tv32 __adjtimex@GLIBC_2.0 adjtimex@GLIBC_2.0
+-
+-# and one for timeval64 entry points
+-adjtimex adjtime adjtimex 1 __syscall_adjtimex_tv64
+Index: sysdeps/unix/sysv/linux/alpha/sysdep.h
+===================================================================
+RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/alpha/sysdep.h,v
+retrieving revision 1.15
+diff -c -p -d -u -r1.15 sysdep.h
+--- sysdeps/unix/sysv/linux/alpha/sysdep.h 6 Jun 2003 05:52:52 -0000 1.15
++++ sysdeps/unix/sysv/linux/alpha/sysdep.h 20 Jun 2003 06:31:48 -0000
+@@ -67,15 +67,18 @@
+
+ /*
+ * In order to get the hidden arguments for rt_sigaction set up
+- * properly, we need to call the assembly version. Detect this in the
+- * INLINE_SYSCALL macro, and fail to expand inline in that case.
++ * properly, we need to call the assembly version. This shouldn't
++ * happen except for inside sigaction.c, where we handle this
++ * specially. Catch other uses and error.
+ */
+
+ #undef INLINE_SYSCALL
+-#define INLINE_SYSCALL(name, nr, args...) \
+- (__NR_##name == __NR_rt_sigaction \
+- ? __syscall_##name(args) \
+- : INLINE_SYSCALL1(name, nr, args))
++#define INLINE_SYSCALL(name, nr, args...) \
++({ \
++ extern char ChEcK[__NR_##name == __NR_rt_sigaction ? -1 : 1] \
++ __attribute__((unused)); \
++ INLINE_SYSCALL1(name, nr, args); \
++})
+
+ #undef INTERNAL_SYSCALL
+ #define INTERNAL_SYSCALL(name, err_out, nr, args...) \
+Index: sysdeps/unix/sysv/linux/alpha/ustat.c
+===================================================================
+RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/alpha/ustat.c,v
+retrieving revision 1.3
+diff -c -p -d -u -r1.3 ustat.c
+--- sysdeps/unix/sysv/linux/alpha/ustat.c 6 Jul 2001 04:56:13 -0000 1.3
++++ sysdeps/unix/sysv/linux/alpha/ustat.c 20 Jun 2003 06:31:48 -0000
+@@ -1,4 +1,4 @@
+-/* Copyright (C) 1997 Free Software Foundation, Inc.
++/* Copyright (C) 1997, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+@@ -17,11 +17,10 @@
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
++#include <errno.h>
+ #include <sys/ustat.h>
+ #include <sys/sysmacros.h>
+-
+-
+-extern int __syscall_ustat (unsigned int dev, struct ustat *ubuf);
++#include <sysdep.h>
+
+ int
+ ustat (dev_t dev, struct ustat *ubuf)
+@@ -31,5 +30,5 @@ ustat (dev_t dev, struct ustat *ubuf)
+ /* We must convert the value to dev_t type used by the kernel. */
+ k_dev = ((major (dev) & 0xff) << 8) | (minor (dev) & 0xff);
+
+- return __syscall_ustat (k_dev, ubuf);
++ return INLINE_SYSCALL (ustat, 2, k_dev, ubuf);
+ }
+Index: sysdeps/unix/sysv/linux/alpha/utimes.S
+===================================================================
+RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/alpha/utimes.S,v
+retrieving revision 1.5
+diff -c -p -d -u -r1.5 utimes.S
+--- sysdeps/unix/sysv/linux/alpha/utimes.S 8 Nov 2002 02:18:47 -0000 1.5
++++ sysdeps/unix/sysv/linux/alpha/utimes.S 20 Jun 2003 06:31:48 -0000
+@@ -1,4 +1,4 @@
+-/* Copyright (C) 1998 Free Software Foundation, Inc.
++/* Copyright (C) 1998, 2003 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
+@@ -19,7 +19,21 @@
+ #include <sysdep.h>
+ #define _ERRNO_H 1
+ #include <bits/errno.h>
++#include "kernel-features.h"
+
++.text
++
++#if defined HAVE_ELF && defined PIC && defined DO_VERSIONING
++#define UTIMES __utimes_tv64
++#else
++#define UTIMES __utimes
++#endif
++
++#if defined __ASSUME_TIMEVAL64
++PSEUDO(UTIMES, utimes, 2)
++ ret
++PSEUDO_END(UTIMES)
++#else
+ /* The problem here is that initially we made struct timeval compatible with
+ OSF/1, using int32. But we defined time_t with uint64, and later found
+ that POSIX requires tv_sec to be time_t.
+@@ -30,14 +44,6 @@
+ functions which have RT equivalents. */
+ .comm __libc_missing_axp_tv64, 4
+
+-.text
+-
+-#if defined HAVE_ELF && defined PIC && defined DO_VERSIONING
+-#define UTIMES __utimes_tv64
+-#else
+-#define UTIMES __utimes
+-#endif
+-
+ LEAF(UTIMES, 16)
+ ldgp gp, 0(pv)
+ subq sp, 16, sp
+@@ -102,6 +108,7 @@ $error:
+ SYSCALL_ERROR_HANDLER
+
+ END(UTIMES)
++#endif /* __ASSUME_TIMEVAL64 */
+
+ #if defined HAVE_ELF && defined PIC && defined DO_VERSIONING
+ default_symbol_version (__utimes_tv64, __utimes, GLIBC_2.1)
+Index: sysdeps/unix/sysv/linux/alpha/wait4.S
+===================================================================
+RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/alpha/wait4.S,v
+retrieving revision 1.5
+diff -c -p -d -u -r1.5 wait4.S
+--- sysdeps/unix/sysv/linux/alpha/wait4.S 8 Nov 2002 02:18:47 -0000 1.5
++++ sysdeps/unix/sysv/linux/alpha/wait4.S 20 Jun 2003 06:31:48 -0000
+@@ -1,4 +1,4 @@
+-/* Copyright (C) 1998 Free Software Foundation, Inc.
++/* Copyright (C) 1998, 2003 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
+@@ -19,7 +19,21 @@
+ #include <sysdep.h>
+ #define _ERRNO_H 1
+ #include <bits/errno.h>
++#include "kernel-features.h"
+
++.text
++
++#if defined HAVE_ELF && defined PIC && defined DO_VERSIONING
++#define WAIT4 __wait4_tv64
++#else
++#define WAIT4 __wait4
++#endif
++
++#if defined __ASSUME_TIMEVAL64
++PSEUDO(WAIT4, wait4, 4)
++ ret
++PSEUDO_END(WAIT4)
++#else
+ /* The problem here is that initially we made struct timeval compatible with
+ OSF/1, using int32. But we defined time_t with uint64, and later found
+ that POSIX requires tv_sec to be time_t.
+@@ -30,14 +44,6 @@
+ functions which have RT equivalents. */
+ .comm __libc_missing_axp_tv64, 4
+
+-.text
+-
+-#if defined HAVE_ELF && defined PIC && defined DO_VERSIONING
+-#define WAIT4 __wait4_tv64
+-#else
+-#define WAIT4 __wait4
+-#endif
+-
+ LEAF(WAIT4, 32)
+ ldgp gp, 0(pv)
+ subq sp, 32, sp
+@@ -135,6 +141,7 @@ $error:
+ SYSCALL_ERROR_HANDLER
+
+ END(WAIT4)
++#endif /* __ASSUME_TIMEVAL64 */
+
+ #if defined HAVE_ELF && defined PIC && defined DO_VERSIONING
+ default_symbol_version (__wait4_tv64, __wait4, GLIBC_2.1)
+Index: sysdeps/unix/sysv/linux/alpha/xmknod.c
+===================================================================
+RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/alpha/xmknod.c,v
+retrieving revision 1.4
+diff -c -p -d -u -r1.4 xmknod.c
+--- sysdeps/unix/sysv/linux/alpha/xmknod.c 4 Aug 2002 09:23:45 -0000 1.4
++++ sysdeps/unix/sysv/linux/alpha/xmknod.c 20 Jun 2003 06:31:48 -0000
+@@ -1,5 +1,6 @@
+ /* xmknod call using old-style Unix mknod system call.
+- Copyright (C) 1991,1993,1995,1996,1997,2002 Free Software Foundation, Inc.
++ Copyright (C) 1991,1993,1995,1996,1997,2002,2003
++ 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
+@@ -21,8 +22,7 @@
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <sys/sysmacros.h>
+-
+-extern int __syscall_mknod (const char *, unsigned int, unsigned int);
++#include <sysdep.h>
+
+ /* Create a device file named PATH, with permission and special bits MODE
+ and device number DEV (which can be constructed from major and minor
+@@ -41,7 +41,7 @@ __xmknod (int vers, const char *path, mo
+ /* We must convert the value to dev_t type used by the kernel. */
+ k_dev = ((major (*dev) & 0xff) << 8) | (minor (*dev) & 0xff);
+
+- return __syscall_mknod (path, mode, k_dev);
++ return INLINE_SYSCALL (mknod, 3, path, mode, k_dev);
+ }
+
+ weak_alias (__xmknod, _xmknod)
+Index: sysdeps/unix/sysv/linux/alpha/xstatconv.c
+===================================================================
+RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/alpha/xstatconv.c,v
+retrieving revision 1.4
+diff -c -p -d -u -r1.4 xstatconv.c
+--- sysdeps/unix/sysv/linux/alpha/xstatconv.c 11 Jun 2003 22:37:05 -0000 1.4
++++ sysdeps/unix/sysv/linux/alpha/xstatconv.c 20 Jun 2003 06:31:48 -0000
+@@ -20,7 +20,7 @@
+ #include <errno.h>
+ #include <string.h>
+ #include <sys/stat.h>
+-
++#include <kernel_stat.h>
+ #include <xstatconv.h>
+
+