about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-03-21 01:29:48 +0000
committerUlrich Drepper <drepper@redhat.com>2000-03-21 01:29:48 +0000
commit7e836977ea1ccf19880978549590125832226525 (patch)
treeda1be89473bffb9b69226b716332233d31733933 /sysdeps
parentdb8409143eb9aee94e436d22d4c9260d8840b337 (diff)
downloadglibc-7e836977ea1ccf19880978549590125832226525.tar.gz
glibc-7e836977ea1ccf19880978549590125832226525.tar.xz
glibc-7e836977ea1ccf19880978549590125832226525.zip
Update.
2000-03-20  Ulrich Drepper  <drepper@redhat.com>

	* sysdeps/unix/sysv/aix/*: Add initial code for port to AIX 4.3.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/unix/sysv/aix/Makefile0
-rw-r--r--sysdeps/unix/sysv/aix/_exit.c29
-rw-r--r--sysdeps/unix/sysv/aix/accept.c29
-rw-r--r--sysdeps/unix/sysv/aix/access.c10
-rw-r--r--sysdeps/unix/sysv/aix/bits/dirent.h55
-rw-r--r--sysdeps/unix/sysv/aix/bits/dlfcn.h47
-rw-r--r--sysdeps/unix/sysv/aix/bits/endian.h23
-rw-r--r--sysdeps/unix/sysv/aix/bits/errno.h155
-rw-r--r--sysdeps/unix/sysv/aix/bits/fcntl.h137
-rw-r--r--sysdeps/unix/sysv/aix/bits/resource.h191
-rw-r--r--sysdeps/unix/sysv/aix/bits/setjmp.h46
-rw-r--r--sysdeps/unix/sysv/aix/bits/sigaction.h72
-rw-r--r--sysdeps/unix/sysv/aix/bits/sigcontext.h32
-rw-r--r--sysdeps/unix/sysv/aix/bits/signum.h96
-rw-r--r--sysdeps/unix/sysv/aix/bits/sigset.h125
-rw-r--r--sysdeps/unix/sysv/aix/bits/sigstack.h46
-rw-r--r--sysdeps/unix/sysv/aix/bits/socket.h291
-rw-r--r--sysdeps/unix/sysv/aix/bits/stat.h124
-rw-r--r--sysdeps/unix/sysv/aix/bits/statfs.h77
-rw-r--r--sysdeps/unix/sysv/aix/bits/types.h148
-rw-r--r--sysdeps/unix/sysv/aix/bits/uio.h42
-rw-r--r--sysdeps/unix/sysv/aix/bits/utmp.h73
-rw-r--r--sysdeps/unix/sysv/aix/bits/utmpx.h67
-rw-r--r--sysdeps/unix/sysv/aix/bits/utsname.h23
-rw-r--r--sysdeps/unix/sysv/aix/brk.c8
-rw-r--r--sysdeps/unix/sysv/aix/chown.c25
-rw-r--r--sysdeps/unix/sysv/aix/close.c8
-rw-r--r--sysdeps/unix/sysv/aix/configure8
-rw-r--r--sysdeps/unix/sysv/aix/configure.in10
-rw-r--r--sysdeps/unix/sysv/aix/connect.c8
-rw-r--r--sysdeps/unix/sysv/aix/environ.c1
-rw-r--r--sysdeps/unix/sysv/aix/euidaccess.c5
-rw-r--r--sysdeps/unix/sysv/aix/execve.c8
-rw-r--r--sysdeps/unix/sysv/aix/fchown.c25
-rw-r--r--sysdeps/unix/sysv/aix/fcntl.c40
-rw-r--r--sysdeps/unix/sysv/aix/fdatasync.c31
-rw-r--r--sysdeps/unix/sysv/aix/fork.c27
-rw-r--r--sysdeps/unix/sysv/aix/fstatfs.c27
-rw-r--r--sysdeps/unix/sysv/aix/fsync.c31
-rw-r--r--sysdeps/unix/sysv/aix/ftruncate.c28
-rw-r--r--sysdeps/unix/sysv/aix/ftruncate64.c27
-rw-r--r--sysdeps/unix/sysv/aix/fxstat.c31
-rw-r--r--sysdeps/unix/sysv/aix/fxstat64.c32
-rw-r--r--sysdeps/unix/sysv/aix/getdents.c28
-rw-r--r--sysdeps/unix/sysv/aix/getegid.c29
-rw-r--r--sysdeps/unix/sysv/aix/geteuid.c29
-rw-r--r--sysdeps/unix/sysv/aix/getgid.c30
-rw-r--r--sysdeps/unix/sysv/aix/getpeername.c27
-rw-r--r--sysdeps/unix/sysv/aix/getpgid.c28
-rw-r--r--sysdeps/unix/sysv/aix/getpgrp.c1
-rw-r--r--sysdeps/unix/sysv/aix/getpid.c6
-rw-r--r--sysdeps/unix/sysv/aix/getppid.c1
-rw-r--r--sysdeps/unix/sysv/aix/getsid.c27
-rw-r--r--sysdeps/unix/sysv/aix/getsockname.c27
-rw-r--r--sysdeps/unix/sysv/aix/getuid.c30
-rw-r--r--sysdeps/unix/sysv/aix/gnu/lib-names.h31
-rw-r--r--sysdeps/unix/sysv/aix/ioctl.c43
-rw-r--r--sysdeps/unix/sysv/aix/kernel_proto.h25
-rw-r--r--sysdeps/unix/sysv/aix/kill.c8
-rw-r--r--sysdeps/unix/sysv/aix/lchown.c25
-rw-r--r--sysdeps/unix/sysv/aix/libc-start.c20
-rw-r--r--sysdeps/unix/sysv/aix/linux/errnoconv.c125
-rw-r--r--sysdeps/unix/sysv/aix/linux/linux-errno.h135
-rw-r--r--sysdeps/unix/sysv/aix/linux/linux-stat.h131
-rw-r--r--sysdeps/unix/sysv/aix/linux/statconv.c35
-rw-r--r--sysdeps/unix/sysv/aix/lockf.c27
-rw-r--r--sysdeps/unix/sysv/aix/lockf64.c27
-rw-r--r--sysdeps/unix/sysv/aix/lseek.c8
-rw-r--r--sysdeps/unix/sysv/aix/lseek64.c35
-rw-r--r--sysdeps/unix/sysv/aix/lxstat.c33
-rw-r--r--sysdeps/unix/sysv/aix/lxstat64.c34
-rw-r--r--sysdeps/unix/sysv/aix/mmap.c9
-rw-r--r--sysdeps/unix/sysv/aix/mmap64.c30
-rw-r--r--sysdeps/unix/sysv/aix/munmap.c8
-rw-r--r--sysdeps/unix/sysv/aix/nanosleep.c41
-rw-r--r--sysdeps/unix/sysv/aix/open.c37
-rw-r--r--sysdeps/unix/sysv/aix/pread.c27
-rw-r--r--sysdeps/unix/sysv/aix/pread64.c27
-rw-r--r--sysdeps/unix/sysv/aix/profil-counter.h27
-rw-r--r--sysdeps/unix/sysv/aix/read.c29
-rw-r--r--sysdeps/unix/sysv/aix/readlink.c8
-rw-r--r--sysdeps/unix/sysv/aix/readv.c37
-rw-r--r--sysdeps/unix/sysv/aix/recvfrom.c29
-rw-r--r--sysdeps/unix/sysv/aix/recvmsg.c27
-rw-r--r--sysdeps/unix/sysv/aix/revoke.c41
-rw-r--r--sysdeps/unix/sysv/aix/sbrk.c8
-rw-r--r--sysdeps/unix/sysv/aix/sched_yield.c31
-rw-r--r--sysdeps/unix/sysv/aix/sendmsg.c27
-rw-r--r--sysdeps/unix/sysv/aix/setegid.c32
-rw-r--r--sysdeps/unix/sysv/aix/seteuid.c32
-rw-r--r--sysdeps/unix/sysv/aix/setgid.c32
-rw-r--r--sysdeps/unix/sysv/aix/setregid.c42
-rw-r--r--sysdeps/unix/sysv/aix/setreuid.c41
-rw-r--r--sysdeps/unix/sysv/aix/setuid.c31
-rw-r--r--sysdeps/unix/sysv/aix/sigaction.c35
-rw-r--r--sysdeps/unix/sysv/aix/sigpending.c30
-rw-r--r--sysdeps/unix/sysv/aix/sigprocmask.c8
-rw-r--r--sysdeps/unix/sysv/aix/sigset-cvt-mask.h28
-rw-r--r--sysdeps/unix/sysv/aix/sigsuspend.c32
-rw-r--r--sysdeps/unix/sysv/aix/statfs.c27
-rw-r--r--sysdeps/unix/sysv/aix/sys/param.h18
-rw-r--r--sysdeps/unix/sysv/aix/sys/ucontext.h113
-rw-r--r--sysdeps/unix/sysv/aix/syscall.c2
-rw-r--r--sysdeps/unix/sysv/aix/sysdep.h88
-rw-r--r--sysdeps/unix/sysv/aix/truncate.c28
-rw-r--r--sysdeps/unix/sysv/aix/truncate64.c28
-rw-r--r--sysdeps/unix/sysv/aix/uname.c1
-rw-r--r--sysdeps/unix/sysv/aix/wait3.c42
-rw-r--r--sysdeps/unix/sysv/aix/wait4.c33
-rw-r--r--sysdeps/unix/sysv/aix/waitid.c82
-rw-r--r--sysdeps/unix/sysv/aix/waitpid.c52
-rw-r--r--sysdeps/unix/sysv/aix/write.c34
-rw-r--r--sysdeps/unix/sysv/aix/writev.c37
-rw-r--r--sysdeps/unix/sysv/aix/xstat.c33
-rw-r--r--sysdeps/unix/sysv/aix/xstat64.c34
115 files changed, 4761 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/aix/Makefile b/sysdeps/unix/sysv/aix/Makefile
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/Makefile
diff --git a/sysdeps/unix/sysv/aix/_exit.c b/sysdeps/unix/sysv/aix/_exit.c
new file mode 100644
index 0000000000..f4654c1d3a
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/_exit.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 1999 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.  */
+
+#include <stdlib.h>
+
+
+/* We define only thr alias introduced in ISO C99 because _exit itself
+   is a system call.  */
+void
+_Exit (status)
+     int status;
+{
+  _exit (status);
+}
diff --git a/sysdeps/unix/sysv/aix/accept.c b/sysdeps/unix/sysv/aix/accept.c
new file mode 100644
index 0000000000..364f02b4f8
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/accept.c
@@ -0,0 +1,29 @@
+/* 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.  */
+
+#include <assert.h>
+#include <sys/socket.h>
+
+extern int naccept (int s, void *uap_name, int *uap_anamelen);
+
+int
+accept (int fd, __SOCKADDR_ARG addr, socklen_t *addr_len)
+{
+  assert (sizeof (socklen_t) == sizeof (int));
+  return naccept (fd, addr.__sockaddr__, addr_len);
+}
diff --git a/sysdeps/unix/sysv/aix/access.c b/sysdeps/unix/sysv/aix/access.c
new file mode 100644
index 0000000000..e25ee8f686
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/access.c
@@ -0,0 +1,10 @@
+#include <unistd.h>
+
+extern int accessx (const char *name, int type, int who);
+
+int
+__access (const char *name, int type)
+{
+  return accessx (name, type, ACC_INVOKER);
+}
+strong_alias (__access, access)
diff --git a/sysdeps/unix/sysv/aix/bits/dirent.h b/sysdeps/unix/sysv/aix/bits/dirent.h
new file mode 100644
index 0000000000..48fb1b220f
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/bits/dirent.h
@@ -0,0 +1,55 @@
+/* Directory entry structure `struct dirent'.  Old System V version.
+   Copyright (C) 1996, 1997, 1999 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.  */
+
+#ifndef _DIRENT_H
+# error "Never use <bits/dirent.h> directly; include <dirent.h> instead."
+#endif
+
+struct dirent
+  {
+#ifndef __USE_FILE_OFFSET64
+    __off_t d_off;
+    __ino_t d_ino;
+#else
+    __off64_t d_off;
+    __ino64_t d_ino;
+#endif
+    unsigned short int d_reclen;
+    unsigned short int d_namlen;
+    char d_name[256];
+  };
+
+#ifdef __USE_LARGEFILE64
+struct dirent64
+  {
+    __off64_t d_off;
+    __ino64_t d_ino;
+    unsigned short int d_reclen;
+    unsigned short int d_namlen;
+    char d_name[256];
+  };
+#endif
+
+#define d_fileno	d_ino	/* Backwards compatibility.  */
+#define d_offset	d_off
+
+#define _DIRENT_HAVE_D_NAMLEN
+#define _DIRENT_HAVE_D_RECLEN
+#define _DIRENT_HAVE_D_OFF
+#undef  _DIRENT_HAVE_D_TYPE
diff --git a/sysdeps/unix/sysv/aix/bits/dlfcn.h b/sysdeps/unix/sysv/aix/bits/dlfcn.h
new file mode 100644
index 0000000000..e67c9a8c7c
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/bits/dlfcn.h
@@ -0,0 +1,47 @@
+/* AIX dependent definitions for run-time dynamic loading.
+   Copyright (C) 1996, 1997, 1998, 1999, 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.  */
+
+#ifndef _DLFCN_H
+# error "Never use <bits/dlfcn.h> directly; include <dlfcn.h> instead."
+#endif
+
+/* The MODE argument to `dlopen' contains one of the following: */
+#define RTLD_LAZY	0x004	/* Lazy function call binding.  */
+#define RTLD_NOW	0x002	/* Immediate function call binding.  */
+#define	RTLD_BINDING_MASK 0x6	/* Mask of binding time value.  */
+
+/* If the following bit is set in the MODE argument to `dlopen',
+   the symbols of the loaded object and its dependencies are made
+   visible as if the object were linked directly into the program.  */
+#define RTLD_GLOBAL	0x10000
+
+/* Unix98 demands the following flag which is the inverse to RTLD_GLOBAL.
+   The implementation does this by default and so we can define the
+   value to zero.  */
+#define RTLD_LOCAL	0x800000
+
+#ifdef __USE_GNU
+/* These are extensions of the AIX kernel.  */
+# define RTLD_NOAUTODEFER	0x020000
+# define RTLD_MEMBER		0x040000
+# define RTLD_UNIX_LATEST	0x100000
+#endif
+
+/* No support to profile shared libraries available.  */
+# define DL_CALL_FCT(fctp, args) fctp args
diff --git a/sysdeps/unix/sysv/aix/bits/endian.h b/sysdeps/unix/sysv/aix/bits/endian.h
new file mode 100644
index 0000000000..a86de7e502
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/bits/endian.h
@@ -0,0 +1,23 @@
+/* Copyright (C) 1997, 1998, 1999 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.  */
+
+#ifndef _ENDIAN_H
+# error "Never use <bits/endian.h> directly; include <endian.h> instead."
+#endif
+
+#define __BYTE_ORDER __BIG_ENDIAN
diff --git a/sysdeps/unix/sysv/aix/bits/errno.h b/sysdeps/unix/sysv/aix/bits/errno.h
new file mode 100644
index 0000000000..37800c3874
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/bits/errno.h
@@ -0,0 +1,155 @@
+/* Copyright (C) 1999 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.  */
+
+/* This file defines the `errno' constants.  */
+
+#if !defined __Emath_defined && (defined _ERRNO_H || defined __need_Emath)
+#undef	__need_Emath
+#define	__Emath_defined	1
+
+#endif
+
+#ifdef	_ERRNO_H
+# undef EDOM
+# undef EILSEQ
+# undef ERANGE
+
+# define EPERM		1	/* Operation not permitted.  */
+# define ENOENT		2	/* No such file or directory.  */
+# define ESRCH		3	/* No such process.  */
+# define EINTR		4	/* interrupted system call.  */
+# define EIO		5	/* I/O error.  */
+# define ENXIO		6	/* No such device or address.  */
+# define E2BIG		7	/* Arg list too long.  */
+# define ENOEXEC	8	/* Exec format error.  */
+# define EBADF		9	/* Bad file descriptor.  */
+# define ECHILD		10	/* No child processes.  */
+# define EAGAIN		11	/* Resource temporarily unavailable.  */
+# define ENOMEM		12	/* Not enough space.  */
+# define EACCES		13	/* Permission denied.  */
+# define EFAULT		14	/* Bad address.  */
+# define ENOTBLK	15	/* Block device required.  */
+# define EBUSY		16	/* Resource busy.  */
+# define EEXIST		17	/* File exists.  */
+# define EXDEV		18	/* Improper link.  */
+# define ENODEV		19	/* No such device.  */
+# define ENOTDIR	20	/* Not a directory.  */
+# define EISDIR		21	/* Is a directory.  */
+# define EINVAL		22	/* Invalid argument.  */
+# define ENFILE		23	/* Too many open files in system.  */
+# define EMFILE		24	/* Too many open files.  */
+# define ENOTTY		25	/* Inappropriate I/O control operation.  */
+# define ETXTBSY	26	/* Text file busy.  */
+# define EFBIG		27	/* File too large.  */
+# define ENOSPC		28	/* No space left on device.  */
+# define ESPIPE		29	/* Invalid seek.  */
+# define EROFS		30	/* Read only file system.  */
+# define EMLINK		31	/* Too many links.  */
+# define EPIPE		32	/* Broken pipe.  */
+# define EDOM		33	/* Domain error within math function.  */
+# define ERANGE		34	/* Result too large.  */
+# define ENOMSG		35	/* No message of desired type.  */
+# define EIDRM		36	/* Identifier removed.  */
+# define ECHRNG		37	/* Channel number out of range.  */
+# define EL2NSYNC	38	/* Level 2 not synchronized.  */
+# define EL3HLT		39	/* Level 3 halted.  */
+# define EL3RST		40	/* Level 3 reset.  */
+# define ELNRNG		41	/* Link number out of range.  */
+# define EUNATCH	42	/* Protocol driver not attached.  */
+# define ENOCSI		43	/* No CSI structure available.  */
+# define EL2HLT		44	/* Level 2 halted.  */
+# define EDEADLK	45	/* Resource deadlock avoided.  */
+# define ENOTREADY	46	/* Device not ready.  */
+# define EWRPROTECT	47	/* Write-protected media.  */
+# define EFORMAT	48	/* Unformatted media.  */
+# define ENOLCK		49	/* No locks available.  */
+# define ENOCONNECT	50	/* No connection.  */
+# define ESTALE		52	/* No filesystem.  */
+# define EDIST		53	/* Old, currently unused AIX errno.  */
+# if __USE_XOPEN_EXTENDED
+#  define EWOULDBLOCK	EAGAIN	/* Operation would block.  */
+# else /* __USE_XOPEN_EXTENDED */
+#  define EWOULDBLOCK	54
+# endif /* __USE_XOPEN_EXTENDED */
+# define EINPROGRESS	55	/* Operation now in progress.  */
+# define EALREADY	56	/* Operation already in progress.  */
+# define ENOTSOCK	57	/* Socket operation on non-socket.  */
+# define EDESTADDRREQ	58	/* Destination address required.  */
+# define EDESTADDREQ	EDESTADDRREQ /* Destination address required.  */
+# define EMSGSIZE	59	/* Message too long.  */
+# define EPROTOTYPE	60	/* Protocol wrong type for socket.  */
+# define ENOPROTOOPT	61	/* Protocol not available.  */
+# define EPROTONOSUPPORT 62	/* Protocol not supported.  */
+# define ESOCKTNOSUPPORT 63	/* Socket type not supported.  */
+# define EOPNOTSUPP	64	/* Operation not supported on socket.  */
+# define EPFNOSUPPORT	65	/* Protocol family not supported.  */
+# define EADDRINUSE	67	/* Address already in use.  */
+# define EADDRNOTAVAIL	68	/* Can't assign requested address.  */
+# define ENETDOWN	69	/* Network is down.  */
+# define ENETUNREACH	70	/* Network is unreachable.  */
+# define ENETRESET	71	/* Network dropped connection on reset.  */
+# define ECONNABORTED	72	/* Software caused connection abort.  */
+# define ECONNRESET	73	/* Connection reset by peer.  */
+# define ENOBUFS	74	/* No buffer space available.  */
+# define EISCONN	75	/* Socket is already connected.  */
+# define ENOTCONN	76	/* Socket is not connected.  */
+# define ESHUTDOWN	77	/* Can't send after socket shutdown.  */
+# define ETIMEDOUT	78	/* Connection timed out.  */
+# define ECONNREFUSED	79	/* Connection refused.  */
+# define EHOSTDOWN	80	/* Host is down.  */
+# define EHOSTUNREACH	81	/* No route to host.  */
+# define ERESTART	82	/* Restart the system call.  */
+# define EPROCLIM	83	/* Too many processes.  */
+# define EUSERS		84	/* Too many users.  */
+# define ELOOP		85	/* Too many levels of symbolic links.  */
+# define ENAMETOOLONG	86	/* File name too long.  */
+# define ENOTEMPTY	EEXIST	/* Directory not empty.  */
+# define EDQUOT		88	/* Disc quota exceeded.  */
+# define ECORRUPT	89	/* Invalid file system control data.  */
+# define EREMOTE	93	/* Item is not local to host.  */
+# define ENOSYS		109	/* Function not implemented POSIX.  */
+# define EMEDIA		110	/* Media surface error.  */
+# define ESOFT		111	/* I/O completed, but needs relocation.  */
+# define ENOATTR	112	/* No attribute found.  */
+# define ESAD		113	/* Security authentication denied.  */
+# define ENOTRUST	114	/* Not a trusted program.  */
+# define ETOOMANYREFS	115	/* Too many references: can't splice.  */
+# define EILSEQ		116	/* Invalid wide character.  */
+# define ECANCELED	117	/* Asynchronous i/o cancelled.  */
+# define ENOSR		118	/* Temp out of streams resources.  */
+# define ETIME		119	/* I_STR ioctl timed out.  */
+# define EBADMSG	120	/* Wrong message type at stream head.  */
+# define EPROTO		121	/* STREAMS protocol error.  */
+# define ENODATA	122	/* No message ready at stream head.  */
+# define ENOSTR		123	/* Fd is not a stream.  */
+# define ECLONEME	ERESTART /* This is the way we clone a stream.  */
+# define ENOTSUP	124	/* POSIX threads unsupported value.  */
+# define EMULTIHOP	125	/* Multihop is not allowed.  */
+# define ENOLINK	126	/* The link has been severed.  */
+# define EOVERFLOW	127	/* Value too large to be stored in data type.*/
+
+# ifdef _LIBC
+#  define __set_errno(val) errno = (val)
+# endif
+#endif
+
+#if !defined _ERRNO_H && defined __need_Emath
+# define EDOM	33	/* Math argument out of domain of function.  */
+# define EILSEQ	116	/* Illegal byte sequence.  */
+# define ERANGE	34	/* Math result not representable.  */
+#endif /* !_ERRNO_H && __need_Emath */
diff --git a/sysdeps/unix/sysv/aix/bits/fcntl.h b/sysdeps/unix/sysv/aix/bits/fcntl.h
new file mode 100644
index 0000000000..039a604b19
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/bits/fcntl.h
@@ -0,0 +1,137 @@
+/* O_*, F_*, FD_* bit values for Linux.
+   Copyright (C) 1995, 1996, 1997, 1998, 1999 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.  */
+
+#ifndef	_FCNTL_H
+# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
+#endif
+
+
+#include <sys/types.h>
+
+/* open/fcntl.  */
+#define O_ACCMODE	  0003
+#define O_RDONLY	    00
+#define O_WRONLY	    01
+#define O_RDWR		    02
+#define O_NONBLOCK	    04
+#define O_NDELAY    O_NONBLOCK
+#define O_APPEND	   010
+#define O_SYNC		   020
+#define O_FSYNC		O_SYNC
+#define O_CREAT		  0400	/* not fcntl */
+#define O_TRUNC		 01000	/* not fcntl */
+#define O_EXCL		 02000	/* not fcntl */
+#define O_NOCTTY	 04000	/* not fcntl */
+#define O_ASYNC	       0400000
+
+#ifdef __USE_LARGEFILE64
+# define O_LARGEFILE 0400000000
+#endif
+
+/* For now Linux has synchronisity options for data and read operations.
+   We define the symbols here but let them do the same as O_SYNC since
+   this is a superset.  */
+#if defined __USE_POSIX199309 || defined __USE_UNIX98
+# define O_DSYNC     020000000	/* Synchronize data.  */
+# define O_RSYNC     010000000	/* Synchronize read operations.  */
+#endif
+
+/* Values for the second argument to `fcntl'.  */
+#define F_DUPFD		0	/* Duplicate file descriptor.  */
+#define F_GETFD		1	/* Get file descriptor flags.  */
+#define F_SETFD		2	/* Set file descriptor flags.  */
+#define F_GETFL		3	/* Get file status flags.  */
+#define F_SETFL		4	/* Set file status flags.  */
+#ifndef __USE_FILE_OFFSET64
+# define F_GETLK	5	/* Get record locking info.  */
+# define F_SETLK	6	/* Set record locking info (non-blocking).  */
+# define F_SETLKW	7	/* Set record locking info (blocking).  */
+#else
+# define F_GETLK       11	/* Get record locking info.  */
+# define F_SETLK       12	/* Set record locking info (non-blocking).  */
+# define F_SETLKW      13	/* Set record locking info (blocking).  */
+#endif
+
+#ifdef __USE_LARGEFILE64
+# define F_GETLK64      11	/* Get record locking info.  */
+# define F_SETLK64      12	/* Set record locking info (non-blocking).  */
+# define F_SETLKW64     13	/* Set record locking info (blocking).  */
+#endif
+
+#ifdef __USE_BSD
+# define F_SETOWN	8	/* Get owner of socket (receiver of SIGIO).  */
+# define F_GETOWN	9	/* Set owner of socket (receiver of SIGIO).  */
+#endif
+
+/* For F_[GET|SET]FL.  */
+#define FD_CLOEXEC	1	/* actually anything with low bit set goes */
+
+/* For posix fcntl() and `l_type' field of a `struct flock' for lockf().  */
+#define F_RDLCK		1	/* Read lock.  */
+#define F_WRLCK		2	/* Write lock.  */
+#define F_UNLCK		3	/* Remove lock.  */
+
+#ifdef __USE_BSD
+/* Operations for bsd flock(), also used by the kernel implementation */
+# define LOCK_SH	1	/* shared lock */
+# define LOCK_EX	2	/* exclusive lock */
+# define LOCK_NB	4	/* or'd with one of the above to prevent
+				   blocking */
+# define LOCK_UN	8	/* remove lock */
+#endif
+
+struct flock
+  {
+    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
+    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
+#ifndef __USE_FILE_OFFSET64
+    __off_t l_start;	/* Offset where the lock begins.  */
+    __off_t l_len;	/* Size of the locked area; zero means until EOF.  */
+#endif
+    unsigned int l_sysid;
+    __pid_t l_pid;	/* Process holding the lock.  */
+    int l_vfs;
+#ifdef __USE_FILE_OFFSET64
+    __off64_t l_start;	/* Offset where the lock begins.  */
+    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
+#endif
+  };
+
+#ifdef __USE_LARGEFILE64
+struct flock64
+  {
+    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
+    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
+    unsigned int l_sysid;
+    __pid_t l_pid;	/* Process holding the lock.  */
+    int l_vfs;
+    __off64_t l_start;	/* Offset where the lock begins.  */
+    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
+  };
+#endif
+
+/* Define some more compatibility macros to be backward compatible with
+   BSD systems which did not managed to hide these kernel macros.  */
+#ifdef	__USE_BSD
+# define FAPPEND	O_APPEND
+# define FFSYNC		O_FSYNC
+# define FASYNC		O_ASYNC
+# define FNONBLOCK	O_NONBLOCK
+# define FNDELAY	O_NDELAY
+#endif /* Use BSD.  */
diff --git a/sysdeps/unix/sysv/aix/bits/resource.h b/sysdeps/unix/sysv/aix/bits/resource.h
new file mode 100644
index 0000000000..823a5f0659
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/bits/resource.h
@@ -0,0 +1,191 @@
+/* Bit values & structures for resource limits.  AIX version.
+   Copyright (C) 1994, 1996-1999, 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.  */
+
+#ifndef _SYS_RESOURCE_H
+# error "Never use <bits/resource.h> directly; include <sys/resource.h> instead."
+#endif
+
+#include <bits/types.h>
+
+/* Transmute defines to enumerations.  The macro re-definitions are
+   necessary because some programs want to test for operating system
+   features with #ifdef RUSAGE_SELF.  In ISO C the reflexive
+   definition is a no-op.  */
+
+/* Kinds of resource limit.  */
+enum __rlimit_resource
+{
+  /* Per-process CPU limit, in seconds.  */
+  RLIMIT_CPU = 0,
+#define RLIMIT_CPU RLIMIT_CPU
+
+  /* Largest file that can be created, in bytes.  */
+  RLIMIT_FSIZE = 1,
+#define	RLIMIT_FSIZE RLIMIT_FSIZE
+
+  /* Maximum size of data segment, in bytes.  */
+  RLIMIT_DATA = 2,
+#define	RLIMIT_DATA RLIMIT_DATA
+
+  /* Maximum size of stack segment, in bytes.  */
+  RLIMIT_STACK = 3,
+#define	RLIMIT_STACK RLIMIT_STACK
+
+  /* Largest core file that can be created, in bytes.  */
+  RLIMIT_CORE = 4,
+#define	RLIMIT_CORE RLIMIT_CORE
+
+  /* Largest resident set size, in bytes.
+     This affects swapping; processes that are exceeding their
+     resident set size will be more likely to have physical memory
+     taken from them.  */
+  RLIMIT_RSS = 5,
+#define	RLIMIT_RSS RLIMIT_RSS
+
+  /* Address space limit (?) */
+  RLIMIT_AS = 6,
+#define RLIMIT_AS RLIMIT_AS
+
+  /* Number of open files.  */
+  RLIMIT_NOFILE = 7,
+  RLIMIT_OFILE = RLIMIT_NOFILE, /* BSD name for same.  */
+#define RLIMIT_NOFILE RLIMIT_NOFILE
+#define RLIMIT_OFILE RLIMIT_OFILE
+
+  RLIM_NLIMITS = 10
+#define RLIMIT_NLIMITS RLIMIT_NLIMITS
+#define RLIM_NLIMITS RLIM_NLIMITS
+};
+
+/* Value to indicate that there is no limit.  */
+#ifndef __USE_FILE_OFFSET64
+# define RLIM_INFINITY ((long int)(~0UL >> 1))
+#else
+# define RLIM_INFINITY 0x7fffffffffffffffLL
+#endif
+
+#ifdef __USE_LARGEFILE64
+# define RLIM64_INFINITY 0x7fffffffffffffffLL
+#endif
+
+#define RLIM_SAVED_MAX	(RLIM_INFINITY - 1)
+#define RLIM_SAVED_CUR	(RLIM_INFINITY - 2)
+
+
+/* Type for resource quantity measurement.  */
+#ifndef __USE_FILE_OFFSET64
+typedef __rlim_t rlim_t;
+#else
+typedef __rlim64_t rlim_t;
+#endif
+#ifdef __USE_LARGEFILE64
+typedef __rlim64_t rlim64_t;
+#endif
+
+struct rlimit
+  {
+    /* The current (soft) limit.  */
+    rlim_t rlim_cur;
+    /* The hard limit.  */
+    rlim_t rlim_max;
+  };
+
+#ifdef __USE_LARGEFILE64
+struct rlimit64
+  {
+    /* The current (soft) limit.  */
+    rlim64_t rlim_cur;
+    /* The hard limit.  */
+    rlim64_t rlim_max;
+ };
+#endif
+
+/* Whose usage statistics do you want?  */
+enum __rusage_who
+{
+  /* The calling process.  */
+  RUSAGE_SELF = 0,
+#define RUSAGE_SELF RUSAGE_SELF
+
+  /* All of its terminated child processes.  */
+  RUSAGE_CHILDREN = -1
+#define RUSAGE_CHILDREN RUSAGE_CHILDREN
+};
+
+#define __need_timeval
+#include <bits/time.h>		/* For `struct timeval'.  */
+
+/* Structure which says how much of each resource has been used.  */
+struct rusage
+  {
+    /* Total amount of user time used.  */
+    struct timeval ru_utime;
+    /* Total amount of system time used.  */
+    struct timeval ru_stime;
+    /* Maximum resident set size (in kilobytes).  */
+    long int ru_maxrss;
+    /* Amount of sharing of text segment memory
+       with other processes (kilobyte-seconds).  */
+    long int ru_ixrss;
+    /* Amount of data segment memory used (kilobyte-seconds).  */
+    long int ru_idrss;
+    /* Amount of stack memory used (kilobyte-seconds).  */
+    long int ru_isrss;
+    /* Number of soft page faults (i.e. those serviced by reclaiming
+       a page from the list of pages awaiting reallocation.  */
+    long int ru_minflt;
+    /* Number of hard page faults (i.e. those that required I/O).  */
+    long int ru_majflt;
+    /* Number of times a process was swapped out of physical memory.  */
+    long int ru_nswap;
+    /* Number of input operations via the file system.  Note: This
+       and `ru_oublock' do not include operations with the cache.  */
+    long int ru_inblock;
+    /* Number of output operations via the file system.  */
+    long int ru_oublock;
+    /* Number of IPC messages sent.  */
+    long int ru_msgsnd;
+    /* Number of IPC messages received.  */
+    long int ru_msgrcv;
+    /* Number of signals delivered.  */
+    long int ru_nsignals;
+    /* Number of voluntary context switches, i.e. because the process
+       gave up the process before it had to (usually to wait for some
+       resource to be available).  */
+    long int ru_nvcsw;
+    /* Number of involuntary context switches, i.e. a higher priority process
+       became runnable or the current process used up its time slice.  */
+    long int ru_nivcsw;
+  };
+
+/* Priority limits.  */
+#define PRIO_MIN	-20	/* Minimum priority a process can have.  */
+#define PRIO_MAX	20	/* Maximum priority a process can have.  */
+
+/* The type of the WHICH argument to `getpriority' and `setpriority',
+   indicating what flavor of entity the WHO argument specifies.  */
+enum __priority_which
+{
+  PRIO_PROCESS = 0,		/* WHO is a process ID.  */
+#define PRIO_PROCESS PRIO_PROCESS
+  PRIO_PGRP = 1,		/* WHO is a process group ID.  */
+#define PRIO_PGRP PRIO_PGRP
+  PRIO_USER = 2			/* WHO is a user ID.  */
+#define PRIO_USER PRIO_USER
+};
diff --git a/sysdeps/unix/sysv/aix/bits/setjmp.h b/sysdeps/unix/sysv/aix/bits/setjmp.h
new file mode 100644
index 0000000000..675ed62e3f
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/bits/setjmp.h
@@ -0,0 +1,46 @@
+/* Copyright (C) 1997, 1998, 1999 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.  */
+
+/* Define the machine-dependent type `jmp_buf'.  PowerPC version.  */
+
+#ifndef _SETJMP_H
+# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
+#endif
+
+/* The previous bits/setjmp.h had __jmp_buf defined as a structure.
+   We use an array of 'long int' instead, to make writing the
+   assembler easier. Naturally, user code should not depend on
+   either representation. */
+
+#if defined __USE_MISC || defined _ASM
+# define JB_GPR1   0  /* Also known as the stack pointer */
+# define JB_GPR2   1
+# define JB_LR     2  /* The address we will return to */
+# define JB_GPRS   3  /* GPRs 14 through 31 are saved, 18 in total */
+# define JB_CR     21 /* Condition code registers. */
+# define JB_FPRS   22 /* FPRs 14 through 31 are saved, 18*2 words total */
+#endif
+
+#ifndef	_ASM
+typedef long int __jmp_buf[64];
+#endif
+
+/* Test if longjmp to JMPBUF would unwind the frame
+   containing a local variable at ADDRESS.  */
+#define _JMPBUF_UNWINDS(jmpbuf, address) \
+  ((void *) (address) < (void *) (jmpbuf)[JB_GPR1])
diff --git a/sysdeps/unix/sysv/aix/bits/sigaction.h b/sysdeps/unix/sysv/aix/bits/sigaction.h
new file mode 100644
index 0000000000..75c35e5b32
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/bits/sigaction.h
@@ -0,0 +1,72 @@
+/* The proper definitions for AIX's sigaction.
+   Copyright (C) 1993-1999, 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.  */
+
+#ifndef _SIGNAL_H
+# error "Never include <bits/sigaction.h> directly; use <signal.h> instead."
+#endif
+
+/* Structure describing the action to be taken when a signal arrives.  */
+struct sigaction
+  {
+    /* Signal handler.  */
+#ifdef __USE_POSIX199309
+    union
+      {
+	/* Used if SA_SIGINFO is not set.  */
+	__sighandler_t sa_handler;
+	/* Used if SA_SIGINFO is set.  */
+	void (*sa_sigaction) (int, siginfo_t *, void *);
+      }
+    __sigaction_handler;
+# define sa_handler	__sigaction_handler.sa_handler
+# define sa_sigaction	__sigaction_handler.sa_sigaction
+#else
+    __sighandler_t sa_handler;
+#endif
+
+    /* Additional set of signals to be blocked.  */
+    __sigset_t sa_mask;
+
+    /* Special flags.  */
+    int sa_flags;
+  };
+
+/* Bits in `sa_flags'.  */
+#define	SA_NOCLDSTOP  4		 /* Don't send SIGCHLD when children stop.  */
+#define SA_NOCLDWAIT  0x400	 /* Don't create on death of child.  */
+#define SA_SIGINFO    0x100	 /* Invoke signal-catching function with
+				    three arguments instead of one.  */
+#if defined __USE_UNIX98 || defined __USE_MISC
+# define SA_ONSTACK   0x00000001 /* Use signal stack by using `sa_restorer'. */
+# define SA_RESTART   0x00000008 /* Restart syscall on signal return.  */
+# define SA_NODEFER   0x00000200 /* Don't automatically block the signal when
+				    its handler is being executed.  */
+# define SA_RESETHAND 0x00000002 /* Reset to SIG_DFL on entry to handler.  */
+#endif
+#ifdef __USE_MISC
+/* Some aliases for the SA_ constants.  */
+# define SA_NOMASK    SA_NODEFER
+# define SA_ONESHOT   SA_RESETHAND
+# define SA_STACK     SA_ONSTACK
+#endif
+
+/* Values for the HOW argument to `sigprocmask'.  */
+#define	SIG_BLOCK     0		 /* Block signals.  */
+#define	SIG_UNBLOCK   1		 /* Unblock signals.  */
+#define	SIG_SETMASK   2		 /* Set the set of blocked signals.  */
diff --git a/sysdeps/unix/sysv/aix/bits/sigcontext.h b/sysdeps/unix/sysv/aix/bits/sigcontext.h
new file mode 100644
index 0000000000..86b3c24910
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/bits/sigcontext.h
@@ -0,0 +1,32 @@
+/* Copyright (C) 1996, 1997, 1998, 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.  */
+
+#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H
+# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
+#endif
+
+#include <sys/ucontext.h>
+
+
+struct sigcontext
+{
+  int sc_onstack;		/* Sigstack state to restore.  */
+  sigset_t sc_mask;		/* Signal mask to restore.  */
+  int sc_uerror;		/* u_error to restore.  */
+  struct mcontext_t sc_jmpbuf;	/* Process context to restore.  */
+};
diff --git a/sysdeps/unix/sysv/aix/bits/signum.h b/sysdeps/unix/sysv/aix/bits/signum.h
new file mode 100644
index 0000000000..b4397448b2
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/bits/signum.h
@@ -0,0 +1,96 @@
+/* Signal number definitions.  AIX version.
+   Copyright (C) 1995-1999, 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.  */
+
+#ifdef	_SIGNAL_H
+
+/* Fake signal functions.  */
+#define SIG_ERR	((__sighandler_t) -1)		/* Error return.  */
+#define SIG_DFL	((__sighandler_t) 0)		/* Default action.  */
+#define SIG_IGN	((__sighandler_t) 1)		/* Ignore signal.  */
+
+#ifdef __USE_UNIX98
+# define SIG_HOLD	((__sighandler_t) 2)	/* Add signal to hold mask.  */
+# define SIG_CATCHE	((__sighandler_t) 3)
+#endif
+
+
+/* Signals.  */
+#define	SIGHUP		1	/* Hangup (POSIX).  */
+#define	SIGINT		2	/* Interrupt (ANSI).  */
+#define	SIGQUIT		3	/* Quit (POSIX).  */
+#define	SIGILL		4	/* Illegal instruction (ANSI).  */
+#define	SIGTRAP		5	/* Trace trap (POSIX).  */
+#define	SIGABRT		6	/* Abort (ANSI).  */
+#define SIGIOT		SIGABRT	/* Abort (terminal) process.  */
+#define SIGEMT		7	/* EMT instruction.  */
+#define	SIGFPE		8	/* Floating-point exception (ANSI).  */
+#define	SIGKILL		9	/* Kill, unblockable (POSIX).  */
+#define	SIGBUS		10	/* BUS error (4.2 BSD).  */
+#define	SIGSEGV		11	/* Segmentation violation (ANSI).  */
+#define SIGSYS		12	/* Bad system call.  */
+#define	SIGPIPE		13	/* Broken pipe (POSIX).  */
+#define	SIGALRM		14	/* Alarm clock (POSIX).  */
+#define	SIGTERM		15	/* Termination (ANSI).  */
+#define	SIGURG		16	/* Urgent condition on socket (4.2 BSD).  */
+#define SIGIOINT	SIGURG	/* Printer to backend error signal.  */
+#define	SIGSTOP		17	/* Stop, unblockable (POSIX).  */
+#define	SIGTSTP		18	/* Keyboard stop (POSIX).  */
+#define	SIGCONT		19	/* Continue (POSIX).  */
+#define	SIGCLD		SIGCHLD	/* Same as SIGCHLD (System V).  */
+#define	SIGCHLD		20	/* Child status has changed (POSIX).  */
+#define	SIGTTIN		21	/* Background read from tty (POSIX).  */
+#define	SIGTTOU		22	/* Background write to tty (POSIX).  */
+#define	SIGIO		23	/* I/O now possible (4.2 BSD).  */
+#define SIGAIO		SIGIO	/* Base LAN I/O.  */
+#define SIGPTY		SIGIO	/* PTY I/O.  */
+#define SIGPOLL		SIGIO	/* ANother I/O event.  */
+#define	SIGXCPU		24	/* CPU limit exceeded (4.2 BSD).  */
+#define	SIGXFSZ		25	/* File size limit exceeded (4.2 BSD).  */
+#define SIGMSG		27	/* Input data is in the ring buffer.  */
+#define	SIGWINCH	28	/* Window size change (4.3 BSD, Sun).  */
+#define	SIGPWR		29	/* Power failure restart (System V).  */
+#define	SIGUSR1		30	/* User-defined signal 1 (POSIX).  */
+#define	SIGUSR2		31	/* User-defined signal 2 (POSIX).  */
+#define	SIGPROF		32	/* Profiling alarm clock (4.2 BSD).  */
+#define SIGDANGER	33	/* System crash imminent.  */
+#define	SIGVTALRM	34	/* Virtual alarm clock (4.2 BSD).  */
+#define SIGMIGRATE	35	/* Migrate process.  */
+#define SIGPRE		36	/* Programming exception.  */
+#define SIGVIRT		37	/* AIX virtual time alarm.  */
+#define SIGARLM1	38	/* Reserved, don't use.  */
+#define SIGWAITING	39	/* Reserved, don't use.  */
+#define SIGCPUFAIL	59	/* Predictive de-configuration of processors.*/
+#define SIGKAP		60	/* Keep alive poll from native keyboard.  */
+#define SIGGRANT	SIGKAP	/* Monitor mode granted.  */
+#define SIGRETRACT	61	/* Monitor mode should be relinguished.  */
+#define SIGSOUND	62	/* Sound control has completed.  */
+#define SIGSAK		63	/* Secure attentation key.  */
+
+#define	_NSIG		64	/* Biggest signal number + 1
+				   (including real-time signals).  */
+
+#define SIGRTMIN        (__libc_current_sigrtmin ())
+#define SIGRTMAX        (__libc_current_sigrtmax ())
+
+/* These are the hard limits of the kernel.  These values should not be
+   used directly at user level.  */
+#define __SIGRTMIN	888
+#define __SIGRTMAX	999
+
+#endif	/* <signal.h> included.  */
diff --git a/sysdeps/unix/sysv/aix/bits/sigset.h b/sysdeps/unix/sysv/aix/bits/sigset.h
new file mode 100644
index 0000000000..4735796259
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/bits/sigset.h
@@ -0,0 +1,125 @@
+/* __sig_atomic_t, __sigset_t, and related definitions.  AIX version.
+   Copyright (C) 1991,1992,1994,1996,1997,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.  */
+
+#ifndef	_SIGSET_H_types
+# define _SIGSET_H_types	1
+
+typedef int __sig_atomic_t;
+
+/* A `sigset_t' has a bit for each signal.  */
+
+typedef struct
+  {
+    unsigned int __losigs;
+    unsigned int __hisigs;
+  } __sigset_t;
+
+#endif
+
+
+/* We only want to define these functions if <signal.h> was actually
+   included; otherwise we were included just to define the types.  Since we
+   are namespace-clean, it wouldn't hurt to define extra macros.  But
+   trouble can be caused by functions being defined (e.g., any global
+   register vars declared later will cause compilation errors).  */
+
+#if !defined _SIGSET_H_fns && defined _SIGNAL_H
+# define _SIGSET_H_fns 1
+
+# ifndef _EXTERN_INLINE
+#  define _EXTERN_INLINE extern __inline
+# endif
+
+/* Return a mask that includes the bit for SIG only.  */
+# define __sigmask(sig) \
+  (((unsigned long int) 1) << (((sig) - 1) % (8 * sizeof (unsigned int))))
+
+# if defined __GNUC__ && __GNUC__ >= 2
+#  define __sigemptyset(set) \
+  (__extension__ ({ sigset_t *__set = (set);				      \
+		    __set->__losigs = __set->__hisigs = 0;		      \
+		    0; }))
+#  define __sigfillset(set) \
+  (__extension__ ({ sigset_t *__set = (set);				      \
+		    __set->__losigs = __set->__hisigs = ~0u;		      \
+		    0; }))
+
+#  ifdef __USE_GNU
+/* The POSIX does not specify for handling the whole signal set in one
+   command.  This is often wanted and so we define three more functions
+   here.  */
+#   define __sigisemptyset(set) \
+  (__extension__ ({ const sigset_t *__set = (set);			      \
+		    (__set->__losigs | __set->__hisigs) == 0; }))
+#   define __sigandset(dest, left, right) \
+  (__extension__ ({ sigset_t *__dest = (dest);				      \
+		    const sigset_t *__left = (left);			      \
+		    const sigset_t *__right = (right);			      \
+		    __dest->__losigs = __left->__losigs & __right->__losigs;  \
+		    __dest->__hisigs = __left->__hisigs & __right->__hisigs;  \
+		    0; }))
+#   define __sigorset(dest, left, right) \
+  (__extension__ ({ sigset_t *__dest = (dest);				      \
+		    const sigset_t *__left = (left);			      \
+		    const sigset_t *__right = (right);			      \
+		    __dest->__losigs = __left->__losigs | __right->__losigs;  \
+		    __dest->__hisigs = __left->__hisigs | __right->__hisigs;  \
+		    0; }))
+#  endif
+# endif
+
+/* These functions needn't check for a bogus signal number -- error
+   checking is done in the non __ versions.  */
+
+extern int __sigismember (__const __sigset_t *, int);
+extern int __sigaddset (__sigset_t *, int);
+extern int __sigdelset (__sigset_t *, int);
+
+# ifdef __USE_EXTERN_INLINES
+_EXTERN_INLINE int
+__sigismember (__const __sigset_t *__set, int __sig)
+{
+  unsigned int __mask = __sigmask (__sig);
+
+  return ((__sig < 33 ? __set->__losigs : __set->__hisigs) & __mask ) ? 1 : 0;
+}
+
+_EXTERN_INLINE int
+__sigaddset (__sigset_t *__set, int __sig)
+{
+  unsigned int __mask = __sigmask (__sig);
+
+  (__sig < 33 ? __set->__losigs : __set->__hisigs) |= __mask;
+
+  return 0;
+}
+
+_EXTERN_INLINE int
+__sigdelset (__sigset_t *__set, int __sig)
+{
+  unsigned int __mask = __sigmask (__sig);
+
+  (__sig < 33 ? __set->__losigs : __set->__hisigs) &= ~__mask;
+
+  return 0;
+}
+# endif
+
+
+#endif /* ! _SIGSET_H_fns.  */
diff --git a/sysdeps/unix/sysv/aix/bits/sigstack.h b/sysdeps/unix/sysv/aix/bits/sigstack.h
new file mode 100644
index 0000000000..c229cc03f7
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/bits/sigstack.h
@@ -0,0 +1,46 @@
+/* sigstack, sigaltstack definitions.
+   Copyright (C) 1998, 1999, 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.  */
+
+#ifndef _SIGNAL_H
+# error "Never include this file directly.  Use <signal.h> instead"
+#endif
+
+
+/* Structure describing a signal stack (obsolete).  */
+struct sigstack
+  {
+    void *ss_sp;		/* Signal stack pointer.  */
+    int ss_onstack;		/* Nonzero if executing on this stack.  */
+  };
+
+
+/* Possible values for `ss_flags.'.  */
+enum
+{
+  SS_ONSTACK = 1,
+#define SS_ONSTACK	SS_ONSTACK
+  SS_DISABLE
+#define SS_DISABLE	SS_DISABLE
+};
+
+/* Minimum stack size for a signal handler.  */
+#define MINSIGSTKSZ	1024
+
+/* System default stack size.  */
+#define SIGSTKSZ	4096
diff --git a/sysdeps/unix/sysv/aix/bits/socket.h b/sysdeps/unix/sysv/aix/bits/socket.h
new file mode 100644
index 0000000000..e89735453a
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/bits/socket.h
@@ -0,0 +1,291 @@
+/* System-specific socket constants and types.  AIX version.
+   Copyright (C) 1991,92,94,95,96,97,98,99, 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.  */
+
+#ifndef __BITS_SOCKET_H
+#define __BITS_SOCKET_H
+
+#if !defined _SYS_SOCKET_H && !defined _NETINET_IN_H
+# error "Never include <bits/socket.h> directly; use <sys/socket.h> instead."
+#endif
+
+#define	__need_size_t
+#define __need_NULL
+#include <stddef.h>
+
+#include <limits.h>
+#include <sys/types.h>
+
+/* Type for length arguments in socket calls.  */
+typedef unsigned int socklen_t;
+
+/* Types of sockets.  */
+enum __socket_type
+{
+  SOCK_STREAM = 1,		/* Sequenced, reliable, connection-based
+				   byte streams.  */
+#define SOCK_STREAM SOCK_STREAM
+  SOCK_DGRAM = 2,		/* Connectionless, unreliable datagrams
+				   of fixed maximum length.  */
+#define SOCK_DGRAM SOCK_DGRAM
+  SOCK_RAW = 3,			/* Raw protocol interface.  */
+#define SOCK_RAW SOCK_RAW
+  SOCK_RDM = 4,			/* Reliably-delivered messages.  */
+#define SOCK_RDM SOCK_RDM
+  SOCK_SEQPACKET = 5,		/* Sequenced, reliable, connection-based,
+				   datagrams of fixed maximum length.  */
+#define SOCK_SEQPACKET SOCK_SEQPACKET
+  SOCK_CONN_DGRAM = 6		/* Conneciton datagram.  */
+#define SOCK_CONN_DGRAM	SOCK_CONN_DGRAM
+};
+
+/* Protocol families.  */
+#define	PF_UNSPEC	0	/* Unspecified.  */
+#define	PF_LOCAL	1	/* Local to host (pipes and file-domain).  */
+#define	PF_UNIX		PF_LOCAL /* Old BSD name for PF_LOCAL.  */
+#define	PF_FILE		PF_LOCAL /* Another non-standard name for PF_LOCAL.  */
+#define	PF_INET		2	/* IP protocol family.  */
+#define PF_IMPLINK	3	/* ARPAnet IMP addresses.  */
+#define PF_PUP		4	/* PUP protocols (e.g., BSP).  */
+#define PF_CHAOS	5	/* MIT CHAOS protocols.  */
+#define PF_NS		6	/* XEROX NS protocols.  */
+#define PF_ISO		7	/* ISO protocols.  */
+#define PF_OSI		PF_ISO
+#define PF_ECMA		8	/* European Computer Manufacturers.  */
+#define PF_DATAKIT	9	/* Datakit protocols.  */
+#define PF_CCITT	10	/* CCITT protocols, X.25 etc. */
+#define PF_SNA		11	/* IBM SNA.  */
+#define PF_DECnet	12	/* DECnet.  */
+#define PF_DLI		13	/* DEC Direct data link interface.  */
+#define PF_LAT		14	/* LAT. */
+#define PF_HYLINK	15	/* NSC Hyperchannel.  */
+#define PF_APPLETALK	16	/* Apple Talk.  */
+#define PF_NETLINK	17	/* Internet Routing Protocol.  */
+#define	PF_ROUTE	PF_NETLINK /* Alias to emulate 4.4BSD.  */
+#define PF_LINK		18	/* Link layer interface.  */
+#define PF_XTP		19	/* eXpress Transfer Protocol (no AF).  */
+#define PF_INTF		20	/* Debugging use only.  */
+#define PF_RIF		21	/* Raw interface.  */
+#define PF_NETWARE	22
+#define PF_NDD		23
+#define PF_INET6	24	/* IPv6.  */
+#define PF_MAX		30	/* For now..  */
+
+/* Address families.  */
+#define AF_UNSPEC       PF_UNSPEC
+#define AF_LOCAL        PF_LOCAL
+#define AF_UNIX         PF_UNIX
+#define AF_FILE         PF_FILE
+#define AF_INET         PF_INET
+#define AF_IMPLINK      PF_IMPLINK
+#define AF_PUP          PF_PUP
+#define AF_CHAOS        PF_CHAOS
+#define AF_NS           PF_NS
+#define AF_ISO          PF_ISO
+#define AF_OSI          PF_OSI
+#define AF_ECMA         PF_ECMA
+#define AF_DATAKIT      PF_DATAKIT
+#define AF_CCITT        PF_CCITT
+#define AF_SNA          PF_SNA
+#define AF_DECnet       PF_DECnet
+#define AF_DLI          PF_DLI
+#define AF_LAT          PF_LAT
+#define AF_HYLINK       PF_HYLINK
+#define AF_APPLETALK    PF_APPLETALK
+#define AF_NETLINK      PF_NETLINK
+#define AF_ROUTE        PF_ROUTE
+#define AF_LINK         PF_LINK
+#define AF_INTF         PF_INTF
+#define AF_RIF          PF_RIF
+#define AF_NETWARE      PF_NETWARE
+#define AF_NDD          PF_NDD
+#define AF_INET6        PF_INET6
+#define AF_MAX          PF_MAX
+
+/* Socket level values.  Others are defined in the appropriate headers.
+
+   XXX These definitions also should go into the appropriate headers as
+   far as they are available.  */
+#define SOL_SOCKET	0xffff
+
+/* Maximum queue length specifiable by listen.  */
+#define SOMAXCONN	1024
+
+/* Get the definition of the macro to define the common sockaddr members.  */
+#include <bits/sockaddr.h>
+
+/* Structure describing a generic socket address.  */
+struct sockaddr
+  {
+    __SOCKADDR_COMMON (sa_);	/* Common data: address family and length.  */
+    char sa_data[14];		/* Address data.  */
+  };
+
+
+/* Structure large enough to hold any socket address (with the historical
+   exception of AF_UNIX).  We reserve 128 bytes.  */
+#if ULONG_MAX > 0xffffffff
+# define __ss_aligntype	__uint64_t
+#else
+# define __ss_aligntype	__uint32_t
+#endif
+#define _SS_SIZE	128
+#define _SS_PADSIZE	(_SS_SIZE - (2 * sizeof (__ss_aligntype)))
+
+struct sockaddr_storage
+  {
+    __SOCKADDR_COMMON (__ss_);	/* Address family, etc.  */
+    __ss_aligntype __ss_align;	/* Force desired alignment.  */
+    char __ss_padding[_SS_PADSIZE];
+  };
+
+
+/* Bits in the FLAGS argument to `send', `recv', et al.  */
+enum
+  {
+    MSG_OOB		= 0x01,	/* Process out-of-band data.  */
+#define MSG_OOB		MSG_OOB
+    MSG_PEEK		= 0x02,	/* Peek at incoming messages.  */
+#define MSG_PEEK	MSG_PEEK
+    MSG_DONTROUTE	= 0x04,	/* Don't use local routing.  */
+#define MSG_DONTROUTE	MSG_DONTROUTE
+    MSG_EOR		= 0x08, /* End of record.  */
+#define	MSG_EOR		MSG_EOR
+    MSG_TRUNC		= 0x10,
+#define	MSG_TRUNC	MSG_TRUNC
+    MSG_CTRUNC		= 0x20,	/* Control data lost before delivery.  */
+#define MSG_CTRUNC	MSG_CTRUNC
+    MSG_WAITALL		= 0x40, /* Wait for a full request.  */
+#define	MSG_WAITALL	MSG_WAITALL
+    MSG_MPEG2		= 0x80,	/* Message contain MPEG2 data.  */
+#define MSG_MPEG2	MSG_MPEG2
+  };
+
+
+/* Structure describing messages sent by
+   `sendmsg' and received by `recvmsg'.  */
+struct msghdr
+  {
+    void *msg_name;		/* Address to send to/receive from.  */
+    socklen_t msg_namelen;	/* Length of address data.  */
+
+    struct iovec *msg_iov;	/* Vector of data to send/receive into.  */
+    int msg_iovlen;		/* Number of elements in the vector.  */
+
+    void *msg_control;		/* Ancillary data (eg BSD filedesc passing). */
+    socklen_t msg_controllen;	/* Ancillary data buffer length.  */
+
+    int msg_flags;		/* Flags on received message.  */
+  };
+
+/* Structure used for storage of ancillary data object information.  */
+struct cmsghdr
+  {
+    socklen_t cmsg_len;		/* Length of data in cmsg_data plus length
+				   of cmsghdr structure.  */
+    int cmsg_level;		/* Originating protocol.  */
+    int cmsg_type;		/* Protocol specific type.  */
+#if !defined __STRICT_ANSI__ && defined __GNUC__ && __GNUC__ >= 2
+    unsigned char __cmsg_data[0]; /* Ancillary data.  */
+    /* XXX Perhaps this should be removed.  */
+#endif
+  };
+
+/* Ancillary data object manipulation macros.  */
+#if !defined __STRICT_ANSI__ && defined __GNUC__ && __GNUC__ >= 2
+# define CMSG_DATA(cmsg) ((cmsg)->__cmsg_data)
+#else
+# define CMSG_DATA(cmsg) ((unsigned char *) ((struct cmsghdr *) (cmsg) + 1))
+#endif
+#define CMSG_NXTHDR(mhdr, cmsg) __cmsg_nxthdr (mhdr, cmsg)
+#define CMSG_FIRSTHDR(mhdr) \
+  ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr)		      \
+   ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) NULL)
+#define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) \
+			 & ~(sizeof (size_t) - 1))
+#define CMSG_SPACE(len) (CMSG_ALIGN (len) \
+			 + CMSG_ALIGN (sizeof (struct cmsghdr)))
+#define CMSG_LEN(len)   (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len))
+
+extern struct cmsghdr *__cmsg_nxthdr (struct msghdr *__mhdr,
+				      struct cmsghdr *__cmsg) __THROW;
+#ifdef __USE_EXTERN_INLINES
+# ifndef _EXTERN_INLINE
+#  define _EXTERN_INLINE extern __inline
+# endif
+_EXTERN_INLINE struct cmsghdr *
+__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg) __THROW
+{
+  if ((size_t) __cmsg->cmsg_len < sizeof (struct cmsghdr))
+    /* The kernel header does this so there may be a reason.  */
+    return 0;
+
+  __cmsg = (struct cmsghdr *) ((unsigned char *) __cmsg
+			       + CMSG_ALIGN (__cmsg->cmsg_len));
+  if ((unsigned char *) (__cmsg + 1) >= ((unsigned char *) __mhdr->msg_control
+					 + __mhdr->msg_controllen)
+      || ((unsigned char *) __cmsg + CMSG_ALIGN (__cmsg->cmsg_len)
+	  >= ((unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen)))
+    /* No more entries.  */
+    return 0;
+  return __cmsg;
+}
+#endif	/* Use `extern inline'.  */
+
+/* Socket level message types.  This must match the definitions in
+   <linux/socket.h>.  */
+enum
+  {
+    SCM_RIGHTS = 0x01		/* Transfer file descriptors.  */
+#define SCM_RIGHTS SCM_RIGHTS
+  };
+
+/* Options flags per socket.  */
+#define SO_DEBUG	0x0001	/* Turn on debugging info recording.  */
+#define SO_ACCEPTCONN	0x0002	/* Socket has had listen().  */
+#define SO_REUSEADDR	0x0004	/* Allow local address reuse.  */
+#define SO_KEEPALIVE	0x0008	/* Keep connections alive.  */
+#define SO_DONTROUTE	0x0010	/* Just use interface addresses.  */
+#define SO_BROADCAST	0x0020	/* Permit sending of broadcast msgs.  */
+#define SO_USELOOPBACK	0x0040	/* Bypass hardware when possible.  */
+#define SO_LINGER	0x0080	/* Linger on close if data present.  */
+#define SO_OOBINLINE	0x0100	/* Leave received OOB data in line.  */
+#define SO_REUSEPORT	0x0200	/* Allow local address & port reuse.  */
+#define SO_USE_IFBUFS	0x0400	/* Interface will supply buffers.  */
+#define SO_CKSUMRECV	0x0800	/* Defer checksum until receive.  */
+#define SO_NOREUSEADDR	0x1000	/* Prevent local address reuse.  */
+#define SO_SNDBUF	0x1001	/* Send buffer size.  */
+#define SO_RCVBUF	0x1002	/* Receive buffer size.  */
+#define SO_SNDLOWAT	0x1003	/* Send low-water mark.  */
+#define SO_RCVLOWAT	0x1004	/* Receive low-water mark.  */
+#define SO_SNDTIMEO	0x1005	/* Send timeout.  */
+#define SO_RCVTIMEO	0x1006	/* Receive timeout.  */
+#define SO_ERROR	0x1007	/* Get error status and clear.  */
+#define SO_TYPE		0x1008	/* Get socket type.  */
+#define SO_KERNACCEPT	0x2000	/* Derive a in-kernel only socket.  */
+#define SO_AUDIT	0x8000	/* Turn on socket auditing.  */
+
+
+/* Structure used to manipulate the SO_LINGER option.  */
+struct linger
+  {
+    int l_onoff;		/* Nonzero to linger on close.  */
+    int l_linger;		/* Time to linger.  */
+  };
+
+#endif	/* bits/socket.h */
diff --git a/sysdeps/unix/sysv/aix/bits/stat.h b/sysdeps/unix/sysv/aix/bits/stat.h
new file mode 100644
index 0000000000..252662e062
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/bits/stat.h
@@ -0,0 +1,124 @@
+/* Copyright (C) 1999 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.  */
+
+#ifndef _SYS_STAT_H
+# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
+#endif
+
+struct stat
+  {
+    __dev_t st_dev;			/* Device.  */
+#ifndef __USE_FILE_OFFSET64
+    __ino_t st_ino;			/* File serial number.	*/
+#else
+    __ino64_t st_ino;			/* File serial number.	*/
+#endif
+    __mode_t st_mode;			/* File mode.  */
+    __nlink_t st_nlink;			/* Link count.  */
+    unsigned short int st_flag;		/* Flag word.  */
+    __uid_t st_uid;			/* User ID of the file's owner.	*/
+    __gid_t st_gid;			/* Group ID of the file's group.*/
+    __dev_t st_rdev;			/* Device number, if device.  */
+#ifndef __USE_FILE_OFFSET64
+    __off_t st_size;			/* Size of file, in bytes.  */
+#else
+    int st_ssize;			/* Size of file, in bytes.  */
+#endif
+    __time_t st_atime;			/* Time of last access.  */
+    unsigned long int __unused1;
+    __time_t st_mtime;			/* Time of last modification.  */
+    unsigned long int __unused2;
+    __time_t st_ctime;			/* Time of last status change.  */
+    unsigned long int __unused3;
+    __blksize_t st_blksize;		/* Optimal block size for I/O.  */
+#ifndef __USE_FILE_OFFSET64
+    __blkcnt_t st_blocks;		/* Number 512-byte blocks allocated. */
+#else
+    __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
+#endif
+    int st_vfstype;			/* Type of the filesystem.  */
+    unsigned int st_vfs;		/* Vfs number.  */
+    unsigned int st_type;		/* Vnode type.  */
+    unsigned int st_gen;		/* Inode generation number.  */
+
+#define _STATBUF_RESERVED_SPACE 9
+    unsigned int st_reserved[_STATBUF_RESERVED_SPACE];
+
+#ifdef __USE_FILE_OFFSET64
+    unsigned int st_padto_ll;
+    __off64_t st_size;			/* 64 bit file size in bytes.  */
+#endif
+  };
+
+#ifdef __USE_LARGEFILE64
+struct stat64
+  {
+    __dev_t st_dev;			/* Device.  */
+    __ino64_t st_ino;			/* File serial number.	*/
+    __mode_t st_mode;			/* File mode.  */
+    __nlink_t st_nlink;			/* Link count.  */
+    unsigned short int st_flag;		/* Flag word.  */
+    __uid_t st_uid;			/* User ID of the file's owner.	*/
+    __gid_t st_gid;			/* Group ID of the file's group.*/
+    __dev_t st_rdev;			/* Device number, if device.  */
+    int st_ssize;			/* Size of file, in bytes.  */
+    __time_t st_atime;			/* Time of last access.  */
+    unsigned long int __unused1;
+    __time_t st_mtime;			/* Time of last modification.  */
+    unsigned long int __unused2;
+    __time_t st_ctime;			/* Time of last status change.  */
+    unsigned long int __unused3;
+    __blksize_t st_blksize;		/* Optimal block size for I/O.  */
+    __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
+    int st_vfstype;			/* Type of the filesystem.  */
+    unsigned int st_vfs;		/* Vfs number.  */
+    unsigned int st_type;		/* Vnode type.  */
+    unsigned int st_gen;		/* Inode generation number.  */
+    unsigned int st_reserved[_STATBUF_RESERVED_SPACE];
+    unsigned int st_padto_ll;
+    __off64_t st_size;			/* 64 bit file size in bytes.  */
+  };
+#endif
+
+/* Tell code we have these members.  */
+#define	_STATBUF_ST_BLKSIZE
+#define _STATBUF_ST_RDEV
+
+/* Encoding of the file mode.  */
+
+#define	__S_IFMT	0170000	/* These bits determine file type.  */
+
+/* File types.  */
+#define	__S_IFDIR	0040000	/* Directory.  */
+#define	__S_IFCHR	0020000	/* Character device.  */
+#define	__S_IFBLK	0060000	/* Block device.  */
+#define	__S_IFREG	0100000	/* Regular file.  */
+#define	__S_IFIFO	0010000	/* FIFO.  */
+
+/* These don't actually exist on System V, but having them doesn't hurt.  */
+#define	__S_IFLNK	0120000	/* Symbolic link.  */
+#define	__S_IFSOCK	0140000	/* Socket.  */
+
+/* Protection bits.  */
+
+#define	__S_ISUID	04000	/* Set user ID on execution.  */
+#define	__S_ISGID	02000	/* Set group ID on execution.  */
+#define	__S_ISVTX	01000	/* Save swapped text after use (sticky).  */
+#define	__S_IREAD	0400	/* Read by owner.  */
+#define	__S_IWRITE	0200	/* Write by owner.  */
+#define	__S_IEXEC	0100	/* Execute by owner.  */
diff --git a/sysdeps/unix/sysv/aix/bits/statfs.h b/sysdeps/unix/sysv/aix/bits/statfs.h
new file mode 100644
index 0000000000..2877339e74
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/bits/statfs.h
@@ -0,0 +1,77 @@
+/* Copyright (C) 1997, 1998, 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.  */
+
+#ifndef _SYS_STATFS_H
+# error "Never include <bits/statfs.h> directly; use <sys/statfs.h> instead."
+#endif
+
+#include <bits/types.h>  /* for __fsid_t and __fsblkcnt_t*/
+
+struct statfs
+  {
+    int f_version;
+    int f_type;
+    int f_bsize;
+    /* The following five elements have type `int' since AIX's fsfilcnt_t
+       and fsblkcnt_t types do not fit.  */
+    int f_blocks;
+    int f_bfree;
+    int f_bavail;
+    int f_files;
+    int f_ffree;
+    __fsid_t f_fsid;
+    int f_vfstype;
+    int f_fsize;
+    int f_vfsnumber;
+    int f_vfsoff;
+    int f_vfslen;
+    int f_vfsvers;
+    char f_fname[32];
+    char f_fpack[32];
+    int f_name_max;
+  };
+
+#ifdef __USE_LARGEFILE64
+/* XXX There seems to be no 64-bit versio of this structure.  */
+struct statfs64
+  {
+    int f_version;
+    int f_type;
+    int f_bsize;
+    /* The following five elements have type `int' since AIX's fsfilcnt_t
+       and fsblkcnt_t types do not fit.  */
+    int f_blocks;
+    int f_bfree;
+    int f_bavail;
+    int f_files;
+    int f_ffree;
+    __fsid_t f_fsid;
+    int f_vfstype;
+    int f_fsize;
+    int f_vfsnumber;
+    int f_vfsoff;
+    int f_vfslen;
+    int f_vfsvers;
+    char f_fname[32];
+    char f_fpack[32];
+    int f_name_max;
+  };
+#endif
+
+/* Tell code we have these members.  */
+#define _STATFS_F_NAME_MAX
diff --git a/sysdeps/unix/sysv/aix/bits/types.h b/sysdeps/unix/sysv/aix/bits/types.h
new file mode 100644
index 0000000000..c41b34c1ef
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/bits/types.h
@@ -0,0 +1,148 @@
+/* Copyright (C) 1991,92,94,95,96,97,98,99 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.  */
+
+/*
+ * Never include this file directly; use <sys/types.h> instead.
+ */
+
+#ifndef	_BITS_TYPES_H
+#define	_BITS_TYPES_H	1
+
+#include <features.h>
+
+#define __need_size_t
+#include <stddef.h>
+
+/* Convenience types.  */
+typedef unsigned char __u_char;
+typedef unsigned short __u_short;
+typedef unsigned int __u_int;
+typedef unsigned long __u_long;
+#ifdef __GNUC__
+__extension__ typedef unsigned long long int __u_quad_t;
+__extension__ typedef long long int __quad_t;
+#else
+typedef struct
+  {
+    long int __val[2];
+  } __quad_t;
+typedef struct
+  {
+    __u_long __val[2];
+  } __u_quad_t;
+#endif
+typedef signed char __int8_t;
+typedef unsigned char __uint8_t;
+typedef signed short int __int16_t;
+typedef unsigned short int __uint16_t;
+typedef signed int __int32_t;
+typedef unsigned int __uint32_t;
+#ifdef __GNUC__
+__extension__ typedef signed long long int __int64_t;
+__extension__ typedef unsigned long long int __uint64_t;
+#endif
+typedef __quad_t *__qaddr_t;
+
+typedef __u_long __dev_t;		/* Type of device numbers.  */
+typedef __u_int __uid_t;		/* Type of user identifications.  */
+typedef __u_int __gid_t;		/* Type of group identifications.  */
+typedef __u_long __ino_t;		/* Type of file serial numbers.  */
+typedef __u_int __mode_t;		/* Type of file attribute bitmasks.  */
+typedef short int __nlink_t; 		/* Type of file link counts.  */
+typedef long int __off_t;		/* Type of file sizes and offsets.  */
+typedef __quad_t __loff_t;		/* Type of file sizes and offsets.  */
+typedef int __pid_t;			/* Type of process identifications.  */
+typedef long int __ssize_t;		/* Type of a byte count, or error.  */
+typedef __u_long __rlim_t;		/* Type of resource counts.  */
+typedef __u_quad_t __rlim64_t;		/* Type of resource counts (LFS).  */
+typedef __u_long __id_t;		/* General type for ID.  */
+
+typedef struct
+  {
+    unsigned long int __val[2];
+  } __fsid_t;				/* Type of file system IDs.  */
+
+/* Everythin' else.  */
+typedef long int __daddr_t;		/* The type of a disk address.  */
+typedef char *__caddr_t;
+typedef long int __time_t;
+typedef __u_long __useconds_t;
+typedef int __suseconds_t;
+typedef long int __swblk_t;		/* Type of a swap block maybe?  */
+
+typedef int __clock_t;
+
+/* One element in the file descriptor mask array.  */
+typedef unsigned long int __fd_mask;
+
+/* Number of descriptors that can fit in an `fd_set'.  */
+#define __FD_SETSIZE	1024
+
+/* It's easier to assume 8-bit bytes than to get CHAR_BIT.  */
+#define __NFDBITS	(8 * sizeof (__fd_mask))
+#define	__FDELT(d)	((d) / __NFDBITS)
+#define	__FDMASK(d)	((__fd_mask) 1 << ((d) % __NFDBITS))
+
+/* fd_set for select and pselect.  */
+typedef struct
+  {
+    /* XPG4.2 requires this member name.  Otherwise avoid the name
+       from the global namespace.  */
+#ifdef __USE_XOPEN
+    __fd_mask fds_bits[__FD_SETSIZE / __NFDBITS];
+# define __FDS_BITS(set) ((set)->fds_bits)
+#else
+    __fd_mask __fds_bits[__FD_SETSIZE / __NFDBITS];
+# define __FDS_BITS(set) ((set)->__fds_bits)
+#endif
+  } __fd_set;
+
+
+typedef long int __key_t;
+
+/* Type to represent block size.  */
+typedef int __blksize_t;
+
+/* Types from the Large File Support interface.  */
+
+/* Type to count number os disk blocks.  */
+typedef int __blkcnt_t;
+typedef __quad_t __blkcnt64_t;
+
+/* Type to count file system blocks.  */
+typedef __u_long __fsblkcnt_t;
+typedef __u_quad_t __fsblkcnt64_t;
+
+/* Type to count file system inodes.  */
+typedef __u_long __fsfilcnt_t;
+typedef __u_quad_t __fsfilcnt64_t;
+
+/* Type of file serial numbers.  */
+typedef __u_quad_t __ino64_t;
+
+/* Type of file sizes and offsets.  */
+typedef __loff_t __off64_t;
+
+/* Used in XTI.  */
+typedef int __t_scalar_t;
+typedef unsigned int __t_uscalar_t;
+
+/* Duplicates info from stdint.h but this is used in unistd.h.  */
+typedef int __intptr_t;
+
+#endif /* bits/types.h */
diff --git a/sysdeps/unix/sysv/aix/bits/uio.h b/sysdeps/unix/sysv/aix/bits/uio.h
new file mode 100644
index 0000000000..5868ccc257
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/bits/uio.h
@@ -0,0 +1,42 @@
+/* Copyright (C) 1996, 1997, 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.  */
+
+#ifndef _SYS_UIO_H
+# error "Never include <bits/uio.h> directly; use <sys/uio.h> instead."
+#endif
+
+
+#include <sys/types.h>
+
+
+/* Size of object which can be written atomically.
+
+   This macro has different values in different kernel versions.  The
+   latest versions of ther kernel use 1024 and this is good choice.  Since
+   the C library implementation of readv/writev is able to emulate the
+   functionality even if the currently running kernel does not support
+   this large value the readv/writev call will not fail because of this.  */
+#define UIO_MAXIOV	16
+
+
+/* Structure for scatter/gather I/O.  */
+struct iovec
+  {
+    void *iov_base;	/* Pointer to data.  */
+    size_t iov_len;	/* Length of data.  */
+  };
diff --git a/sysdeps/unix/sysv/aix/bits/utmp.h b/sysdeps/unix/sysv/aix/bits/utmp.h
new file mode 100644
index 0000000000..04844096b0
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/bits/utmp.h
@@ -0,0 +1,73 @@
+/* The `struct utmp' type, describing entries in the utmp file.  AIX.
+   Copyright (C) 1996, 1997, 1999 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.  */
+
+#ifndef _UTMP_H
+# error "Never include <bits/utmp.h> directly; use <utmp.h> instead."
+#endif
+
+
+#include <time.h>
+
+#define _PATH_UTMP      "/etc/utmp"
+#define _PATH_WTMP      "/var/adm/wtmp"
+#define _PATH_LASTLOG   "/var/adm/lastlog"
+
+
+#define UT_LINESIZE	12
+#define UT_NAMESIZE	8
+#define UT_HOSTSIZE	16
+
+
+struct utmp
+  {
+#define	ut_name	ut_user
+    char ut_user[UT_NAMESIZE];
+    char ut_id[14];
+    char ut_line[UT_LINESIZE];
+    short int ut_type;
+    short int ut_pid;
+    struct exit_status
+      {
+	short int e_termination;
+	short int e_exit;
+      } ut_exit;
+    __time_t ut_time;
+    char ut_host[UT_HOSTSIZE];
+  };
+
+
+/* Tell the user that we have a modern system with UT_HOST, UT_TYPE, and
+   UT_ID fields.  */
+#define _HAVE_UT_TYPE	1
+#define _HAVE_UT_PID	1
+#define _HAVE_UT_ID	1
+#define _HAVE_UT_HOST	1
+
+
+/* Values for the `ut_type' field of a `struct utmp'.  */
+#define EMPTY		0
+#define RUN_LVL		1
+#define BOOT_TIME	2
+#define OLD_TIME	3
+#define NEW_TIME	4
+#define INIT_PROCESS	5
+#define LOGIN_PROCESS	6
+#define USER_PROCESS	7
+#define DEAD_PROCESS	8
+#define ACCOUNTING	9
diff --git a/sysdeps/unix/sysv/aix/bits/utmpx.h b/sysdeps/unix/sysv/aix/bits/utmpx.h
new file mode 100644
index 0000000000..7a7bce2f70
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/bits/utmpx.h
@@ -0,0 +1,67 @@
+/* Structures and defenitions for the user accounting database.  AIX.
+   Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
+
+   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 _UTMPX_H
+# error "Never include <bits/utmpx.h> directly; use <utmpx.h> instead."
+#endif
+
+#include <bits/types.h>
+#include <sys/time.h>
+
+
+#ifdef __USE_GNU
+# include <paths.h>
+# define _PATH_UTMPX	_PATH_UTMP
+# define _PATH_WTMPX	_PATH_WTMP
+#endif
+
+
+#define __UT_LINESIZE	12
+#define __UT_NAMESIZE	8
+#define __UT_HOSTSIZE	16
+
+
+/* The structure describing an entry in the user accounting database.  */
+struct utmpx
+{
+  char ut_user[__UT_NAMESIZE];	/* Username.  */
+  char ut_id[14];		/* Inittab ID. */
+  char ut_line[__UT_LINESIZE];	/* Devicename.  */
+  short int ut_type;		/* Type of login.  */
+  __pid_t ut_pid;		/* Process ID of login process.  */
+  struct timeval ut_tv;		/* Time entry was made.  */
+  char ut_host[__UT_HOSTSIZE];	/* Hostname for remote login.  */
+};
+
+
+/* Values for the `ut_type' field of a `struct utmpx'.  */
+#define EMPTY		0	/* No valid user accounting information.  */
+
+#define RUN_LVL		1	/* The system's runlevel.  */
+#define BOOT_TIME	2	/* Time of system boot.  */
+#define NEW_TIME	3	/* Time after system clock changed.  */
+#define OLD_TIME	4	/* Time when system clock changed.  */
+
+#define INIT_PROCESS	5	/* Process spawned by the init process.  */
+#define LOGIN_PROCESS	6	/* Session leader of a logged in user.  */
+#define USER_PROCESS	7	/* Normal process.  */
+#define DEAD_PROCESS	8	/* Terminated process.  */
+
+#ifdef __USE_GNU
+# define ACCOUNTING	9	/* System accounting.  */
+#endif
diff --git a/sysdeps/unix/sysv/aix/bits/utsname.h b/sysdeps/unix/sysv/aix/bits/utsname.h
new file mode 100644
index 0000000000..e6958f0783
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/bits/utsname.h
@@ -0,0 +1,23 @@
+/* Copyright (C) 1997, 1999 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.  */
+
+#ifndef _SYS_UTSNAME_H
+# error "Never include <bits/utsname.h> directly; use <sys/utsname.h> instead."
+#endif
+
+#define _UTSNAME_LENGTH 32
diff --git a/sysdeps/unix/sysv/aix/brk.c b/sysdeps/unix/sysv/aix/brk.c
new file mode 100644
index 0000000000..64bc8cdd2b
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/brk.c
@@ -0,0 +1,8 @@
+/* This is a system call.  We only have to provide the wrapper.  */
+#include <unistd.h>
+
+int
+__brk (void *addr)
+{
+  return brk (addr);
+}
diff --git a/sysdeps/unix/sysv/aix/chown.c b/sysdeps/unix/sysv/aix/chown.c
new file mode 100644
index 0000000000..902d410449
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/chown.c
@@ -0,0 +1,25 @@
+/* Copyright (C) 1999, 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.  */
+
+#include <unistd.h>
+
+int
+__chown (const char *file, uid_t owner, gid_t group)
+{
+  return chown (file, owner, group);
+}
diff --git a/sysdeps/unix/sysv/aix/close.c b/sysdeps/unix/sysv/aix/close.c
new file mode 100644
index 0000000000..4d500c50af
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/close.c
@@ -0,0 +1,8 @@
+/* This is a system call.  We only have to provide the wrapper.  */
+#include <unistd.h>
+
+int
+__close (int fd)
+{
+  return close (fd);
+}
diff --git a/sysdeps/unix/sysv/aix/configure b/sysdeps/unix/sysv/aix/configure
new file mode 100644
index 0000000000..7fc920ecaa
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/configure
@@ -0,0 +1,8 @@
+ # Local configure fragment for sysdeps/unix/sysv/linux.
+
+# On Linux, the default is to use libio instead of stdio.
+test $stdio = default && stdio=libio
+
+# Don't bother trying to generate any glue code to be compatible with the
+# existing system library, because we are the only system library.
+inhibit_glue=yes
diff --git a/sysdeps/unix/sysv/aix/configure.in b/sysdeps/unix/sysv/aix/configure.in
new file mode 100644
index 0000000000..e3fd4efefb
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/configure.in
@@ -0,0 +1,10 @@
+sinclude(./aclocal.m4)dnl Autoconf lossage
+GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
+# Local configure fragment for sysdeps/unix/sysv/linux.
+
+# On Linux, the default is to use libio instead of stdio.
+test $stdio = default && stdio=libio
+
+# Don't bother trying to generate any glue code to be compatible with the
+# existing system library, because we are the only system library.
+inhibit_glue=yes
diff --git a/sysdeps/unix/sysv/aix/connect.c b/sysdeps/unix/sysv/aix/connect.c
new file mode 100644
index 0000000000..7fb636dea9
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/connect.c
@@ -0,0 +1,8 @@
+/* This is a system call.  We only have to provide the wrapper.  */
+#include <sys/socket.h>
+
+int
+__connect (int fd, __CONST_SOCKADDR_ARG addr, socklen_t len)
+{
+  return connect (fd, addr, len);
+}
diff --git a/sysdeps/unix/sysv/aix/environ.c b/sysdeps/unix/sysv/aix/environ.c
new file mode 100644
index 0000000000..01e7ba8281
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/environ.c
@@ -0,0 +1 @@
+/* We don't need to define environ, the kernel does it.  */
diff --git a/sysdeps/unix/sysv/aix/euidaccess.c b/sysdeps/unix/sysv/aix/euidaccess.c
new file mode 100644
index 0000000000..598755c2df
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/euidaccess.c
@@ -0,0 +1,5 @@
+int
+euidaccess (const char *name, int type)
+{
+  return accessx (name, type, ACC_SELF);
+}
diff --git a/sysdeps/unix/sysv/aix/execve.c b/sysdeps/unix/sysv/aix/execve.c
new file mode 100644
index 0000000000..ea1b67d630
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/execve.c
@@ -0,0 +1,8 @@
+/* This is a system call.  We only have to provide the wrapper.  */
+#include <unistd.h>
+
+int
+__execve (const char *path, char *const argv[], char *const envp[])
+{
+  return execve (path, argv, envp);
+}
diff --git a/sysdeps/unix/sysv/aix/fchown.c b/sysdeps/unix/sysv/aix/fchown.c
new file mode 100644
index 0000000000..de51384493
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/fchown.c
@@ -0,0 +1,25 @@
+/* Copyright (C) 1999, 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.  */
+
+#include <unistd.h>
+
+int
+__fchown (int fds, uid_t owner, gid_t group)
+{
+  return fchown (fds, owner, group);
+}
diff --git a/sysdeps/unix/sysv/aix/fcntl.c b/sysdeps/unix/sysv/aix/fcntl.c
new file mode 100644
index 0000000000..5a4bb8a1bb
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/fcntl.c
@@ -0,0 +1,40 @@
+/* Copyright (C) 1999, 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.  */
+
+#include <fcntl.h>
+#include <stdarg.h>
+
+extern int kfcntl (int fdes, int cmd, unsigned long int arg);
+
+int
+__fcntl (int fdes, int cmd, ...)
+{
+  va_list va;
+  int res;
+  unsigned long int arg;
+
+  va_start (va, cmd);
+  arg = va_arg (va, unsigned long int);
+
+  res = kfcntl (fdes, cmd, arg);
+
+  va_end (va);
+
+  return res;
+}
+strong_alias (__fcntl, fcntl)
diff --git a/sysdeps/unix/sysv/aix/fdatasync.c b/sysdeps/unix/sysv/aix/fdatasync.c
new file mode 100644
index 0000000000..177260daa2
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/fdatasync.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 1999, 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.  */
+
+#include <unistd.h>
+
+#define _FDATASYNC	0x00400000
+#define FDATASYNC	_FDATASYNC
+
+extern int kfsync_range (int fd, int how, long long int off,
+			 long long int len);
+
+int
+fdatasync (int fd)
+{
+  return kfsync_range (fd, FDATASYNC, 0, 0);
+}
diff --git a/sysdeps/unix/sysv/aix/fork.c b/sysdeps/unix/sysv/aix/fork.c
new file mode 100644
index 0000000000..9c84fb0684
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/fork.c
@@ -0,0 +1,27 @@
+/* Copyright (C) 1999, 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.  */
+
+#include <unistd.h>
+
+
+pid_t
+__fork (void)
+{
+  return kfork ();
+}
+strong_alias (__fork, fork)
diff --git a/sysdeps/unix/sysv/aix/fstatfs.c b/sysdeps/unix/sysv/aix/fstatfs.c
new file mode 100644
index 0000000000..3b92b9e0f5
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/fstatfs.c
@@ -0,0 +1,27 @@
+/* Copyright (C) 1999, 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.  */
+
+#include <sys/statfs.h>
+
+extern int fstatfs (int fd, struct statfs *buf);
+
+int
+__fstatfs (int fd, struct statfs *buf)
+{
+  return fstatfs (fd, buf);
+}
diff --git a/sysdeps/unix/sysv/aix/fsync.c b/sysdeps/unix/sysv/aix/fsync.c
new file mode 100644
index 0000000000..6ad1dac333
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/fsync.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 1999, 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.  */
+
+#include <unistd.h>
+
+#define _FSYNC		0x00000010
+#define FFILESYNC	_FSYNC
+
+extern int kfsync_range (int fd, int how, long long int off,
+			 long long int len);
+
+int
+fsync (int fd)
+{
+  return kfsync_range (fd, FFILESYNC, 0, 0);
+}
diff --git a/sysdeps/unix/sysv/aix/ftruncate.c b/sysdeps/unix/sysv/aix/ftruncate.c
new file mode 100644
index 0000000000..5ad14cbb6b
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/ftruncate.c
@@ -0,0 +1,28 @@
+/* Copyright (C) 1999, 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.  */
+
+#include <unistd.h>
+
+extern int kftruncate (int fd, long long int length);
+
+int
+__ftruncate (int fd, off_t length)
+{
+  return kftruncate (fd, length);
+}
+strong_alias (__ftruncate, ftruncate)
diff --git a/sysdeps/unix/sysv/aix/ftruncate64.c b/sysdeps/unix/sysv/aix/ftruncate64.c
new file mode 100644
index 0000000000..56a5ed58c1
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/ftruncate64.c
@@ -0,0 +1,27 @@
+/* Copyright (C) 1999, 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.  */
+
+#include <unistd.h>
+
+extern int kftruncate (int fd, long long int length);
+
+int
+ftruncate64 (int fd, off64_t length)
+{
+  return kftruncate (fd, length);
+}
diff --git a/sysdeps/unix/sysv/aix/fxstat.c b/sysdeps/unix/sysv/aix/fxstat.c
new file mode 100644
index 0000000000..9f5a477590
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/fxstat.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 1999, 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.  */
+
+#include <assert.h>
+#include <sys/stat.h>
+
+#define STX_NORMAL      0x00
+
+extern int fstatx (int fd, struct stat *st, int len, int cmd);
+
+int
+__fxstat (int ver, int fd, struct stat *st)
+{
+  assert (ver == 0);
+  return fstatx (fd, st, sizeof (*st), STX_NORMAL);
+}
diff --git a/sysdeps/unix/sysv/aix/fxstat64.c b/sysdeps/unix/sysv/aix/fxstat64.c
new file mode 100644
index 0000000000..5d2f22bde9
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/fxstat64.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 1999, 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.  */
+
+#include <assert.h>
+#include <sys/stat.h>
+
+#define STX_NORMAL      0x00
+#define STX_64          0x08
+
+extern int fstatx (int fd, struct stat64 *st, int len, int cmd);
+
+int
+__fxstat64 (int ver, int fd, struct stat64 *st)
+{
+  assert (ver == 0);
+  return fstatx (fd, st, sizeof (*st), STX_NORMAL | STX_64);
+}
diff --git a/sysdeps/unix/sysv/aix/getdents.c b/sysdeps/unix/sysv/aix/getdents.c
new file mode 100644
index 0000000000..fd45199851
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/getdents.c
@@ -0,0 +1,28 @@
+/* Copyright (C) 1999, 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.  */
+
+#include <dirent.h>
+#include <sys/types.h>
+
+extern int getdirent (int fd, char *buf, size_t count);
+
+ssize_t
+__getdents (int fd, char *buf, size_t count)
+{
+  return getdirent (fd, buf, count);
+}
diff --git a/sysdeps/unix/sysv/aix/getegid.c b/sysdeps/unix/sysv/aix/getegid.c
new file mode 100644
index 0000000000..30a6a995a8
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/getegid.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 1999, 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.  */
+
+#include <unistd.h>
+/* is there a reason *NOT* to include <sys/id.h>? If so #define ID_EFFECTIVE */
+#include <sys/id.h>
+
+
+gid_t
+__getegid (void)
+{
+  return getgidx (ID_EFFECTIVE);
+}
+strong_alias (__getegid, getegid)
diff --git a/sysdeps/unix/sysv/aix/geteuid.c b/sysdeps/unix/sysv/aix/geteuid.c
new file mode 100644
index 0000000000..4856868445
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/geteuid.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 1999, 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.  */
+
+#include <unistd.h>
+/* is there a reason *NOT* to include <sys/id.h>? If so #define ID_EFFECTIVE */
+#include <sys/id.h>
+
+
+uid_t
+__geteuid (void)
+{
+  return getuidx (ID_EFFECTIVE);
+}
+strong_alias (__geteuid, geteuid)
diff --git a/sysdeps/unix/sysv/aix/getgid.c b/sysdeps/unix/sysv/aix/getgid.c
new file mode 100644
index 0000000000..ca088652f6
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/getgid.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1999, 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.  */
+
+#include <unistd.h>
+/* is there a reason *NOT* to include <sys/id.h>?  If so #define ID_REAL */
+#include <sys/id.h>
+
+extern gid_t getgidx (int which);
+
+gid_t
+__getgid (void)
+{
+  return getgidx (ID_REAL);
+}
+strong_alias (__getgid, getgid)
diff --git a/sysdeps/unix/sysv/aix/getpeername.c b/sysdeps/unix/sysv/aix/getpeername.c
new file mode 100644
index 0000000000..d227e286cd
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/getpeername.c
@@ -0,0 +1,27 @@
+/* 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.  */
+
+#include <sys/socket.h>
+
+extern int ngetpeername (int s, void *uap_asa, int *uap_alen);
+
+int
+getpeername (int fd, __SOCKADDR_ARG addr, socklen_t *len)
+{
+  return ngetpeername (fd, addr.__sockaddr__, len);
+}
diff --git a/sysdeps/unix/sysv/aix/getpgid.c b/sysdeps/unix/sysv/aix/getpgid.c
new file mode 100644
index 0000000000..53f2e1accf
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/getpgid.c
@@ -0,0 +1,28 @@
+/* Copyright (C) 1999, 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.  */
+
+#include <unistd.h>
+
+extern int kgetpgidx (pid_t pid);
+
+int
+__getgpid (pid_t pid)
+{
+  return kgetpgidx (pid);
+}
+strong_alias (__getpgid, getpgid)
diff --git a/sysdeps/unix/sysv/aix/getpgrp.c b/sysdeps/unix/sysv/aix/getpgrp.c
new file mode 100644
index 0000000000..ce37738beb
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/getpgrp.c
@@ -0,0 +1 @@
+/* This function is available as a system call.  */
diff --git a/sysdeps/unix/sysv/aix/getpid.c b/sysdeps/unix/sysv/aix/getpid.c
new file mode 100644
index 0000000000..67ef7eaf79
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/getpid.c
@@ -0,0 +1,6 @@
+/* This is a system call.  We only have to provide the wrapper.  */
+int
+__getpid (void)
+{
+  return getpid ();
+}
diff --git a/sysdeps/unix/sysv/aix/getppid.c b/sysdeps/unix/sysv/aix/getppid.c
new file mode 100644
index 0000000000..6036fbbffd
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/getppid.c
@@ -0,0 +1 @@
+/* This is a system call.  */
diff --git a/sysdeps/unix/sysv/aix/getsid.c b/sysdeps/unix/sysv/aix/getsid.c
new file mode 100644
index 0000000000..88b9daa8e5
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/getsid.c
@@ -0,0 +1,27 @@
+/* Copyright (C) 1999, 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.  */
+
+#include <unistd.h>
+
+extern int kgetsid (pid_t pid);
+
+int
+getsid (pid_t pid)
+{
+  return kgetsid (pid);
+}
diff --git a/sysdeps/unix/sysv/aix/getsockname.c b/sysdeps/unix/sysv/aix/getsockname.c
new file mode 100644
index 0000000000..c1a561428e
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/getsockname.c
@@ -0,0 +1,27 @@
+/* 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.  */
+
+#include <sys/socket.h>
+
+extern int ngetsockname (int s, void *uap_asa, int *uap_alen);
+
+int
+getsockname (int fd, __SOCKADDR_ARG addr, socklen_t *len)
+{
+  return ngetsockname (fd, addr.__sockaddr__, len);
+}
diff --git a/sysdeps/unix/sysv/aix/getuid.c b/sysdeps/unix/sysv/aix/getuid.c
new file mode 100644
index 0000000000..4bc1c8acdb
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/getuid.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1999, 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.  */
+
+#include <unistd.h>
+/* is there a reason *NOT* to include <sys/id.h>?  If so #define ID_REAL */
+#include <sys/id.h>
+
+extern uid_t getuidx (int which);
+
+uid_t
+__getuid (void)
+{
+  return getuidx (ID_REAL);
+}
+strong_alias (__getuid, getuid)
diff --git a/sysdeps/unix/sysv/aix/gnu/lib-names.h b/sysdeps/unix/sysv/aix/gnu/lib-names.h
new file mode 100644
index 0000000000..d41f822f16
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/gnu/lib-names.h
@@ -0,0 +1,31 @@
+#ifndef __GNU_LIB_NAMES_H
+#define __GNU_LIB_NAMES_H	1
+
+#define	LIBBROKENLOCALE_SO	"libBrokenLocale.a"
+#define	LIBCRYPT_SO	"libcrypt.a"
+#define	LIBC_SO	"libc.a"
+#define	LIBDB1_SO	"libdb1.a"
+#define	LIBDB_SO	"libdb.a"
+#define	LIBDL_SO	"libdl.a"
+#define	LIBM_SO	"libm.a"
+#define	LIBNOVERSION_SO	"libNoVersion.a"
+#define	LIBNSL_SO	"libnsl.a"
+#define	LIBNSS1_COMPAT_SO	"libnss1_compat.a"
+#define	LIBNSS1_DB_SO	"libnss1_db.a"
+#define	LIBNSS1_DNS_SO	"libnss1_dns.a"
+#define	LIBNSS1_FILES_SO	"libnss1_files.a"
+#define	LIBNSS1_NIS_SO	"libnss1_nis.a"
+#define	LIBNSS_COMPAT_SO	"libnss_compat.a"
+#define	LIBNSS_DB_SO	"libnss_db.a"
+#define	LIBNSS_DNS_SO	"libnss_dns.a"
+#define	LIBNSS_FILES_SO	"libnss_files.a"
+#define	LIBNSS_HESIOD_SO	"libnss_hesiod.a"
+#define	LIBNSS_LDAP_SO	"libnss_ldap.a"
+#define	LIBNSS_NISPLUS_SO	"libnss_nisplus.a"
+#define	LIBNSS_NIS_SO	"libnss_nis.a"
+#define	LIBPTHREAD_SO	"libpthread.a"
+#define	LIBRESOLV_SO	"libresolv.a"
+#define	LIBRT_SO	"librt.a"
+#define	LIBUTIL_SO	"libutil.a"
+
+#endif	/* gnu/lib-names.h */
diff --git a/sysdeps/unix/sysv/aix/ioctl.c b/sysdeps/unix/sysv/aix/ioctl.c
new file mode 100644
index 0000000000..6e1445d946
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/ioctl.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 1999, 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.  */
+
+#include <stdarg.h>
+#include <sys/ioctl.h>
+
+extern int kioctl (int fdes, int cmd, unsigned long int arg,
+		   unsigned long int ext);
+
+int
+__ioctl (int fdes, unsigned long int cmd, ...)
+{
+  va_list va;
+  int res;
+  unsigned long int arg;
+  unsigned long int ext;
+
+  va_start (va, cmd);
+  arg = va_arg (va, unsigned long int);
+  ext = va_arg (va, unsigned long int);
+
+  res = kioctl (fdes, cmd, arg, ext);
+
+  va_end (va);
+
+  return res;
+}
+strong_alias (__ioctl, ioctl)
diff --git a/sysdeps/unix/sysv/aix/kernel_proto.h b/sysdeps/unix/sysv/aix/kernel_proto.h
new file mode 100644
index 0000000000..d3ddfa6a0a
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/kernel_proto.h
@@ -0,0 +1,25 @@
+/* Copyright (C) 1999 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
+
+   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.  */
+
+/* This file contains prototypes for the "functions" exported by /unix
+   on AIX.  */
+#include <sys/types.h>
+
+
+extern ssize_t kwrite (int, const void *, size_t);
diff --git a/sysdeps/unix/sysv/aix/kill.c b/sysdeps/unix/sysv/aix/kill.c
new file mode 100644
index 0000000000..dfe366c397
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/kill.c
@@ -0,0 +1,8 @@
+/* This is a system call.  We only have to provide the wrapper.  */
+#include <unistd.h>
+
+int
+__kill (pid_t pid, int sig)
+{
+  return kill (pid, sig);
+}
diff --git a/sysdeps/unix/sysv/aix/lchown.c b/sysdeps/unix/sysv/aix/lchown.c
new file mode 100644
index 0000000000..57a83b5f6e
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/lchown.c
@@ -0,0 +1,25 @@
+/* Copyright (C) 1999, 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.  */
+
+#include <unistd.h>
+
+int
+__lchown (const char *file, uid_t owner, gid_t group)
+{
+  return lchown (file, owner, group);
+}
diff --git a/sysdeps/unix/sysv/aix/libc-start.c b/sysdeps/unix/sysv/aix/libc-start.c
new file mode 100644
index 0000000000..f7eb65e8b4
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/libc-start.c
@@ -0,0 +1,20 @@
+/* We don't need the usual code since we are using the AIX crt code.  */
+
+/* This function is called in the AIX crt0.  */
+void
+__mod_init (void)
+{
+  /* XXX What has to be done?  */
+}
+
+/* This variable is reference in the AIX crt0 code.
+   XXX Since I don't know how it is used make it a pointer to a function.  */
+void *__crt0v = __mod_init;
+
+
+/* XXX Another weird function from the C library.  I have no idea what
+   it does but it is needed by libgcc.  */
+void
+_savef14 (void)
+{
+}
diff --git a/sysdeps/unix/sysv/aix/linux/errnoconv.c b/sysdeps/unix/sysv/aix/linux/errnoconv.c
new file mode 100644
index 0000000000..95bd5a32b2
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/linux/errnoconv.c
@@ -0,0 +1,125 @@
+/* Convert the error number the AIX kernel returns to what the Linux
+   application expects.  */
+#include <errno.h>
+#include "linux-errno.h"
+
+
+static int mapping[] =
+{
+  [EPERM] = LINUX_EPERM,
+  [ENOENT] = LINUX_ENOENT,
+  [ESRCH] = LINUX_ESRCH,
+  [EINTR] = LINUX_EINTR,
+  [EIO] = LINUX_EIO,
+  [ENXIO] = LINUX_ENXIO,
+  [E2BIG] = LINUX_E2BIG,
+  [ENOEXEC] = LINUX_ENOEXEC,
+  [EBADF] = LINUX_EBADF,
+  [ECHILD] = LINUX_ECHILD,
+  [EAGAIN] = LINUX_EAGAIN,
+  [ENOMEM] = LINUX_ENOMEM,
+  [EACCES] = LINUX_EACCES,
+  [EFAULT] = LINUX_EFAULT,
+  [ENOTBLK] = LINUX_ENOTBLK,
+  [EBUSY] = LINUX_EBUSY,
+  [EEXIST] = LINUX_EEXIST,
+  [EXDEV] = LINUX_EXDEV,
+  [ENODEV] = LINUX_ENODEV,
+  [ENOTDIR] = LINUX_ENOTDIR,
+  [EISDIR] = LINUX_EISDIR,
+  [EINVAL] = LINUX_EINVAL,
+  [ENFILE] = LINUX_ENFILE,
+  [EMFILE] = LINUX_EMFILE,
+  [ENOTTY] = LINUX_ENOTTY,
+  [ETXTBSY] = LINUX_ETXTBSY,
+  [EFBIG] = LINUX_EFBIG,
+  [ENOSPC] = LINUX_ENOSPC,
+  [EIDRM] = LINUX_EIDRM,
+  [ECHRNG] = LINUX_ECHRNG,
+  [EL2NSYNC] = LINUX_EL2NSYNC,
+  [EL3HLT] = LINUX_EL3HLT,
+  [EL3RST] = LINUX_EL3RST,
+  [ELNRNG] = LINUX_ELNRNG,
+  [EUNATCH] = LINUX_EUNATCH,
+  [ENOCSI] = LINUX_ENOCSI,
+  [EL2HLT] = LINUX_EL2HLT,
+  [EDEADLK] = LINUX_EDEADLK,
+  [ENOTREADY] = LINUX_ENOTREADY,
+  // EWPROTECT: no Linux equivalent
+  // EFORMAT: no Linux equivalent
+  [ENOLCK] = LINUX_ENOLCK,
+  // ENOCONNECT: No Linux equivalent
+  [ESTALE] = LINUX_ESTALE,
+  // EDIST: no Linux equivalent
+  [54] = LINUX_EAGAIN,		// EWOULDBLOCK
+  [EINPROGRESS] = LINUX_EINPROGRESS,
+  [EALREADY] = LINUX_EALREADY,
+  [ENOTSOCK] = LINUX_ENOTSOCK,
+  [EDESTADDRREQ] = LINUX_EDESTADDRREQ,
+  [EMSGSIZE] = LINUX_EMSGSIZE,
+  [EPROTOTYPE] = LINUX_EPROTOTYPE,
+  [ENOPROTOOPT] = LINUX_ENOPROTOOPT,
+  [EPROTONOSUPPORT] = LINUX_EPROTONOSUPPORT,
+  [ESOCKTNOSUPPORT] = LINUX_ESOCKTNOSUPPORT,
+  [EOPNOTSUPP] = LINUX_EOPNOTSUPP,
+  [EPFNOSUPPORT] = LINUX_EPFNOSUPPORT,
+  [EAFNOSUPPORT] = LINUX_EAFNOSUPPORT,
+  [EADDRINUSE] = LINUX_EADDRINUSE,
+  [EADDRNOTAVAIL] = LINUX_EADDRNOTAVAIL,
+  [ENETDOWN] = LINUX_ENETDOWN,
+  [ENETUNREACH] = LINUX_ENETUNREACH,
+  [ENETRESET] = LINUX_ENETRESET,
+  [ECONNABORTED] = LINUX_ECONNABORTED,
+  [ECONNRESET] = LINUX_ECONNRESET,
+  [ENOBUFS] = LINUX_ENOBUFS,
+  [EISCONN] = LINUX_EISCONN,
+  [ENOTCONN] = LINUX_ENOTCONN,
+  [ESHUTDOWN] = LINUX_ESHUTDOWN,
+  [ETIMEDOUT] = LINUX_ETIMEDOUT,
+  [ECONNREFUSED] = LINUX_ECONNREFUSED,
+  [EHOSTDOWN] = LINUX_EHOSTDOWN,
+  [EHOSTUNREACH] = LINUX_EHOSTUNREACH,
+  [ERESTART] = LINUX_ERESTART,
+  [EPROCLIM] = LINUX_EPROCLIM,
+  [EUSERS] = LINUX_EUSERS,
+  [ELOOP] = LINUX_ELOOP,
+  [ENAMETOOLONG] = LINUX_ENAMETOOLONG,
+  [87] = LINUX_ENOTEMPTY,		// ENOTEMPTY
+  [EDQUOT] = LINUX_EDQUOT,
+  [ECORRUPT] = LINUX_ECORRUPT,
+  [EREMOTE] = LINUX_EREMOTE,
+  [ENOSYS] = LINUX_ENOSYS,
+  [EMEDIA] = LINUX_EMEDIA,
+  [ESOFT] = LINUX_ESOFT,
+  [ENOATTR] = LINUX_ENOATTR,
+  [ESAD] = LINUX_ESAD,
+  // ENOTRUST: no Linux equivalent
+  [ETOOMANYREFS] = LINUX_ETOOMANYREFS,
+  [EILSEQ] = LINUX_EILSEQ,
+  [ECANCELED] = LINUX_ECANCELED,
+  [ENOSR] = LINUX_ENOSR,
+  [ETIME] = LINUX_ETIME,
+  [EBADMSG] = LINUX_EBADMSG,
+  [EPROTO] = LINUX_EPROTO,
+  [ENODATA] = LINUX_ENODATA,
+  [ENOSTR] = LINUX_ENOSTR,
+  [ENOTSUP] = LINUX_ENOTSUP,
+  [EMULTIHOP] = LINUX_EMULTIHOP,
+  [ENOLINK] = LINUX_ENOLINK,
+  [EOVERFLOW] = LINUX_EOVERFLOW
+};
+
+
+int
+__errno_aix_to_linux (int err)
+{
+  int conv;
+
+  if (err >= 0 && err < (sizeof (mapping) / sizeof (mapping[0]))
+      && ((conv = mapping[err]) != 0 || err == 0))
+    return conv;
+
+  /* The error value is not known.  Create a special value which can
+     be easily recognized as an invalid result.  */
+  return 512 + err;
+}
diff --git a/sysdeps/unix/sysv/aix/linux/linux-errno.h b/sysdeps/unix/sysv/aix/linux/linux-errno.h
new file mode 100644
index 0000000000..b7cf0a5c5f
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/linux/linux-errno.h
@@ -0,0 +1,135 @@
+#ifndef _LINUX_ERRNO_H
+#define _LINUX_ERRNO_H
+
+#define LINUX_EPERM		 1
+#define LINUX_ENOENT		 2
+#define LINUX_ESRCH		 3
+#define LINUX_EINTR		 4
+#define LINUX_EIO		 5
+#define LINUX_ENXIO		 6
+#define LINUX_E2BIG		 7
+#define LINUX_ENOEXEC		 8
+#define LINUX_EBADF		 9
+#define LINUX_ECHILD		10
+#define LINUX_EAGAIN		11
+#define LINUX_ENOMEM		12
+#define LINUX_EACCES		13
+#define LINUX_EFAULT		14
+#define LINUX_ENOTBLK		15
+#define LINUX_EBUSY		16
+#define LINUX_EEXIST		17
+#define LINUX_EXDEV		18
+#define LINUX_ENODEV		19
+#define LINUX_ENOTDIR		20
+#define LINUX_EISDIR		21
+#define LINUX_EINVAL		22
+#define LINUX_ENFILE		23
+#define LINUX_EMFILE		24
+#define LINUX_ENOTTY		25
+#define LINUX_ETXTBSY		26
+#define LINUX_EFBIG		27
+#define LINUX_ENOSPC		28
+#define LINUX_ESPIPE		29
+#define LINUX_EROFS		30
+#define LINUX_EMLINK		31
+#define LINUX_EPIPE		32
+#define LINUX_EDOM		33
+#define LINUX_ERANGE		34
+#define LINUX_EDEADLK		35
+#define LINUX_ENAMETOOLONG	36
+#define LINUX_ENOLCK		37
+#define LINUX_ENOSYS		38
+#define LINUX_ENOTEMPTY		39
+#define LINUX_ELOOP		40
+#define LINUX_ENOMSG		42
+#define LINUX_EIDRM		43
+#define LINUX_ECHRNG		44
+#define LINUX_EL2NSYNC		45
+#define LINUX_EL3HLT		46
+#define LINUX_EL3RST		47
+#define LINUX_ELNRNG		48
+#define LINUX_EUNATCH		49
+#define LINUX_ENOCSI		50
+#define LINUX_EL2HLT		51
+#define LINUX_EBADE		52
+#define LINUX_EBADR		53
+#define LINUX_EXFULL		54
+#define LINUX_ENOANO		55
+#define LINUX_EBADRQC		56
+#define LINUX_EBADSLT		57
+#define LINUX_EDEADLOCK		58
+#define LINUX_EBFONT		59
+#define LINUX_ENOSTR		60
+#define LINUX_ENODATA		61
+#define LINUX_ETIME		62
+#define LINUX_ENOSR		63
+#define LINUX_ENONET		64
+#define LINUX_ENOPKG		65
+#define LINUX_EREMOTE		66
+#define LINUX_ENOLINK		67
+#define LINUX_EADV		68
+#define LINUX_ESRMNT		69
+#define LINUX_ECOMM		70
+#define LINUX_EPROTO		71
+#define LINUX_EMULTIHOP		72
+#define LINUX_EDOTDOT		73
+#define LINUX_EBADMSG		74
+#define LINUX_EOVERFLOW		75
+#define LINUX_ENOTUNIQ		76
+#define LINUX_EBADFD		77
+#define LINUX_EREMCHG		78
+#define LINUX_ELIBACC		79
+#define LINUX_ELIBBAD		80
+#define LINUX_ELIBSCN		81
+#define LINUX_ELIBMAX		82
+#define LINUX_ELIBEXEC		83
+#define LINUX_EILSEQ		84
+#define LINUX_ERESTART		85
+#define LINUX_ESTRPIPE		86
+#define LINUX_EUSERS		87
+#define LINUX_ENOTSOCK		88
+#define LINUX_EDESTADDRREQ	89
+#define LINUX_EMSGSIZE		90
+#define LINUX_EPROTOTYPE	91
+#define LINUX_ENOPROTOOPT	92
+#define LINUX_EPROTONOSUPPORT	93
+#define LINUX_ESOCKTNOSUPPORT	94
+#define LINUX_EOPNOTSUPP	95
+#define LINUX_EPFNOSUPPORT	96
+#define LINUX_EAFNOSUPPORT	97
+#define LINUX_EADDRINUSE	98
+#define LINUX_EADDRNOTAVAIL	99
+#define LINUX_ENETDOWN		100
+#define LINUX_ENETUNREACH	101
+#define LINUX_ENETRESET		102
+#define LINUX_ECONNABORTED	103
+#define LINUX_ECONNRESET	104
+#define LINUX_ENOBUFS		105
+#define LINUX_EISCONN		106
+#define LINUX_ENOTCONN		107
+#define LINUX_ESHUTDOWN		108
+#define LINUX_ETOOMANYREFS	109
+#define LINUX_ETIMEDOUT		110
+#define LINUX_ECONNREFUSED	111
+#define LINUX_EHOSTDOWN		112
+#define LINUX_EHOSTUNREACH	113
+#define LINUX_EALREADY		114
+#define LINUX_EINPROGRESS	115
+#define LINUX_ESTALE		116
+#define LINUX_EUCLEAN		117
+#define LINUX_ENOTNAM		118
+#define LINUX_ENAVAIL		119
+#define LINUX_EISNAM		120
+#define LINUX_EREMOTEIO		121
+#define LINUX_EDQUOT		122
+
+#define LINUX_ENOMEDIUM		123
+#define LINUX_EMEDIUMTYPE	124
+
+/* Should never be seen by user programs */
+#define LINUX_ERESTARTSYS	512
+#define LINUX_ERESTARTNOINTR	513
+#define LINUX_ERESTARTNOHAND	514
+#define LINUX_ENOIOCTLCMD	515
+
+#endif
diff --git a/sysdeps/unix/sysv/aix/linux/linux-stat.h b/sysdeps/unix/sysv/aix/linux/linux-stat.h
new file mode 100644
index 0000000000..01a2d4d253
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/linux/linux-stat.h
@@ -0,0 +1,131 @@
+/* Copyright (C) 1992, 95, 96, 97, 98, 99, 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.  */
+
+#ifndef _SYS_STAT_H
+# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
+#endif
+
+/* Versions of the `struct stat' data structure.  */
+#define _STAT_VER_LINUX_OLD	1
+#define _STAT_VER_KERNEL	1
+#define _STAT_VER_SVR4		2
+#define _STAT_VER_LINUX		3
+#define _STAT_VER		_STAT_VER_LINUX	/* The one defined below.  */
+
+/* Versions of the `xmknod' interface.  */
+#define _MKNOD_VER_LINUX	1
+#define _MKNOD_VER_SVR4		2
+#define _MKNOD_VER		_MKNOD_VER_LINUX /* The bits defined below.  */
+
+
+struct stat
+  {
+    __dev_t st_dev;			/* Device.  */
+    unsigned short int __pad1;
+#ifndef __USE_FILE_OFFSET64
+    __ino_t st_ino;			/* File serial number.	*/
+#else
+    __ino64_t st_ino;			/* File serial number.	*/
+#endif
+    __mode_t st_mode;			/* File mode.  */
+    __nlink_t st_nlink;			/* Link count.  */
+    __uid_t st_uid;			/* User ID of the file's owner.	*/
+    __gid_t st_gid;			/* Group ID of the file's group.*/
+    __dev_t st_rdev;			/* Device number, if device.  */
+    unsigned short int __pad2;
+#ifndef __USE_FILE_OFFSET64
+    __off_t st_size;			/* Size of file, in bytes.  */
+#else
+    __off64_t st_size;			/* Size of file, in bytes.  */
+#endif
+    __blksize_t st_blksize;		/* Optimal block size for I/O.  */
+
+#ifndef __USE_FILE_OFFSET64
+    __blkcnt_t st_blocks;		/* Number 512-byte blocks allocated. */
+#else
+    __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
+#endif
+    __time_t st_atime;			/* Time of last access.  */
+    unsigned long int __unused1;
+    __time_t st_mtime;			/* Time of last modification.  */
+    unsigned long int __unused2;
+    __time_t st_ctime;			/* Time of last status change.  */
+    unsigned long int __unused3;
+    unsigned long int __unused4;
+    unsigned long int __unused5;
+  };
+
+#ifdef __USE_LARGEFILE64
+struct stat64
+  {
+    __dev_t st_dev;			/* Device.  */
+    unsigned short int __pad1;
+
+    __ino64_t st_ino;			/* File serial number.	*/
+    __mode_t st_mode;			/* File mode.  */
+    __nlink_t st_nlink;			/* Link count.  */
+    __uid_t st_uid;			/* User ID of the file's owner.	*/
+    __gid_t st_gid;			/* Group ID of the file's group.*/
+    __dev_t st_rdev;			/* Device number, if device.  */
+    unsigned short int __pad2;
+    __off64_t st_size;			/* Size of file, in bytes.  */
+    __blksize_t st_blksize;		/* Optimal block size for I/O.  */
+
+    __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
+    __time_t st_atime;			/* Time of last access.  */
+    unsigned long int __unused1;
+    __time_t st_mtime;			/* Time of last modification.  */
+    unsigned long int __unused2;
+    __time_t st_ctime;			/* Time of last status change.  */
+    unsigned long int __unused3;
+    unsigned long int __unused4;
+    unsigned long int __unused5;
+  };
+#endif
+
+/* Tell code we have these members.  */
+#define	_STATBUF_ST_BLKSIZE
+#define _STATBUF_ST_RDEV
+
+/* Encoding of the file mode.  */
+
+#define	__S_IFMT	0170000	/* These bits determine file type.  */
+
+/* File types.  */
+#define	__S_IFDIR	0040000	/* Directory.  */
+#define	__S_IFCHR	0020000	/* Character device.  */
+#define	__S_IFBLK	0060000	/* Block device.  */
+#define	__S_IFREG	0100000	/* Regular file.  */
+#define	__S_IFIFO	0010000	/* FIFO.  */
+
+/* These don't actually exist on System V, but having them doesn't hurt.  */
+#define	__S_IFLNK	0120000	/* Symbolic link.  */
+#define	__S_IFSOCK	0140000	/* Socket.  */
+
+/* Protection bits.  */
+
+#define	__S_ISUID	04000	/* Set user ID on execution.  */
+#define	__S_ISGID	02000	/* Set group ID on execution.  */
+#define	__S_ISVTX	01000	/* Save swapped text after use (sticky).  */
+#define	__S_IREAD	0400	/* Read by owner.  */
+#define	__S_IWRITE	0200	/* Write by owner.  */
+#define	__S_IEXEC	0100	/* Execute by owner.  */
+
+
+/* Thi macro (with a different name) is normally in <sys/sysmacros.h>.  */
+#define linux_makedev(major, minor) (((major) << 8 | (minor)))
diff --git a/sysdeps/unix/sysv/aix/linux/statconv.c b/sysdeps/unix/sysv/aix/linux/statconv.c
new file mode 100644
index 0000000000..5333e23d7b
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/linux/statconv.c
@@ -0,0 +1,35 @@
+void
+__stat_aix_to_linux (const struct stat *aixstat, struct stat *linuxstat)
+{
+  linuxstat->st_dev = linux_makedev (major (aixstat->st_dev),
+				     minor (aixstat->st_dev));
+  linuxstat->st_ino = aixstat->st_ino;
+  /* The following assumes that the mode values are the same on AIX
+     and Linux which is true in the moment.  */
+  linuxstat->st_mode = aixstat->st_mode;
+  linuxstat->st_nlink = aixstat->st_nlink;
+  /* There is no st_flag field in Linux.  */
+  linuxstat->st_uid = aixstat->st_uid;
+  linuxstat->st_gid = aixstat->st_gid;
+  linuxstat->st_rdev = linux_makedev (major (aixstat->st_rdev),
+				      minor (aixstat->st_rdev));
+  linuxstat->st_size = aixstat->st_size;
+  linuxstat->st_atime = aixstat->st_atime;
+  linuxstat->st_mtime = aixstat->st_mtime;
+  linuxstat->st_ctime = aixstat->st_ctime;
+  linuxstat->st_blksize = aixstat->st_blksize;
+  linuxstat->st_blocks = aixstat->st_blocks;
+  /* There is no st_vfstype in Linux.  */
+  /* There is no st_vfs in Linux.  */
+  /* There is no st_type in Linux.  */
+  /* There is no st_gen in Linux.  */
+
+  /* File in the padding values with repeatable values.  */
+  linuxstat->__pad1 = 0;
+  linuxstat->__pad2 = 0;
+  linuxstat->__unused1 = 0;
+  linuxstat->__unused2 = 0;
+  linuxstat->__unused3 = 0;
+  linuxstat->__unused4 = 0;
+  linuxstat->__unused5 = 0;
+}
diff --git a/sysdeps/unix/sysv/aix/lockf.c b/sysdeps/unix/sysv/aix/lockf.c
new file mode 100644
index 0000000000..43ac1af4b4
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/lockf.c
@@ -0,0 +1,27 @@
+/* Copyright (C) 1999, 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.  */
+
+#include <unistd.h>
+
+extern int klockf (int fd, int function, long long int size);
+
+int
+lockf (int fd, int cmd, off_t len)
+{
+  return klockf (fd, cmd, len);
+}
diff --git a/sysdeps/unix/sysv/aix/lockf64.c b/sysdeps/unix/sysv/aix/lockf64.c
new file mode 100644
index 0000000000..ad4840bc0a
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/lockf64.c
@@ -0,0 +1,27 @@
+/* Copyright (C) 1999, 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.  */
+
+#include <unistd.h>
+
+extern int klockf (int fd, int function, long long int size);
+
+int
+lockf64 (int fd, int cmd, off64_t len)
+{
+  return klockf (fd, cmd, len);
+}
diff --git a/sysdeps/unix/sysv/aix/lseek.c b/sysdeps/unix/sysv/aix/lseek.c
new file mode 100644
index 0000000000..99a6fb50b1
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/lseek.c
@@ -0,0 +1,8 @@
+/* This is a system call.  We only have to provide the wrapper.  */
+#include <unistd.h>
+
+off_t
+__lseek (int fd, off_t offset, int whence)
+{
+  return lseek (fd, offset, whence);
+}
diff --git a/sysdeps/unix/sysv/aix/lseek64.c b/sysdeps/unix/sysv/aix/lseek64.c
new file mode 100644
index 0000000000..621cdaee70
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/lseek64.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1999, 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.  */
+
+#include <unistd.h>
+
+extern int klseek (int fd, long long int offset, int sbase,
+		   long long int *new_offp);
+
+off64_t
+__libc_lseek64 (int fd, off64_t offset, int whence)
+{
+  long long int res;
+
+  if (klseek (fd, offset, whence, &res) < 0)
+    res = -1ll;
+
+  return res;
+}
+strong_alias (__libc_lseek64, __lseek64)
+strong_alias (__libc_lseek64, lseek64)
diff --git a/sysdeps/unix/sysv/aix/lxstat.c b/sysdeps/unix/sysv/aix/lxstat.c
new file mode 100644
index 0000000000..2edaf72d86
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/lxstat.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1999, 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.  */
+
+#include <assert.h>
+#include <sys/stat.h>
+
+/* this is #define'd in <sys/stat.h> - why #define it again?
+#define STX_LINK        0x01
+ */
+
+extern int statx (const char *pathname, struct stat *st, int len, int cmd);
+
+int
+__lxstat (int ver, const char *pathname, struct stat *st)
+{
+  assert (ver == 0);
+  return statx (pathname, st, sizeof (*st), STX_LINK);
+}
diff --git a/sysdeps/unix/sysv/aix/lxstat64.c b/sysdeps/unix/sysv/aix/lxstat64.c
new file mode 100644
index 0000000000..426b59443f
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/lxstat64.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1999, 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.  */
+
+#include <assert.h>
+#include <sys/stat.h>
+
+/* these are #define'd in <sys/stat.h> why #define them again?
+#define STX_LINK        0x01
+#define STX_64          0x08
+ */
+
+extern int statx (const char *pathname, struct stat64 *st, int len, int cmd);
+
+int
+__lxstat64 (int ver, const char *pathname, struct stat64 *st)
+{
+  assert (ver == 0);
+  return statx (pathname, st, sizeof (*st), STX_LINK | STX_64);
+}
diff --git a/sysdeps/unix/sysv/aix/mmap.c b/sysdeps/unix/sysv/aix/mmap.c
new file mode 100644
index 0000000000..cd967d36bc
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/mmap.c
@@ -0,0 +1,9 @@
+/* This is a system call.  We only have to provide the wrapper.  */
+#include <sys/mman.h>
+#include <sys/types.h>
+
+void *
+__mmap (void *addr, size_t len, int prot, int flags, int fd, off_t offset)
+{
+  return mmap (addr, len, prot, flags, fd, offset);
+}
diff --git a/sysdeps/unix/sysv/aix/mmap64.c b/sysdeps/unix/sysv/aix/mmap64.c
new file mode 100644
index 0000000000..9f2a277faf
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/mmap64.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1999, 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.  */
+
+#include <sys/mman.h>
+#include <sys/types.h>
+
+extern int kmmap (void *addr, size_t len, int prot, int flags, int fd,
+		  long long int offset);
+
+void *
+__mmap64 (void *addr, size_t len, int prot, int flags, int fd, off64_t offset)
+{
+  return kmmap (addr, len, prot, flags, fd, offset);
+}
+strong_alias (__mmap64, mmap64)
diff --git a/sysdeps/unix/sysv/aix/munmap.c b/sysdeps/unix/sysv/aix/munmap.c
new file mode 100644
index 0000000000..7f583be358
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/munmap.c
@@ -0,0 +1,8 @@
+/* This is a system call.  We only have to provide the wrapper.  */
+#include <sys/mman.h>
+
+int
+__munmap (void *addr, size_t len)
+{
+  return munmap (addr, len);
+}
diff --git a/sysdeps/unix/sysv/aix/nanosleep.c b/sysdeps/unix/sysv/aix/nanosleep.c
new file mode 100644
index 0000000000..1277319c94
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/nanosleep.c
@@ -0,0 +1,41 @@
+/* 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.  */
+
+#include <assert.h>
+#include <sys/time.h>
+#include <sys/types.h>
+
+/* this is declared in <sys/time.h> not <time.h > */
+#if 0
+struct timestruc_t
+{
+  time_t tv_sec;	/* seconds.  */
+  suseconds_t tv_nsec;	/* and nanoseconds.  */
+};
+#endif
+
+extern int _nsleep (struct timestruc_t *rqtp, struct timestruc_t *rmtp);
+
+int
+__libc_nanosleep (const struct timespec *req, struct timespec *rem)
+{
+  assert (sizeof (struct timestruc_t) == sizeof (*req));
+  return _nsleep ((struct timestruc_t *) req, (struct timestruc_t *) rem);
+}
+strong_alias (__libc_nanosleep, __nanosleep)
+strong_alias (__libc_nanosleep, nanosleep)
diff --git a/sysdeps/unix/sysv/aix/open.c b/sysdeps/unix/sysv/aix/open.c
new file mode 100644
index 0000000000..7bab537154
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/open.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1999, 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.  */
+
+#include <fcntl.h>
+#include <stdarg.h>
+#include <unistd.h>
+
+int
+__open (const char *file, int oflag, ...)
+{
+  int mode = 0;
+
+  if (oflag & O_CREAT)
+    {
+      va_list arg;
+      va_start (arg, oflag);
+      mode = va_arg (arg, int);
+      va_end (arg);
+    }
+
+  return open (file, oflag, mode);
+}
diff --git a/sysdeps/unix/sysv/aix/pread.c b/sysdeps/unix/sysv/aix/pread.c
new file mode 100644
index 0000000000..35fd7ca398
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/pread.c
@@ -0,0 +1,27 @@
+/* Copyright (C) 1999, 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.  */
+
+#include <unistd.h>
+
+extern int kpread (int fd, void *buf, size_t len, long long int off);
+
+ssize_t
+__pread (int fd, void *buf, size_t len, off_t off)
+{
+  return kpread (fd, buf, len, off);
+}
diff --git a/sysdeps/unix/sysv/aix/pread64.c b/sysdeps/unix/sysv/aix/pread64.c
new file mode 100644
index 0000000000..428fc63321
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/pread64.c
@@ -0,0 +1,27 @@
+/* Copyright (C) 1999, 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.  */
+
+#include <unistd.h>
+
+extern int kpread (int fd, void *buf, size_t len, long long int off);
+
+ssize_t
+__pread64 (int fd, void *buf, size_t len, off64_t off)
+{
+  return kpread (fd, buf, len, off);
+}
diff --git a/sysdeps/unix/sysv/aix/profil-counter.h b/sysdeps/unix/sysv/aix/profil-counter.h
new file mode 100644
index 0000000000..f58f1b6431
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/profil-counter.h
@@ -0,0 +1,27 @@
+/* Machine-dependent SIGPROF signal handler.  AIX version.
+   Copyright (C) 1996, 1997, 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.  */
+
+/* In many Unix systems signal handlers are called like this
+   and the interrupted PC is easily findable in the `struct sigcontext'.  */
+
+static void
+profil_counter (int signr, int code, struct sigcontext *scp)
+{
+  profil_count ((void *) scp->sc_jmpbuf.__jmp_context.__gpr[0]);
+}
diff --git a/sysdeps/unix/sysv/aix/read.c b/sysdeps/unix/sysv/aix/read.c
new file mode 100644
index 0000000000..556f7c6b67
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/read.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 1999, 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.  */
+
+#include <unistd.h>
+
+extern int kread (int fd, void *buf, size_t len);
+
+ssize_t
+__libc_read (int fd, void *buf, size_t len)
+{
+  return kread (fd, buf, len);
+}
+strong_alias (__libc_read, __read)
+strong_alias (__libc_read, read)
diff --git a/sysdeps/unix/sysv/aix/readlink.c b/sysdeps/unix/sysv/aix/readlink.c
new file mode 100644
index 0000000000..2770358b98
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/readlink.c
@@ -0,0 +1,8 @@
+/* This is a system call.  We only have to provide the wrapper.  */
+#include <unistd.h>
+
+int
+__readlink (const char *path, char *buf, size_t len)
+{
+  return readlink (path, buf, len);
+}
diff --git a/sysdeps/unix/sysv/aix/readv.c b/sysdeps/unix/sysv/aix/readv.c
new file mode 100644
index 0000000000..67d54c997c
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/readv.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1991, 1995-1998, 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.  */
+
+#include <sys/uio.h>
+
+extern ssize_t kreadv (int fd, const struct iovec *iovp, size_t iovcnt,
+		       long int ext);
+
+/* Read data from file descriptor FD, and put the result in the
+   buffers described by VECTOR, which is a vector of COUNT `struct iovec's.
+   The buffers are filled in the order specified.
+   Operates just like `read' (see <unistd.h>) except that data are
+   put in VECTOR instead of a contiguous buffer.  */
+ssize_t
+__readv (fd, vector, count)
+     int fd;
+     const struct iovec *vector;
+     int count;
+{
+  return kreadv (fd, vector, count, 0);
+}
+strong_alias (__readv, readv)
diff --git a/sysdeps/unix/sysv/aix/recvfrom.c b/sysdeps/unix/sysv/aix/recvfrom.c
new file mode 100644
index 0000000000..88f042a360
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/recvfrom.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 1999, 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.  */
+
+#include <sys/socket.h>
+
+extern int nrecvfrom (int s, void *uap_buf, int len, int flags,
+		      void *uap_from, int *uap_fromlenaddr);
+
+int
+recvfrom (int fd, void *buf, size_t n, int flags, __SOCKADDR_ARG addr,
+	  socklen_t *addr_len)
+{
+  return nrecvfrom (fd, buf, n, flags, addr.__sockaddr__, addr_len);
+}
diff --git a/sysdeps/unix/sysv/aix/recvmsg.c b/sysdeps/unix/sysv/aix/recvmsg.c
new file mode 100644
index 0000000000..baecd5a40b
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/recvmsg.c
@@ -0,0 +1,27 @@
+/* Copyright (C) 1999, 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.  */
+
+#include <sys/socket.h>
+
+extern int nrecvmsg (int s, struct msghdr *uap_msg, int flags);
+
+int
+recvmsg (int fd, struct msghdr *message, int flags)
+{
+  return nrecvmsg (fd, message, flags);
+}
diff --git a/sysdeps/unix/sysv/aix/revoke.c b/sysdeps/unix/sysv/aix/revoke.c
new file mode 100644
index 0000000000..2a81080489
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/revoke.c
@@ -0,0 +1,41 @@
+/* Revoke the access of all descriptors currently open on a file.  AIX version.
+   Copyright (C) 1995, 1996, 1997, 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.  */
+
+#include <fcntl.h>
+#include <unistd.h>
+#include <errno.h>
+
+extern int frevoke (int fdes);
+
+int
+revoke (file)
+     const char *file;
+{
+  int fd;
+  int res;
+
+  fd = open (file, O_RDONLY);
+  if (fd < 0)
+    return -1;
+
+  res = frevoke (fd);
+  (void) close (fd);
+
+  return res;
+}
diff --git a/sysdeps/unix/sysv/aix/sbrk.c b/sysdeps/unix/sysv/aix/sbrk.c
new file mode 100644
index 0000000000..9e4b5605c7
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/sbrk.c
@@ -0,0 +1,8 @@
+/* This is a system call.  We only have to provide the wrapper.  */
+#include <unistd.h>
+
+void *
+__sbrk (ptrdiff_t delta)
+{
+  return sbrk (delta);
+}
diff --git a/sysdeps/unix/sysv/aix/sched_yield.c b/sysdeps/unix/sysv/aix/sched_yield.c
new file mode 100644
index 0000000000..0820c9a4f8
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/sched_yield.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 1996, 1997, 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.  */
+
+#include <sched.h>
+
+extern void yield (void);
+
+
+/* Yield the processor.  */
+int
+__sched_yield (void)
+{
+  yield ();
+  return 0;
+}
+strong_alias (__sched_yield, sched_yield)
diff --git a/sysdeps/unix/sysv/aix/sendmsg.c b/sysdeps/unix/sysv/aix/sendmsg.c
new file mode 100644
index 0000000000..6dbbf5e8c1
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/sendmsg.c
@@ -0,0 +1,27 @@
+/* Copyright (C) 1999, 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.  */
+
+#include <sys/socket.h>
+
+extern int nsendmsg (int s, void *uap_msg, int flags);
+
+int
+sendmsg (int fd, const struct msghdr *message, int flags)
+{
+  return nsendmsg (fd, message, flags);
+}
diff --git a/sysdeps/unix/sysv/aix/setegid.c b/sysdeps/unix/sysv/aix/setegid.c
new file mode 100644
index 0000000000..9f660ff27a
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/setegid.c
@@ -0,0 +1,32 @@
+/* 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.  */
+
+#include <unistd.h>
+
+/* is there a reason *NOT* to include <sys/id.h>? If so #define ID_EFFECTIVE */
+#include <sys/id.h>
+
+
+extern int setgidx (int mask, gid_t gid);
+
+int
+__setegid (gid_t gid)
+{
+  return setgidx (ID_EFFECTIVE, gid);
+}
+strong_alias (__setegid, setegid)
diff --git a/sysdeps/unix/sysv/aix/seteuid.c b/sysdeps/unix/sysv/aix/seteuid.c
new file mode 100644
index 0000000000..de9280be9e
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/seteuid.c
@@ -0,0 +1,32 @@
+/* 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.  */
+
+#include <unistd.h>
+
+
+/* is there a reason *NOT* to include <sys/id.h>? If so #define ID_EFFECTIVE */
+#include <sys/id.h>
+
+extern int setuidx (int mask, uid_t uid);
+
+int
+__seteuid (uid_t uid)
+{
+  return setuidx (ID_EFFECTIVE, uid);
+}
+strong_alias (__seteuid, seteuid)
diff --git a/sysdeps/unix/sysv/aix/setgid.c b/sysdeps/unix/sysv/aix/setgid.c
new file mode 100644
index 0000000000..bf976ec72e
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/setgid.c
@@ -0,0 +1,32 @@
+/* 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.  */
+
+#include <unistd.h>
+
+
+/* is there a reason *NOT* to include <sys/id.h>?  If so #define ID_REAL */
+#include <sys/id.h>
+
+extern int setgidx (int mask, gid_t gid);
+
+int
+__setgid (gid_t gid)
+{
+  return setgidx (ID_REAL, gid);
+}
+strong_alias (__setgid, setgid)
diff --git a/sysdeps/unix/sysv/aix/setregid.c b/sysdeps/unix/sysv/aix/setregid.c
new file mode 100644
index 0000000000..02961b4dc0
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/setregid.c
@@ -0,0 +1,42 @@
+/* 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.  */
+
+#include <unistd.h>
+
+/* is there a reason *NOT* to include <sys/id.h>? */
+/* If so #define ID_EFFECTIVE and ID_REAL         */
+#include <sys/id.h>
+
+
+extern int setgidx (int mask, gid_t gid);
+
+int
+__setregid (gid_t rgid, gid_t egid)
+{
+  int res;
+
+  if (rgid == egid)
+    return setgidx (ID_EFFECTIVE | ID_REAL, egid);
+
+  res = setgidx (ID_REAL, rgid);
+  if (res == 0)
+    res = setgidx (ID_EFFECTIVE, egid);
+
+  return res;
+}
+strong_alias (__setregid, setregid)
diff --git a/sysdeps/unix/sysv/aix/setreuid.c b/sysdeps/unix/sysv/aix/setreuid.c
new file mode 100644
index 0000000000..ecf12a1ff3
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/setreuid.c
@@ -0,0 +1,41 @@
+/* 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.  */
+
+#include <unistd.h>
+
+/* is there a reason *NOT* to include <sys/id.h>? */
+/* If so #define ID_EFFECTIVE and ID_REAL         */
+#include <sys/id.h>
+
+extern int setuidx (int mask, uid_t uid);
+
+int
+__setreuid (uid_t ruid, uid_t euid)
+{
+  int res;
+
+  if (ruid == euid)
+    return setuidx (ID_EFFECTIVE | ID_REAL, euid);
+
+  res = setuidx (ID_REAL, ruid);
+  if (res == 0)
+    res = setuidx (ID_EFFECTIVE, euid);
+
+  return res;
+}
+strong_alias (__setreuid, setreuid)
diff --git a/sysdeps/unix/sysv/aix/setuid.c b/sysdeps/unix/sysv/aix/setuid.c
new file mode 100644
index 0000000000..679db050bd
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/setuid.c
@@ -0,0 +1,31 @@
+/* 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.  */
+
+#include <unistd.h>
+
+/* is there a reason *NOT* to include <sys/id.h>?  If so #define ID_REAL */
+#include <sys/id.h>
+
+extern int setuidx (int mask, uid_t uid);
+
+int
+__setuid (uid_t uid)
+{
+  return setuidx (ID_REAL, uid);
+}
+strong_alias (__setuid, setuid)
diff --git a/sysdeps/unix/sysv/aix/sigaction.c b/sysdeps/unix/sysv/aix/sigaction.c
new file mode 100644
index 0000000000..65801f4746
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/sigaction.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 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.  */
+
+#include <errno.h>
+#include <signal.h>
+
+extern int _sigaction (int sig, const struct sigaction *act,
+		       struct sigaction *oact);
+
+/* If ACT is not NULL, change the action for SIG to *ACT.
+   If OACT is not NULL, put the old action for SIG in *OACT.  */
+int
+__sigaction (sig, act, oact)
+     int sig;
+     const struct sigaction *act;
+     struct sigaction *oact;
+{
+  return _sigaction (sig, act, oact);
+}
+strong_alias (__sigaction, sigaction)
diff --git a/sysdeps/unix/sysv/aix/sigpending.c b/sysdeps/unix/sysv/aix/sigpending.c
new file mode 100644
index 0000000000..a6add428e2
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/sigpending.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 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.  */
+
+#include <signal.h>
+
+extern int _sigpending (sigset_t *set);
+
+
+/* Store in SET all signals that are blocked and pending.  */
+int
+sigpending (set)
+     sigset_t *set;
+{
+  return _sigpending (set);
+}
diff --git a/sysdeps/unix/sysv/aix/sigprocmask.c b/sysdeps/unix/sysv/aix/sigprocmask.c
new file mode 100644
index 0000000000..1046903b9c
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/sigprocmask.c
@@ -0,0 +1,8 @@
+/* This is a system call.  We only have to provide the wrapper.  */
+#include <signal.h>
+
+int
+__sigprocmask (int how, const sigset_t *set, sigset_t *oset)
+{
+  return sigprocmask (how, set, oset);
+}
diff --git a/sysdeps/unix/sysv/aix/sigset-cvt-mask.h b/sysdeps/unix/sysv/aix/sigset-cvt-mask.h
new file mode 100644
index 0000000000..5a01212473
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/sigset-cvt-mask.h
@@ -0,0 +1,28 @@
+/* Convert between lowlevel sigmask and libc representation of sigset_t.
+   AIX version.
+   Copyright (C) 1998, 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.  */
+
+#define sigset_set_old_mask(set, mask) \
+  do {									      \
+    (set)->__losigs = (unsigned int) mask;				      \
+    (set)->__hisigs = 0;    						      \
+  } while (0)
+
+#define sigset_get_old_mask(set, mask) \
+  ((mask) = (unsigned int) (set)->__losigs)
diff --git a/sysdeps/unix/sysv/aix/sigsuspend.c b/sysdeps/unix/sysv/aix/sigsuspend.c
new file mode 100644
index 0000000000..123728114e
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/sigsuspend.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 1991, 1995-1998, 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.  */
+
+#include <signal.h>
+
+extern int _sigsuspend (const sigset_t *sigmask);
+
+
+/* Change the set of blocked signals to SET,
+   wait until a signal arrives, and restore the set of blocked signals.  */
+int
+__sigsuspend (set)
+     const sigset_t *set;
+{
+  return _sigsuspend (set);
+}
+weak_alias (__sigsuspend, sigsuspend)
diff --git a/sysdeps/unix/sysv/aix/statfs.c b/sysdeps/unix/sysv/aix/statfs.c
new file mode 100644
index 0000000000..c0c966c890
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/statfs.c
@@ -0,0 +1,27 @@
+/* Copyright (C) 1999, 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.  */
+
+#include <sys/statfs.h>
+
+extern int statfs (const char *file, struct statfs *buf);
+
+int
+__statfs (const char *file, struct statfs *buf)
+{
+  return statfs (file, buf);
+}
diff --git a/sysdeps/unix/sysv/aix/sys/param.h b/sysdeps/unix/sysv/aix/sys/param.h
new file mode 100644
index 0000000000..e128d8d60b
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/sys/param.h
@@ -0,0 +1,18 @@
+/* This file should contain various parameter macros appropriate for the
+   machine and operating system.  There is no standard set of macros; this
+   file is just for compatibility with programs written for Unix that
+   expect it to define things.  On Unix systems that do not have their own
+   sysdep version of this file, it is generated at build time by examining
+   the installed headers on the system.  */
+
+#include <limits.h>
+
+#define MAXSYMLINKS  1
+#define MAXPATHLEN   256
+
+/* The pagesize is 4096.  */
+#define EXEC_PAGESIZE	4096
+
+/* Macros for min/max.  */
+#define MIN(a,b) (((a)<(b))?(a):(b))
+#define MAX(a,b) (((a)>(b))?(a):(b))
diff --git a/sysdeps/unix/sysv/aix/sys/ucontext.h b/sysdeps/unix/sysv/aix/sys/ucontext.h
new file mode 100644
index 0000000000..c2ebf0cf13
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/sys/ucontext.h
@@ -0,0 +1,113 @@
+/* Copyright (C) 1997, 1998, 1999, 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.  */
+
+#ifndef _SYS_UCONTEXT_H
+#define _SYS_UCONTEXT_H	1
+
+#include <features.h>
+#include <bits/types.h>
+#include <bits/sigset.h>
+
+
+/* Alternate, preferred interface.  */
+typedef struct sigaltstack
+  {
+    void *ss_sp;
+    size_t ss_size;
+    int ss_flags;
+    int __pad[4];
+  } stack_t;
+
+
+/* Forward declaration of AIX type.  */
+typedef struct label_t label_t;
+
+
+
+typedef unsigned int kvmhandle_t;
+typedef struct
+  {
+    unsigned long int __alloc;
+    kvmhandle_t __srval[16];
+  } adspace_t;
+
+
+
+#define _NGPRS 32
+#define _NFPRS 32
+
+struct __mstsafe
+{
+  struct __mstsave *__prev;		/* Previous save area. */
+  label_t *__kjmpbuf;			/* Pointer to saved context.  */
+  char *__stackfix;			/* Stack fix pointer.  */
+  char __intpri;			/* Interrupt priority.  */
+  char __backt;				/* Back-track flag.  */
+  char __rsvd[2];			/* Reserved.  */
+  __pid_t __curid;			/* Copy of curid.  */
+
+  int __excp_type;			/* Exception type for debugger.  */
+  unsigned long int __iar;		/* Instruction address register.  */
+  unsigned long int __msr;		/* Machine state register.  */
+  unsigned long int __cr;		/* Condition register.  */
+  unsigned long int __lr;		/* Link register.  */
+  unsigned long int __ctr;		/* Count register.  */
+  unsigned long int __xer;		/* Fixed point exception.  */
+  unsigned long int __mq;		/* Multiply/quotient register.  */
+  unsigned long int __tid;		/* TID register.  */
+  unsigned long int __fpscr;		/* Floating point status reg.  */
+  char __fpeu;				/* Floating point ever used.  */
+  char __fpinfo;			/* Floating point status flags.  */
+  char __pad[2];			/* Pad to dword boundary.  */
+                                        /* 1 implies state is in mstext */
+  unsigned long int __except[5];	/* exception structure.  */
+  char __pad1[4];			/* Old bus field.  */
+  unsigned long int __o_iar;		/* Old iar (for longjmp excpt).  */
+  unsigned long int __o_toc;		/* Old toc (for longjmp excpt).  */
+  unsigned long int __o_arg1;		/* Old arg1 (for longjmp excpt).  */
+  unsigned long int __excbranch;	/* If not NULL, address to branch
+					   to on exception.  Used by
+					   assembler routines for low
+					   cost exception handling.  */
+  unsigned long int __fpscrx;		/* Software extension to fpscr.  */
+  unsigned long int __o_vaddr;		/* Saved vaddr for vmexception.  */
+  unsigned long int __cachealign[7];	/* Reserved.  */
+  adspace_t __as;			/* Segment registers.  */
+  unsigned long int __gpr[_NGPRS];	/* General purpose registers.  */
+  double __fpr[_NFPRS];			/* Floating point registers.  */
+    };
+
+typedef struct mcontext_t
+  {
+    struct __mstsafe __jmp_context;
+  } mcontext_t;
+
+
+typedef struct ucontext_t
+  {
+    int __sc_onstack;		/* Sigstack state to restore.  */
+    __sigset_t uc_sigmask;	/* The set of signals that are blocked when
+                                   this context is active.  */
+    int __sc_uerror;		/* u_error to restore.  */
+    mcontext_t uc_mcontext;	/* Machine-specific image of saved context.  */
+    struct ucontext_t *uc_link;	/* context resumed after this one returns */
+    stack_t uc_stack;		/* stack used by context */
+    int __pad[4];
+  } ucontext_t;
+
+#endif /* sys/ucontext.h */
diff --git a/sysdeps/unix/sysv/aix/syscall.c b/sysdeps/unix/sysv/aix/syscall.c
new file mode 100644
index 0000000000..6f204ff809
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/syscall.c
@@ -0,0 +1,2 @@
+/* XXX We will have to see whether it is possible to implement this
+   function at all.  */
diff --git a/sysdeps/unix/sysv/aix/sysdep.h b/sysdeps/unix/sysv/aix/sysdep.h
new file mode 100644
index 0000000000..182e324dfc
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/sysdep.h
@@ -0,0 +1,88 @@
+/* Copyright (C) 1999, 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.  */
+
+#include <sysdeps/unix/powerpc/sysdep.h>
+
+
+/* This seems to always be the case on PPC.  */
+#define ALIGNARG(log2) log2
+
+/* How to define local lables.  */
+#define L(name) L..##name
+
+/* Label in text section.  */
+#define C_TEXT(name) .##name
+
+/* Function descriptor.  */
+#define FUNCDESC(real, code) \
+  .toc;									      \
+  .csect real##[DS], 3;							      \
+  .globl real;								      \
+real:									      \
+  .long code, TOC[tc0], 0;
+
+/* Code to generate function entry code.  */
+#define ENTRY(name) \
+  FUNCDESC (name, C_TEXT (name))					      \
+  .csect .text[PR], 2;							      \
+  .globl C_TEXT (name);							      \
+C_TEXT (name):
+
+/* XXX For now we don't define any code.  */
+#define CALL_MCOUNT
+
+#define EALIGN_W_0  /* No words to insert.  */
+#define EALIGN_W_1  nop
+#define EALIGN_W_2  nop;nop
+#define EALIGN_W_3  nop;nop;nop
+#define EALIGN_W_4  EALIGN_W_3;nop
+#define EALIGN_W_5  EALIGN_W_4;nop
+#define EALIGN_W_6  EALIGN_W_5;nop
+#define EALIGN_W_7  EALIGN_W_6;nop
+
+/* EALIGN is like ENTRY, but does alignment to 'words'*4 bytes
+   past a 2^align boundary.  */
+#ifdef PROF
+#define EALIGN(name, alignt, words)					      \
+  FUNCDESC (name, C_TEXT (name))					      \
+  .csect .text[PR], 2;							      \
+  .align ALIGNARG(2);							      \
+  .globl C_TEXT (name);							      \
+C_TEXT (name):								      \
+  CALL_MCOUNT								      \
+  b L(align_0);								      \
+  .align ALIGNARG(alignt);						      \
+  EALIGN_W_##words;							      \
+L(align_0):
+#else /* PROF */
+#define EALIGN(name, alignt, words)					      \
+  FUNCDESC (name, C_TEXT (name))					      \
+  .csect .text[PR], 2;							      \
+  .align ALIGNARG(alignt);						      \
+  EALIGN_W_##words;							      \
+  .globl C_TEXT (name);							      \
+C_TEXT (name):
+#endif
+
+/* No special end code for now.  We will eventually add to usual prolog
+   with function length etc.  */
+#define END(name)
+
+
+/* Jumping to another function.  We are jumping to the TOC entry.  */
+#define JUMPTARGET(name) name
diff --git a/sysdeps/unix/sysv/aix/truncate.c b/sysdeps/unix/sysv/aix/truncate.c
new file mode 100644
index 0000000000..78f20fad13
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/truncate.c
@@ -0,0 +1,28 @@
+/* Copyright (C) 1999, 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.  */
+
+#include <unistd.h>
+
+extern int ktruncate (const char *name, long long int length);
+
+int
+__truncate (const char *name, off_t length)
+{
+  return ktruncate (name, length);
+}
+strong_alias (__truncate, truncate)
diff --git a/sysdeps/unix/sysv/aix/truncate64.c b/sysdeps/unix/sysv/aix/truncate64.c
new file mode 100644
index 0000000000..6582a458b1
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/truncate64.c
@@ -0,0 +1,28 @@
+/* Copyright (C) 1999, 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.  */
+
+#include <unistd.h>
+
+extern int ktruncate (const char *name, long long int length);
+
+int
+__truncate64 (const char *name, off64_t length)
+{
+  return ktruncate (name, length);
+}
+strong_alias (__truncate64, truncate64)
diff --git a/sysdeps/unix/sysv/aix/uname.c b/sysdeps/unix/sysv/aix/uname.c
new file mode 100644
index 0000000000..6036fbbffd
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/uname.c
@@ -0,0 +1 @@
+/* This is a system call.  */
diff --git a/sysdeps/unix/sysv/aix/wait3.c b/sysdeps/unix/sysv/aix/wait3.c
new file mode 100644
index 0000000000..0e37f80d5d
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/wait3.c
@@ -0,0 +1,42 @@
+/* Copyright (C) 1992, 93, 1995-1999, 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.  */
+
+#include <errno.h>
+#include <sys/wait.h>
+#include <sys/types.h>
+#include <stddef.h>
+
+extern pid_t kwaitpid (int *stat_loc, pid_t pid, int options,
+		       struct rusage *ru_loc, siginfo_t *infop);
+
+/* Wait for a child to exit.  When one does, put its status in *STAT_LOC and
+   return its process ID.  For errors return (pid_t) -1.  If USAGE is not nil,
+   store information about the child's resource usage (as a `struct rusage')
+   there.  If the WUNTRACED bit is set in OPTIONS, return status for stopped
+   children; otherwise don't.  */
+pid_t
+__wait3 (__WAIT_STATUS stat_loc, int options, struct rusage *usage)
+{
+  if (usage != NULL)
+    {
+      __set_errno (ENOSYS);
+      return (pid_t) -1;
+    }
+  return kwaitpid (stat_loc.__iptr, WAIT_ANY, options, usage, NULL);
+}
+strong_alias (__wait3, wait3)
diff --git a/sysdeps/unix/sysv/aix/wait4.c b/sysdeps/unix/sysv/aix/wait4.c
new file mode 100644
index 0000000000..1a5f58f8d1
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/wait4.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1991, 1992, 1995-1997, 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.  */
+
+#include <errno.h>
+#include <stddef.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+extern pid_t kwaitpid (int *stat_loc, pid_t pid, int options,
+		       struct rusage *ru_loc, siginfo_t *infop);
+
+pid_t
+__wait4 (__pid_t pid, __WAIT_STATUS stat_loc, int options,
+	 struct rusage *usage)
+{
+  return kwaitpid (stat_loc.__iptr, pid, options, usage, NULL);
+}
+strong_alias (__wait4, wait4)
diff --git a/sysdeps/unix/sysv/aix/waitid.c b/sysdeps/unix/sysv/aix/waitid.c
new file mode 100644
index 0000000000..a1fcae0059
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/waitid.c
@@ -0,0 +1,82 @@
+/* Pseudo implementation of waitid.
+   Copyright (C) 1997, 1998, 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Zack Weinberg <zack@rabi.phys.columbia.edu>, 1997.
+
+   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 <signal.h>
+#define __need_NULL
+#include <stddef.h>
+#include <sys/wait.h>
+#include <sys/types.h>
+
+#include <assert.h>
+
+extern pid_t kwaitpid (int *stat_loc, pid_t pid, int options,
+		       struct rusage *ru_loc, siginfo_t *infop);
+
+int
+waitid (idtype, id, infop, options)
+     idtype_t idtype;
+     id_t id;
+     siginfo_t *infop;
+     int options;
+{
+  pid_t pid, child;
+  int status;
+
+  switch (idtype)
+    {
+    case P_PID:
+      if(id <= 0)
+	goto invalid;
+      pid = (pid_t) id;
+      break;
+    case P_PGID:
+      if (id < 0 || id == 1)
+	goto invalid;
+      pid = (pid_t) -id;
+      break;
+    case P_ALL:
+      pid = -1;
+      break;
+    default:
+    invalid:
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  /* Technically we're supposed to return EFAULT if infop is bogus,
+     but that would involve mucking with signals, which is
+     too much hassle.  User will have to deal with SIGSEGV/SIGBUS.
+     We just check for a null pointer. */
+
+  if (infop == NULL)
+    {
+      __set_errno (EFAULT);
+      return -1;
+    }
+
+  child = kwaitpid (&status, pid, options, NULL, infop);
+
+  if (child == -1)
+    /* `waitpid' set `errno' for us.  */
+    return -1;
+
+  return 0;
+}
diff --git a/sysdeps/unix/sysv/aix/waitpid.c b/sysdeps/unix/sysv/aix/waitpid.c
new file mode 100644
index 0000000000..10befc39be
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/waitpid.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 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.  */
+
+#include <errno.h>
+#include <stddef.h>
+#include <sys/wait.h>
+#include <sys/types.h>
+
+extern pid_t kwaitpid (int *stat_loc, pid_t pid, int options,
+		       struct rusage *ru_loc, siginfo_t *infop);
+
+
+/* Wait for a child matching PID to die.
+   If PID is greater than 0, match any process whose process ID is PID.
+   If PID is (pid_t) -1, match any process.
+   If PID is (pid_t) 0, match any process with the
+   same process group as the current process.
+   If PID is less than -1, match any process whose
+   process group is the absolute value of PID.
+   If the WNOHANG bit is set in OPTIONS, and that child
+   is not already dead, return (pid_t) 0.  If successful,
+   return PID and store the dead child's status in STAT_LOC.
+   Return (pid_t) -1 for errors.  If the WUNTRACED bit is set in OPTIONS,
+   return status for stopped children; otherwise don't.  */
+pid_t
+__libc_waitpid (pid_t pid, int *stat_loc, int options)
+{
+  if ((options & ~(WNOHANG|WUNTRACED)) != 0)
+    {
+      __set_errno (EINVAL);
+      return (pid_t) -1;
+    }
+
+  return kwaitpid (stat_loc, pid, options, NULL, NULL);
+}
+weak_alias (__libc_waitpid, __waitpid)
+weak_alias (__libc_waitpid, waitpid)
diff --git a/sysdeps/unix/sysv/aix/write.c b/sysdeps/unix/sysv/aix/write.c
new file mode 100644
index 0000000000..6a43fb1290
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/write.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1999 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
+
+   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 <unistd.h>
+
+#include "kernel_proto.h"
+
+
+ssize_t
+__write (fd, ptr, n)
+     int fd;
+     const void *ptr;
+     size_t n;
+{
+  return kwrite (fd, ptr, n);
+}
+/* AIX has no weak aliases (yet) but let's hope for better times.  */
+weak_alias (__write, write)
diff --git a/sysdeps/unix/sysv/aix/writev.c b/sysdeps/unix/sysv/aix/writev.c
new file mode 100644
index 0000000000..a8f9cf55b4
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/writev.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1991, 1995-1998, 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.  */
+
+#include <sys/uio.h>
+
+extern ssize_t kwritev (int fd, const struct iovec *iovp, size_t iovcnt,
+			long int ext);
+
+/* Read data from file descriptor FD, and put the result in the
+   buffers described by VECTOR, which is a vector of COUNT `struct iovec's.
+   The buffers are filled in the order specified.
+   Operates just like `read' (see <unistd.h>) except that data are
+   put in VECTOR instead of a contiguous buffer.  */
+ssize_t
+__writev (fd, vector, count)
+     int fd;
+     const struct iovec *vector;
+     int count;
+{
+  return kwritev (fd, vector, count, 0);
+}
+strong_alias (__writev, writev)
diff --git a/sysdeps/unix/sysv/aix/xstat.c b/sysdeps/unix/sysv/aix/xstat.c
new file mode 100644
index 0000000000..e053ce7f11
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/xstat.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1999, 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.  */
+
+#include <assert.h>
+#include <sys/stat.h>
+
+/* this is #define'd in <sys/stat.h> why #define it here?
+#define STX_NORMAL      0x00
+ */
+
+extern int statx (const char *pathname, struct stat *st, int len, int cmd);
+
+int
+__xstat (int ver, const char *pathname, struct stat *st)
+{
+  assert (ver == 0);
+  return statx (pathname, st, sizeof (*st), STX_NORMAL);
+}
diff --git a/sysdeps/unix/sysv/aix/xstat64.c b/sysdeps/unix/sysv/aix/xstat64.c
new file mode 100644
index 0000000000..07a62fd065
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/xstat64.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1999, 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.  */
+
+#include <assert.h>
+#include <sys/stat.h>
+
+/* these are #define'd in <sys/stat.h>, why #define them here? 
+#define STX_NORMAL      0x00
+#define STX_64          0x08
+ */
+
+extern int statx (const char *pathname, struct stat64 *st, int len, int cmd);
+
+int
+__xstat64 (int ver, const char *pathname, struct stat64 *st)
+{
+  assert (ver == 0);
+  return statx (pathname, st, sizeof (*st), STX_NORMAL | STX_64);
+}