about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog17
-rw-r--r--localedata/Makefile23
-rw-r--r--localedata/gen-locale.sh45
-rw-r--r--localedata/sort-test.sh15
-rwxr-xr-xlocaledata/tst-ctype.sh23
-rwxr-xr-xlocaledata/tst-mbswcs.sh19
-rw-r--r--stdio-common/printf_fp.c4
-rw-r--r--sysdeps/ieee754/dbl-64/s_exp2.c3
-rw-r--r--sysdeps/ieee754/flt-32/s_exp2f.c3
-rw-r--r--sysdeps/unix/sysv/linux/ia64/bits/ipc.h54
-rw-r--r--sysdeps/unix/sysv/linux/ia64/bits/shm.h88
-rw-r--r--sysdeps/unix/sysv/linux/ia64/fstatfs64.c1
-rw-r--r--sysdeps/unix/sysv/linux/ia64/ftruncate64.c1
-rw-r--r--sysdeps/unix/sysv/linux/ia64/getrlimit64.c1
-rw-r--r--sysdeps/unix/sysv/linux/ia64/glob.c7
-rw-r--r--sysdeps/unix/sysv/linux/ia64/glob64.c1
-rw-r--r--sysdeps/unix/sysv/linux/ia64/ioperm.c211
-rw-r--r--sysdeps/unix/sysv/linux/ia64/pread64.c1
-rw-r--r--sysdeps/unix/sysv/linux/ia64/pwrite64.c1
-rw-r--r--sysdeps/unix/sysv/linux/ia64/readdir.c7
-rw-r--r--sysdeps/unix/sysv/linux/ia64/readdir64.c1
-rw-r--r--sysdeps/unix/sysv/linux/ia64/readdir64_r.c1
-rw-r--r--sysdeps/unix/sysv/linux/ia64/readdir_r.c4
-rw-r--r--sysdeps/unix/sysv/linux/ia64/setrlimit64.c1
-rw-r--r--sysdeps/unix/sysv/linux/ia64/shmctl.c31
-rw-r--r--sysdeps/unix/sysv/linux/ia64/statfs64.c1
-rw-r--r--sysdeps/unix/sysv/linux/ia64/syscalls.list2
-rw-r--r--sysdeps/unix/sysv/linux/ia64/truncate64.c1
28 files changed, 505 insertions, 62 deletions
diff --git a/ChangeLog b/ChangeLog
index 17f2831f14..09f6856604 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2000-06-29  Ulrich Drepper  <drepper@redhat.com>
+
+	* stdio-common/printf_fp.c (__printf_fp): Don't clobber pointer which
+	we later need to calling free().
+	Patch by Matt Wilson <msw@redhat.com>.
+
+2000-06-27  David Mosberger-Tang  <davidm@hpl.hp.com>
+
+	* sysdeps/unix/sysv/linux/ia64/bits/ipc.h: New file.
+	* sysdeps/unix/sysv/linux/ia64/bits/shm.h: New file.
+
+2000-06-28  Jes Sorensen  <jes@linuxcare.com>
+
+	* sysdeps/ieee754/dbl-64/s_exp2.c: Add include stdlib.h to get
+	prototype for abs().
+	* sysdeps/ieee754/flt-32/s_exp2f.c: ditto.
+
 2000-06-23  Andreas Jaeger  <aj@suse.de>
 
 	* config.h.in: Don't use regparm with bounded pointers.
diff --git a/localedata/Makefile b/localedata/Makefile
index 97126bfd40..7658ff727a 100644
--- a/localedata/Makefile
+++ b/localedata/Makefile
@@ -135,10 +135,27 @@ do-tst-trans: tst-trans.sh $(objpfx)tst-trans
 do-tst-mbswcs: tst-mbswcs.sh $(objpfx)tst-mbswcs1 $(objpfx)tst-mbswcs2 \
 	       $(objpfx)tst-mbswcs3 $(objpfx)tst-mbswcs4 $(objpfx)tst-mbswcs5
 	$(SHELL) -e $< $(common-objpfx)
-do-tst-ctype: tst-ctype.sh $(objpfx)tst-ctype do-collate-test do-tst-mbswcs
+do-tst-ctype: tst-ctype.sh $(objpfx)tst-ctype do-collate-test
 	$(SHELL) -e $< $(common-objpfx)
-$(addsuffix .out,$(addprefix $(objpfx),$(locale_test_suite))): %: do-tst-ctype\
-	 do-tst-mbswcs
+
+# Theses locales are generated by gen-locale.sh
+LOCALES := de_DE.ISO-8859-1 de_DE.UTF-8 en_US.ANSI_X3.4-1968 \
+	   en_US.ISO-8859-1 ja_JP.EUC-JP 
+
+LOCALE_FILES := LC_ADDRESS LC_IDENTIFICATION LC_MONETARY LC_PAPER       \
+		LC_COLLATE LC_MEASUREMENT LC_NAME LC_TELEPHONE LC_CTYPE \
+		LC_NUMERIC LC_TIME LC_MESSAGES/SYS_LC_MESSAGES
+
+ALL_LC_FILES := $(foreach locale, $(LOCALES), \
+			  $(addprefix $(locale)/, $(LOCALE_FILES)))
+
+ALL_OBJ_LC_FILES := $(addprefix $(objpfx), $(ALL_LC_FILES))
+
+$(ALL_OBJ_LC_FILES): gen-locale.sh Makefile charmaps/* locales/*
+	$(SHELL) -e gen-locale.sh $(common-objpfx)
+
+$(addsuffix .out,$(addprefix $(objpfx),$(locale_test_suite))): %: $(ALL_OBJ_LC_FILES)
+
 endif
 endif
 
diff --git a/localedata/gen-locale.sh b/localedata/gen-locale.sh
new file mode 100644
index 0000000000..4bc7031f71
--- /dev/null
+++ b/localedata/gen-locale.sh
@@ -0,0 +1,45 @@
+#! /bin/sh
+# Generate test locale files
+# Copyright (C) 2000 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 Library General Public License as
+# published by the Free Software Foundation; either version 2 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
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public
+# License along with the GNU C Library; see the file COPYING.LIB.  If
+# not, write to the Free Software Foundation, Inc.,
+# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+common_objpfx=$1; shift
+
+generate_locale ()
+{
+    charmap=$1
+    input=$2
+    out=$3
+    I18NPATH=. GCONV_PATH=${common_objpfx}iconvdata \
+    ${common_objpfx}elf/ld.so --library-path $common_objpfx \
+    ${common_objpfx}locale/localedef --quiet -c -f $charmap -i $input \
+      ${common_objpfx}localedata/$out
+
+    if [ $? -ne 0 ]; then
+	echo "Charmap: \"${charmap}\" Inputfile: \"${input}\"" \
+	     "Outputdir: \"${out}\" failed"
+	exit 1
+    fi
+}
+
+generate_locale UTF8 de_DE de_DE.UTF-8
+generate_locale ISO-8859-1 de_DE de_DE.ISO-8859-1
+generate_locale ISO-8859-1 en_US en_US.ISO-8859-1
+generate_locale EUC-JP ja_JP ja_JP.EUC-JP
+generate_locale ANSI_X3.4-1968 en_US en_US.ANSI_X3.4-1968
+
diff --git a/localedata/sort-test.sh b/localedata/sort-test.sh
index be5693a492..18dbcd5362 100644
--- a/localedata/sort-test.sh
+++ b/localedata/sort-test.sh
@@ -6,29 +6,18 @@ lang=$*
 id=${PPID:-100}
 here=`pwd`
 
-# Generate data files.
-for l in $lang; do
-  cns=`echo $l | sed 's/\(.*\)[.][^.]*/\1/'`
-  cn=locales/$cns
-  fn=charmaps/`echo $l | sed 's/.*[.]\([^.]*\)/\1/'`
-  I18NPATH=. GCONV_PATH=${common_objpfx}/iconvdata \
-   ${common_objpfx}elf/ld.so --library-path $common_objpfx \
-   ${common_objpfx}locale/localedef --quiet -i $cn -f $fn \
-   ${common_objpfx}localedata/$cns
-done
-
 # Run collation tests.
 status=0
 for l in $lang; do
   cns=`echo $l | sed 's/\(.*\)[.][^.]*/\1/'`
   LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}/iconvdata \
-   LC_ALL=$cns ${common_objpfx}elf/ld.so --library-path $common_objpfx \
+   LC_ALL=$l ${common_objpfx}elf/ld.so --library-path $common_objpfx \
    ${common_objpfx}localedata/collate-test $id < $cns.in \
    > ${common_objpfx}localedata/$cns.out || status=1
   cmp -s $cns.in ${common_objpfx}localedata/$cns.out || status=1
 
   LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}/iconvdata \
-   LC_ALL=$cns ${common_objpfx}elf/ld.so --library-path $common_objpfx \
+   LC_ALL=$l ${common_objpfx}elf/ld.so --library-path $common_objpfx \
    ${common_objpfx}localedata/xfrm-test $id < $cns.in \
    > ${common_objpfx}localedata/$cns.xout || status=1
   cmp -s $cns.in ${common_objpfx}localedata/$cns.xout || status=1
diff --git a/localedata/tst-ctype.sh b/localedata/tst-ctype.sh
index 135d7b4daf..32926d8c9d 100755
--- a/localedata/tst-ctype.sh
+++ b/localedata/tst-ctype.sh
@@ -19,29 +19,6 @@
 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 common_objpfx=$1; shift
-
-generate_locale ()
-{
-    charmap=$1
-    input=$2
-    out=$3
-    I18NPATH=. GCONV_PATH=${common_objpfx}iconvdata \
-    ${common_objpfx}elf/ld.so --library-path $common_objpfx \
-    ${common_objpfx}locale/localedef --quiet -c -f $charmap -i $input \
-      ${common_objpfx}localedata/$out
-
-    if [ $? -ne 0 ]; then
-	echo "Charmap: \"${charmap}\" Inputfile: \"${input}\"" \
-	     "Outputdir: \"${out}\" failed"
-	exit 1
-    fi
-}
-
-generate_locale EUC-JP ja_JP ja_JP.EUC-JP
-# XXX This is a hack for now.  We need the en_US.ANSI_X3.4-1968 locale
-# XXX elsewhere
-generate_locale ANSI_X3.4-1968 en_US en_US.ANSI_X3.4-1968
-
 status=0
 
 # Run the test programs.
diff --git a/localedata/tst-mbswcs.sh b/localedata/tst-mbswcs.sh
index 02bb273669..267ab48da2 100755
--- a/localedata/tst-mbswcs.sh
+++ b/localedata/tst-mbswcs.sh
@@ -20,25 +20,6 @@
 
 common_objpfx=$1; shift
 
-generate_locale ()
-{
-    charmap=$1
-    input=$2
-    out=$3
-    I18NPATH=. GCONV_PATH=${common_objpfx}iconvdata \
-    ${common_objpfx}elf/ld.so --library-path $common_objpfx \
-    ${common_objpfx}locale/localedef --quiet -c -f $charmap -i $input \
-      ${common_objpfx}localedata/$out
-
-    if [ $? -ne 0 ]; then
-	echo "Charmap: \"${charmap}\" Inputfile: \"${input}\"" \
-	     "Outputdir: \"${out}\" failed"
-	exit 1
-    fi
-}
-
-generate_locale UTF8 de_DE de_DE.UTF-8
-
 status=0
 
 # Run the test programs.
diff --git a/stdio-common/printf_fp.c b/stdio-common/printf_fp.c
index 1de19c2607..67161be586 100644
--- a/stdio-common/printf_fp.c
+++ b/stdio-common/printf_fp.c
@@ -1072,6 +1072,7 @@ __printf_fp (FILE *fp,
     {
       char *buffer = NULL;
       char *cp = NULL;
+      char *tmpptr;
 
       if (! wide)
 	{
@@ -1112,7 +1113,8 @@ __printf_fp (FILE *fp,
 	      *cp++ = (char) *copywc;
 	}
 
-      PRINT (buffer, wstartp, wide ? wcp - wstartp : cp - buffer);
+      tmpptr = buffer;
+      PRINT (tmpptr, wstartp, wide ? wcp - wstartp : cp - tmpptr);
 
       /* Free the memory if necessary.  */
       if (buffer_malloced)
diff --git a/sysdeps/ieee754/dbl-64/s_exp2.c b/sysdeps/ieee754/dbl-64/s_exp2.c
index 875d4d6f2c..d02af15ecc 100644
--- a/sysdeps/ieee754/dbl-64/s_exp2.c
+++ b/sysdeps/ieee754/dbl-64/s_exp2.c
@@ -1,5 +1,5 @@
 /* Double-precision floating point 2^x.
-   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Geoffrey Keating <geoffk@ozemail.com.au>
 
@@ -27,6 +27,7 @@
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE
 #endif
+#include <stdlib.h>
 #include <float.h>
 #include <ieee754.h>
 #include <math.h>
diff --git a/sysdeps/ieee754/flt-32/s_exp2f.c b/sysdeps/ieee754/flt-32/s_exp2f.c
index 8229885453..4d529ea285 100644
--- a/sysdeps/ieee754/flt-32/s_exp2f.c
+++ b/sysdeps/ieee754/flt-32/s_exp2f.c
@@ -1,5 +1,5 @@
 /* Single-precision floating point 2^x.
-   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Geoffrey Keating <geoffk@ozemail.com.au>
 
@@ -28,6 +28,7 @@
 #ifndef _GNU_SOURCE
 # define _GNU_SOURCE
 #endif
+#include <stdlib.h>
 #include <float.h>
 #include <ieee754.h>
 #include <math.h>
diff --git a/sysdeps/unix/sysv/linux/ia64/bits/ipc.h b/sysdeps/unix/sysv/linux/ia64/bits/ipc.h
new file mode 100644
index 0000000000..12c424b4fd
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ia64/bits/ipc.h
@@ -0,0 +1,54 @@
+/* Copyright (C) 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+	Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _SYS_IPC_H
+# error "Never use <bits/ipc.h> directly; include <sys/ipc.h> instead."
+#endif
+
+#include <sys/types.h>
+
+/* Mode bits for `msgget', `semget', and `shmget'.  */
+#define IPC_CREAT	01000		/* Create key if key does not exist. */
+#define IPC_EXCL	02000		/* Fail if key exists.  */
+#define IPC_NOWAIT	04000		/* Return error on wait.  */
+
+/* Control commands for `msgctl', `semctl', and `shmctl'.  */
+#define IPC_RMID	0		/* Remove identifier.  */
+#define IPC_SET		1		/* Set `ipc_perm' options.  */
+#define IPC_STAT	2		/* Get `ipc_perm' options.  */
+#define IPC_INFO	3		/* See ipcs.  */
+
+/* Special key values.  */
+#define IPC_PRIVATE	((__key_t) 0)	/* Private key.  */
+
+
+/* Data structure used to pass permission information to IPC operations.  */
+struct ipc_perm
+  {
+    __key_t __key;			/* Key.  */
+    __uid_t uid;			/* Owner's user ID.  */
+    __gid_t gid;			/* Owner's group ID.  */
+    __uid_t cuid;			/* Creator's user ID.  */
+    __gid_t cgid;			/* Creator's group ID.  */
+    __mode_t mode;			/* Read/write permission.  */
+    unsigned short int __seq;		/* Sequence number.  */
+    unsigned short int __pad1;
+    unsigned long int __unused1;
+    unsigned long int __unused2;
+  };
diff --git a/sysdeps/unix/sysv/linux/ia64/bits/shm.h b/sysdeps/unix/sysv/linux/ia64/bits/shm.h
new file mode 100644
index 0000000000..3001eab7d1
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ia64/bits/shm.h
@@ -0,0 +1,88 @@
+/* Copyright (C) 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+	Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _SYS_SHM_H
+# error "Never include <bits/shm.h> directly; use <sys/shm.h> instead."
+#endif
+
+#include <sys/types.h>
+
+/* Permission flag for shmget.  */
+#define SHM_R           0400            /* or S_IRUGO from <linux/stat.h> */
+#define SHM_W           0200            /* or S_IWUGO from <linux/stat.h> */
+
+/* Flags for `shmat'.  */
+#define SHM_RDONLY	010000		/* attach read-only else read-write */
+#define SHM_RND		020000		/* round attach address to SHMLBA */
+#define SHM_REMAP	040000		/* take-over region on attach */
+
+/* Commands for `shmctl'.  */
+#define SHM_LOCK	11		/* lock segment (root only) */
+#define SHM_UNLOCK	12		/* unlock segment (root only) */
+
+
+/* Data structure describing a set of semaphores.  */
+struct shmid_ds
+  {
+    struct ipc_perm shm_perm;		/* operation permission struct */
+    size_t shm_segsz;			/* size of segment in bytes */
+    __time_t shm_atime;			/* time of last shmat() */
+    __time_t shm_dtime;			/* time of last shmdt() */
+    __time_t shm_ctime;			/* time of last change by shmctl() */
+    __pid_t shm_cpid;			/* pid of creator */
+    __pid_t shm_lpid;			/* pid of last shmop */
+    unsigned long int shm_nattch;	/* number of current attaches */
+    unsigned long int __unused1;
+    unsigned long int __unused2;
+  };
+
+#ifdef __USE_MISC
+
+/* ipcs ctl commands */
+# define SHM_STAT 	13
+# define SHM_INFO 	14
+
+/* shm_mode upper byte flags */
+# define SHM_DEST	01000	/* segment will be destroyed on last detach */
+# define SHM_LOCKED	02000   /* segment will not be swapped */
+
+struct	shminfo
+  {
+    unsigned long int shmmax;
+    unsigned long int shmmin;
+    unsigned long int shmmni;
+    unsigned long int shmseg;
+    unsigned long int shmall;
+    unsigned long int __unused1;
+    unsigned long int __unused2;
+    unsigned long int __unused3;
+    unsigned long int __unused4;
+  };
+
+struct shm_info
+  {
+    int used_ids;
+    unsigned long int shm_tot;	/* total allocated shm */
+    unsigned long int shm_rss;	/* total resident shm */
+    unsigned long int shm_swp;	/* total swapped shm */
+    unsigned long int swap_attempts;
+    unsigned long int swap_successes;
+  };
+
+#endif /* __USE_MISC */
diff --git a/sysdeps/unix/sysv/linux/ia64/fstatfs64.c b/sysdeps/unix/sysv/linux/ia64/fstatfs64.c
new file mode 100644
index 0000000000..2be4e59ba4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ia64/fstatfs64.c
@@ -0,0 +1 @@
+/* fstatfs64 is the same as fstatfs. */
diff --git a/sysdeps/unix/sysv/linux/ia64/ftruncate64.c b/sysdeps/unix/sysv/linux/ia64/ftruncate64.c
new file mode 100644
index 0000000000..673a8b525a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ia64/ftruncate64.c
@@ -0,0 +1 @@
+/* ftruncate64 is the same as ftruncate. */
diff --git a/sysdeps/unix/sysv/linux/ia64/getrlimit64.c b/sysdeps/unix/sysv/linux/ia64/getrlimit64.c
new file mode 100644
index 0000000000..9feab0e6b8
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ia64/getrlimit64.c
@@ -0,0 +1 @@
+/* getrlimit64 is the same as getrlimit. */
diff --git a/sysdeps/unix/sysv/linux/ia64/glob.c b/sysdeps/unix/sysv/linux/ia64/glob.c
new file mode 100644
index 0000000000..b6da989e57
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ia64/glob.c
@@ -0,0 +1,7 @@
+#define glob64 __no_glob64_decl
+#define globfree64 __no_globfree64_decl
+#include <sysdeps/generic/glob.c>
+#undef glob64
+#undef globfree64
+weak_alias (glob, glob64)
+weak_alias (globfree, globfree64)
diff --git a/sysdeps/unix/sysv/linux/ia64/glob64.c b/sysdeps/unix/sysv/linux/ia64/glob64.c
new file mode 100644
index 0000000000..33918ea6a5
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ia64/glob64.c
@@ -0,0 +1 @@
+/* glob64 is in glob.c */
diff --git a/sysdeps/unix/sysv/linux/ia64/ioperm.c b/sysdeps/unix/sysv/linux/ia64/ioperm.c
new file mode 100644
index 0000000000..abe8fea4af
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ia64/ioperm.c
@@ -0,0 +1,211 @@
+/* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+     Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/* I/O access is restricted to ISA port space (ports 0..65535).
+   Modern devices hopefully are sane enough not to put any performance
+   critical registers in i/o space.
+
+   On the first call to ioperm() or iopl(), the entire (E)ISA port
+   space is mapped into the virtual address space at address io.base.
+   mprotect() calls are then used to enable/disable access to ports.
+   Per 4KB page, there are 4 I/O ports.  */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <sys/types.h>
+#include <sys/mman.h>
+
+#include <asm/page.h>
+#include <asm/system.h>
+
+#define MAX_PORT	0x10000
+
+/*
+ * Memory fence w/accept.  This should never be used in code that is
+ * not IA-64 specific.
+ */
+#define __ia64_mf_a()	__asm__ __volatile__ ("mf.a" ::: "memory")
+
+static struct
+  {
+    unsigned long int base;
+    unsigned long int page_mask;
+  }
+io;
+
+__inline__ unsigned long int
+io_offset (unsigned long int port)
+{
+	return ((port >> 2) << 12) | (port & 0xfff);
+}
+
+int
+_ioperm (unsigned long int from, unsigned long int num, int turn_on)
+{
+  unsigned long int addr, len, base;
+  int prot;
+
+  /* this test isn't as silly as it may look like; consider overflows! */
+  if (from >= MAX_PORT || from + num > MAX_PORT)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  if (turn_on)
+    {
+      if (!io.base)
+	{
+	  unsigned long phys_io_base, len;
+	  int fd;
+
+	  io.page_mask = ~(getpagesize() - 1);
+
+	  /* get I/O base physical address from ar.k0 as per PRM: */
+	  __asm__ ("mov %0=ar.k0" : "=r"(phys_io_base));
+
+	  /* The O_SYNC flag tells the /dev/mem driver to map the
+             memory uncached: */
+	  fd = open ("/dev/mem", O_RDWR | O_SYNC);
+	  if (fd < 0)
+	    return -1;
+
+	  len = io_offset (MAX_PORT);
+#if 1
+	  /* see comment below */
+	  base = (unsigned long int) __mmap (0, len, PROT_READ | PROT_WRITE, MAP_SHARED,
+						fd, phys_io_base);
+#else
+	  base = (unsigned long int) __mmap (0, len, PROT_NONE, MAP_SHARED,
+						fd, phys_io_base);
+#endif
+	  close (fd);
+
+	  if ((long) base == -1)
+	    return -1;
+
+	  io.base = base;
+	}
+      prot = PROT_READ | PROT_WRITE;
+    }
+  else
+    {
+      if (!io.base)
+	return 0;	/* never was turned on... */
+
+      prot = PROT_NONE;
+    }
+#if 0
+  /* We can't do mprotect because that would cause us to lose the
+     uncached flag that the /dev/mem driver turned on.  A MAP_UNCACHED
+     flag seems so much cleaner...  */
+  addr = (io.base + io_offset (from)) & io.page_mask;
+  len  = io.base + io_offset (from + num) - addr;
+  return mprotect ((void *) addr, len, prot);
+#else
+  return 0;
+#endif
+}
+
+int
+_iopl (unsigned int level)
+{
+  if (level > 3)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+  if (level)
+    return _ioperm (0, MAX_PORT, 1);
+  return 0;
+}
+
+unsigned int
+_inb (unsigned long int port)
+{
+  volatile unsigned char *addr = (void *) io.base + io_offset (port);
+  unsigned char ret;
+
+  ret = *addr;
+  __ia64_mf_a();
+  return ret;
+}
+
+unsigned int
+_inw (unsigned long int port)
+{
+  volatile unsigned short *addr = (void *) io.base + io_offset (port);
+  unsigned short ret;
+
+  ret = *addr;
+  __ia64_mf_a();
+  return ret;
+}
+
+unsigned int
+_inl (unsigned long int port)
+{
+  volatile unsigned int *addr = (void *) io.base + io_offset (port);
+  unsigned int ret;
+
+  ret = *addr;
+  __ia64_mf_a();
+  return ret;
+}
+
+void
+_outb (unsigned char val, unsigned long int port)
+{
+  volatile unsigned char *addr = (void *) io.base + io_offset (port);
+
+  *addr = val;
+  __ia64_mf_a();
+}
+
+void
+_outw (unsigned short val, unsigned long int port)
+{
+  volatile unsigned short *addr = (void *) io.base + io_offset (port);
+
+  *addr = val;
+  __ia64_mf_a();
+}
+
+void
+_outl (unsigned int val, unsigned long int port)
+{
+  volatile unsigned int *addr = (void *) io.base + io_offset (port);
+
+  *addr = val;
+  __ia64_mf_a();
+}
+
+weak_alias (_ioperm, ioperm);
+weak_alias (_iopl, iopl);
+weak_alias (_inb, inb);
+weak_alias (_inw, inw);
+weak_alias (_inl, inl);
+weak_alias (_outb, outb);
+weak_alias (_outw, outw);
+weak_alias (_outl, outl);
diff --git a/sysdeps/unix/sysv/linux/ia64/pread64.c b/sysdeps/unix/sysv/linux/ia64/pread64.c
new file mode 100644
index 0000000000..b7f298dea8
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ia64/pread64.c
@@ -0,0 +1 @@
+/* Empty since the pread syscall is equivalent.  */
diff --git a/sysdeps/unix/sysv/linux/ia64/pwrite64.c b/sysdeps/unix/sysv/linux/ia64/pwrite64.c
new file mode 100644
index 0000000000..b7f298dea8
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ia64/pwrite64.c
@@ -0,0 +1 @@
+/* Empty since the pread syscall is equivalent.  */
diff --git a/sysdeps/unix/sysv/linux/ia64/readdir.c b/sysdeps/unix/sysv/linux/ia64/readdir.c
new file mode 100644
index 0000000000..300ebb2629
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ia64/readdir.c
@@ -0,0 +1,7 @@
+#define readdir64 __no_readdir64_decl
+#define __readdir64 __no___readdir64_decl
+#include <sysdeps/unix/readdir.c>
+#undef __readdir64
+strong_alias (__readdir, __readdir64)
+#undef readdir64
+weak_alias (__readdir, readdir64)
diff --git a/sysdeps/unix/sysv/linux/ia64/readdir64.c b/sysdeps/unix/sysv/linux/ia64/readdir64.c
new file mode 100644
index 0000000000..9796431dc4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ia64/readdir64.c
@@ -0,0 +1 @@
+/* readdir64 is in readdir.c */
diff --git a/sysdeps/unix/sysv/linux/ia64/readdir64_r.c b/sysdeps/unix/sysv/linux/ia64/readdir64_r.c
new file mode 100644
index 0000000000..b8fe9a31b4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ia64/readdir64_r.c
@@ -0,0 +1 @@
+/* readdir64_r is in readdir_r.c */
diff --git a/sysdeps/unix/sysv/linux/ia64/readdir_r.c b/sysdeps/unix/sysv/linux/ia64/readdir_r.c
new file mode 100644
index 0000000000..adb92db6af
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ia64/readdir_r.c
@@ -0,0 +1,4 @@
+#define readdir64_r __no_readdir64_r_decl
+#include <sysdeps/unix/readdir_r.c>
+#undef readdir64_r
+weak_alias (__readdir_r, readdir64_r)
diff --git a/sysdeps/unix/sysv/linux/ia64/setrlimit64.c b/sysdeps/unix/sysv/linux/ia64/setrlimit64.c
new file mode 100644
index 0000000000..8edcff0086
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ia64/setrlimit64.c
@@ -0,0 +1 @@
+/* setrlimit64 is the same as setrlimit. */
diff --git a/sysdeps/unix/sysv/linux/ia64/shmctl.c b/sysdeps/unix/sysv/linux/ia64/shmctl.c
new file mode 100644
index 0000000000..dbf0782bc1
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ia64/shmctl.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 1995, 1997, 1998, 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <errno.h>
+#include <sys/shm.h>
+#include <ipc_priv.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+
+int
+shmctl (int shmid, int cmd, struct shmid_ds *buf)
+{
+  return INLINE_SYSCALL (ipc, 5, IPCOP_shmctl, shmid, cmd, 0, buf);
+}
diff --git a/sysdeps/unix/sysv/linux/ia64/statfs64.c b/sysdeps/unix/sysv/linux/ia64/statfs64.c
new file mode 100644
index 0000000000..06bc68826f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ia64/statfs64.c
@@ -0,0 +1 @@
+/* statfs64 is the same as statfs. */
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
index fb45729718..7b484051be 100644
--- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
@@ -6,7 +6,7 @@ umount2		-	umount		2	__umount2	umount2
 llseek		EXTRA	lseek		3	__llseek	llseek __lseek64 lseek64
 pread		-	pread		4	__syscall_pread	__syscall_pread64 __pread pread __pread64 pread64
 pwrite		-	pwrite		4	__syscall_pwrite	__syscall_pwrite64 __pwrite pwrite __pwrite64 pwrite64
-fstatfs		-	fstatfs		i:ip	__fstatfs	fstatfs fstatfs64
+fstatfs		-	fstatfs		i:ip	__fstatfs	fstatfs fstatfs64 __fstatfs64
 statfs		-	statfs		i:sp	__statfs	statfs statfs64
 mmap		-	mmap		6	__mmap		mmap __mmap64 mmap64
 getpeername	-	getpeername	i:ipp	__getpeername	getpeername
diff --git a/sysdeps/unix/sysv/linux/ia64/truncate64.c b/sysdeps/unix/sysv/linux/ia64/truncate64.c
new file mode 100644
index 0000000000..8999768874
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ia64/truncate64.c
@@ -0,0 +1 @@
+/* truncate64 is the same as truncate. */