summaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/linux/m68k
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-12-22 20:10:10 +0000
committerUlrich Drepper <drepper@redhat.com>2004-12-22 20:10:10 +0000
commita334319f6530564d22e775935d9c91663623a1b4 (patch)
treeb5877475619e4c938e98757d518bb1e9cbead751 /sysdeps/unix/sysv/linux/m68k
parent0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (diff)
(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
Diffstat (limited to 'sysdeps/unix/sysv/linux/m68k')
-rw-r--r--sysdeps/unix/sysv/linux/m68k/Dist9
-rw-r--r--sysdeps/unix/sysv/linux/m68k/Makefile17
-rw-r--r--sysdeps/unix/sysv/linux/m68k/Versions32
-rw-r--r--sysdeps/unix/sysv/linux/m68k/alphasort64.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/bits/a.out.h3
-rw-r--r--sysdeps/unix/sysv/linux/m68k/bits/fcntl.h188
-rw-r--r--sysdeps/unix/sysv/linux/m68k/bits/mman.h99
-rw-r--r--sysdeps/unix/sysv/linux/m68k/bits/poll.h43
-rw-r--r--sysdeps/unix/sysv/linux/m68k/bits/stat.h164
-rw-r--r--sysdeps/unix/sysv/linux/m68k/brk.c48
-rw-r--r--sysdeps/unix/sysv/linux/m68k/chown.c69
-rw-r--r--sysdeps/unix/sysv/linux/m68k/clone.S66
-rw-r--r--sysdeps/unix/sysv/linux/m68k/dl-librecon.h1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/fchown.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/fcntl.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/fxstat.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getdents64.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getegid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/geteuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getgroups.c2
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getmsg.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getpagesize.c50
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getresgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getresuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getrlimit.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getrlimit64.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getsysstats.c37
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/glob64.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/lchown.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/ldconfig.h1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/lockf64.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/lxstat.c2
-rw-r--r--sysdeps/unix/sysv/linux/m68k/mmap.S43
-rw-r--r--sysdeps/unix/sysv/linux/m68k/mremap.S29
-rw-r--r--sysdeps/unix/sysv/linux/m68k/msgctl.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/oldgetrlimit64.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/putmsg.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/readdir64.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/readdir64_r.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/register-dump.h214
-rw-r--r--sysdeps/unix/sysv/linux/m68k/scandir64.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/semctl.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/semtimedop.S60
-rw-r--r--sysdeps/unix/sysv/linux/m68k/setegid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/seteuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/setfsgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/setfsuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/setgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/setgroups.c2
-rw-r--r--sysdeps/unix/sysv/linux/m68k/setregid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/setresgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/setresuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/setreuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/setrlimit.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/setuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/shmctl.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/sigcontextinfo.h26
-rw-r--r--sysdeps/unix/sysv/linux/m68k/socket.S111
-rw-r--r--sysdeps/unix/sysv/linux/m68k/sys/procfs.h126
-rw-r--r--sysdeps/unix/sysv/linux/m68k/sys/reg.h89
-rw-r--r--sysdeps/unix/sysv/linux/m68k/sys/ucontext.h109
-rw-r--r--sysdeps/unix/sysv/linux/m68k/syscall.S33
-rw-r--r--sysdeps/unix/sysv/linux/m68k/syscalls.list5
-rw-r--r--sysdeps/unix/sysv/linux/m68k/sysdep.S49
-rw-r--r--sysdeps/unix/sysv/linux/m68k/sysdep.h295
-rw-r--r--sysdeps/unix/sysv/linux/m68k/versionsort64.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/vfork.S76
-rw-r--r--sysdeps/unix/sysv/linux/m68k/xstat.c1
70 files changed, 2136 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/linux/m68k/Dist b/sysdeps/unix/sysv/linux/m68k/Dist
new file mode 100644
index 0000000000..35fad7ff0e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/Dist
@@ -0,0 +1,9 @@
+clone.S
+mremap.S
+oldgetrlimit64.c
+setresuid.c
+setresgid.c
+setfsuid.c
+setfsgid.c
+sys/reg.h
+sys/procfs.h
diff --git a/sysdeps/unix/sysv/linux/m68k/Makefile b/sysdeps/unix/sysv/linux/m68k/Makefile
new file mode 100644
index 0000000000..6bb4f6b816
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/Makefile
@@ -0,0 +1,17 @@
+# Linux/m68k uses Motorola asm syntax and the ELF format.
+
+m68k-syntax-flag = -DMOTOROLA_SYNTAX
+
+ifeq ($(subdir),misc)
+sysdep_routines += mremap
+sysdep_headers += sys/reg.h
+endif
+
+ifeq ($(subdir),elf)
+sysdep-others += lddlibc4
+install-bin += lddlibc4
+endif
+
+ifeq ($(subdir),resource)
+sysdep_routines += oldgetrlimit64
+endif
diff --git a/sysdeps/unix/sysv/linux/m68k/Versions b/sysdeps/unix/sysv/linux/m68k/Versions
new file mode 100644
index 0000000000..0799bf310e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/Versions
@@ -0,0 +1,32 @@
+libc {
+ GLIBC_2.0 {
+ # Exception handling support functions from libgcc
+ __register_frame; __register_frame_table; __deregister_frame;
+ __frame_state_for; __register_frame_info_table;
+
+ # c*
+ cacheflush;
+ }
+ GLIBC_2.2 {
+ # functions used in other libraries
+ __xstat64; __fxstat64; __lxstat64;
+
+ # a*
+ alphasort64;
+
+ # g*
+ glob64;
+
+ # New rlimit interface
+ getrlimit; setrlimit; getrlimit64;
+
+ # r*
+ readdir64; readdir64_r;
+
+ # s*
+ scandir64;
+
+ # v*
+ versionsort64;
+ }
+}
diff --git a/sysdeps/unix/sysv/linux/m68k/alphasort64.c b/sysdeps/unix/sysv/linux/m68k/alphasort64.c
new file mode 100644
index 0000000000..0b5ae47d2f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/alphasort64.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/alphasort64.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/bits/a.out.h b/sysdeps/unix/sysv/linux/m68k/bits/a.out.h
new file mode 100644
index 0000000000..0fb52c3815
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/bits/a.out.h
@@ -0,0 +1,3 @@
+#ifndef __A_OUT_GNU_H__
+# error "Never use <bits/a.out.h> directly; include <a.out.h> instead."
+#endif
diff --git a/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h b/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h
new file mode 100644
index 0000000000..90c0a481e4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h
@@ -0,0 +1,188 @@
+/* O_*, F_*, FD_* bit values for Linux.
+ Copyright (C) 2000, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _FCNTL_H
+# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
+#endif
+
+
+#include <sys/types.h>
+
+/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
+ located on an ext2 file system */
+#define O_ACCMODE 0003
+#define O_RDONLY 00
+#define O_WRONLY 01
+#define O_RDWR 02
+#define O_CREAT 0100 /* not fcntl */
+#define O_EXCL 0200 /* not fcntl */
+#define O_NOCTTY 0400 /* not fcntl */
+#define O_TRUNC 01000 /* not fcntl */
+#define O_APPEND 02000
+#define O_NONBLOCK 04000
+#define O_NDELAY O_NONBLOCK
+#define O_SYNC 010000
+#define O_FSYNC O_SYNC
+#define O_ASYNC 020000
+
+#ifdef __USE_GNU
+# define O_DIRECTORY 040000 /* Must be a directory. */
+# define O_NOFOLLOW 0100000 /* Do not follow links. */
+# define O_DIRECT 0200000 /* Direct disk access. */
+# define O_NOATIME 01000000 /* Do not set atime. */
+#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 O_SYNC /* Synchronize data. */
+# define O_RSYNC O_SYNC /* Synchronize read operations. */
+#endif
+
+#ifdef __USE_LARGEFILE64
+# define O_LARGEFILE 0400000
+#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 F_GETLK64 /* Get record locking info. */
+# define F_SETLK F_SETLK64 /* Set record locking info (non-blocking).*/
+# define F_SETLKW F_SETLKW64 /* Set record locking info (blocking). */
+#endif
+#define F_GETLK64 12 /* Get record locking info. */
+#define F_SETLK64 13 /* Set record locking info (non-blocking). */
+#define F_SETLKW64 14 /* Set record locking info (blocking). */
+
+#if defined __USE_BSD || defined __USE_UNIX98
+# define F_SETOWN 8 /* Get owner of socket (receiver of SIGIO). */
+# define F_GETOWN 9 /* Set owner of socket (receiver of SIGIO). */
+#endif
+
+#ifdef __USE_GNU
+# define F_SETSIG 10 /* Set number of signal to be sent. */
+# define F_GETSIG 11 /* Get number of signal to be sent. */
+#endif
+
+#ifdef __USE_GNU
+# define F_SETLEASE 1024 /* Set a lease. */
+# define F_GETLEASE 1025 /* Enquire what lease is active. */
+# define F_NOTIFY 1026 /* Request notfications on a directory. */
+#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 0 /* Read lock. */
+#define F_WRLCK 1 /* Write lock. */
+#define F_UNLCK 2 /* Remove lock. */
+
+/* For old implementation of bsd flock(). */
+#define F_EXLCK 4 /* or 3 */
+#define F_SHLCK 8 /* or 4 */
+
+#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
+
+#ifdef __USE_GNU
+# define LOCK_MAND 32 /* This is a mandatory flock: */
+# define LOCK_READ 64 /* ... which allows concurrent read operations. */
+# define LOCK_WRITE 128 /* ... which allows concurrent write operations. */
+# define LOCK_RW 192 /* ... Which allows concurrent read & write operations. */
+#endif
+
+#ifdef __USE_GNU
+/* Types of directory notifications that may be requested with F_NOTIFY. */
+# define DN_ACCESS 0x00000001 /* File accessed. */
+# define DN_MODIFY 0x00000002 /* File modified. */
+# define DN_CREATE 0x00000004 /* File created. */
+# define DN_DELETE 0x00000008 /* File removed. */
+# define DN_RENAME 0x00000010 /* File renamed. */
+# define DN_ATTRIB 0x00000020 /* File changed attibutes. */
+# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */
+#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. */
+#else
+ __off64_t l_start; /* Offset where the lock begins. */
+ __off64_t l_len; /* Size of the locked area; zero means until EOF. */
+#endif
+ __pid_t l_pid; /* Process holding the lock. */
+ };
+
+#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'). */
+ __off64_t l_start; /* Offset where the lock begins. */
+ __off64_t l_len; /* Size of the locked area; zero means until EOF. */
+ __pid_t l_pid; /* Process holding the lock. */
+ };
+#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. */
+
+/* Advise to `posix_fadvise'. */
+#ifdef __USE_XOPEN2K
+# define POSIX_FADV_NORMAL 0 /* No further special treatment. */
+# define POSIX_FADV_RANDOM 1 /* Expect random page references. */
+# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */
+# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */
+# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
+# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
+#endif
+
+__BEGIN_DECLS
+
+/* Provide kernel hint to read ahead. */
+extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
+ __THROW;
+
+__END_DECLS
diff --git a/sysdeps/unix/sysv/linux/m68k/bits/mman.h b/sysdeps/unix/sysv/linux/m68k/bits/mman.h
new file mode 100644
index 0000000000..815a3da88f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/bits/mman.h
@@ -0,0 +1,99 @@
+/* Definitions for POSIX memory map interface. Linux/m68k version.
+ Copyright (C) 1997, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_MMAN_H
+# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead."
+#endif
+
+/* The following definitions basically come from the kernel headers.
+ But the kernel header is not namespace clean. */
+
+
+/* Protections are chosen from these bits, OR'd together. The
+ implementation does not necessarily support PROT_EXEC or PROT_WRITE
+ without PROT_READ. The only guarantees are that no writing will be
+ allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
+
+#define PROT_READ 0x1 /* Page can be read. */
+#define PROT_WRITE 0x2 /* Page can be written. */
+#define PROT_EXEC 0x4 /* Page can be executed. */
+#define PROT_NONE 0x0 /* Page can not be accessed. */
+#define PROT_GROWSDOWN 0x01000000 /* Extend change to start of
+ growsdown vma (mprotect only). */
+#define PROT_GROWSUP 0x02000000 /* Extend change to start of
+ growsup vma (mprotect only). */
+
+/* Sharing types (must choose one and only one of these). */
+#define MAP_SHARED 0x01 /* Share changes. */
+#define MAP_PRIVATE 0x02 /* Changes are private. */
+#ifdef __USE_MISC
+# define MAP_TYPE 0x0f /* Mask for type of mapping. */
+#endif
+
+/* Other flags. */
+#define MAP_FIXED 0x10 /* Interpret addr exactly. */
+#ifdef __USE_MISC
+# define MAP_FILE 0
+# define MAP_ANONYMOUS 0x20 /* Don't use a file. */
+# define MAP_ANON MAP_ANONYMOUS
+#endif
+
+/* These are Linux-specific. */
+#ifdef __USE_MISC
+# define MAP_GROWSDOWN 0x00100 /* Stack-like segment. */
+# define MAP_DENYWRITE 0x00800 /* ETXTBSY */
+# define MAP_EXECUTABLE 0x01000 /* Mark it as an executable. */
+# define MAP_LOCKED 0x02000 /* Lock the mapping. */
+# define MAP_NORESERVE 0x04000 /* Don't check for reservations. */
+# define MAP_POPULATE 0x08000 /* Populate (prefault) pagetables. */
+# define MAP_NONBLOCK 0x10000 /* Do not block on IO. */
+#endif
+
+/* Flags to `msync'. */
+#define MS_ASYNC 1 /* Sync memory asynchronously. */
+#define MS_SYNC 4 /* Synchronous memory sync. */
+#define MS_INVALIDATE 2 /* Invalidate the caches. */
+
+/* Flags for `mlockall'. */
+#define MCL_CURRENT 1 /* Lock all currently mapped pages. */
+#define MCL_FUTURE 2 /* Lock all additions to address
+ space. */
+
+/* Flags for `mremap'. */
+#ifdef __USE_GNU
+# define MREMAP_MAYMOVE 1
+#endif
+
+/* Advice to `madvise'. */
+#ifdef __USE_BSD
+# define MADV_NORMAL 0 /* No further special treatment. */
+# define MADV_RANDOM 1 /* Expect random page references. */
+# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */
+# define MADV_WILLNEED 3 /* Will need these pages. */
+# define MADV_DONTNEED 4 /* Don't need these pages. */
+#endif
+
+/* The POSIX people had to invent similar names for the same things. */
+#ifdef __USE_XOPEN2K
+# define POSIX_MADV_NORMAL 0 /* No further special treatment. */
+# define POSIX_MADV_RANDOM 1 /* Expect random page references. */
+# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */
+# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */
+# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */
+#endif
diff --git a/sysdeps/unix/sysv/linux/m68k/bits/poll.h b/sysdeps/unix/sysv/linux/m68k/bits/poll.h
new file mode 100644
index 0000000000..f7a7393154
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/bits/poll.h
@@ -0,0 +1,43 @@
+/* Copyright (C) 1997, 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_POLL_H
+# error "Never use <bits/poll.h> directly; include <sys/poll.h> instead."
+#endif
+
+/* Event types that can be polled for. These bits may be set in `events'
+ to indicate the interesting event types; they will appear in `revents'
+ to indicate the status of the file descriptor. */
+#define POLLIN 0x001 /* There is data to read. */
+#define POLLPRI 0x002 /* There is urgent data to read. */
+#define POLLOUT 0x004 /* Writing now will not block. */
+
+#ifdef __USE_XOPEN
+/* These values are defined in XPG4.2. */
+# define POLLRDNORM 0x040 /* Normal data may be read. */
+# define POLLRDBAND 0x080 /* Priority data may be read. */
+# define POLLWRNORM POLLOUT /* Writing now will not block. */
+# define POLLWRBAND 0x100 /* Priority data may be written. */
+#endif
+
+/* Event types always implicitly polled for. These bits need not be set in
+ `events', but they will appear in `revents' to indicate the status of
+ the file descriptor. */
+#define POLLERR 0x008 /* Error condition. */
+#define POLLHUP 0x010 /* Hung up. */
+#define POLLNVAL 0x020 /* Invalid polling request. */
diff --git a/sysdeps/unix/sysv/linux/m68k/bits/stat.h b/sysdeps/unix/sysv/linux/m68k/bits/stat.h
new file mode 100644
index 0000000000..dc06b13e2f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/bits/stat.h
@@ -0,0 +1,164 @@
+/* Copyright (C) 1992,95,96,97,98,99,2000,2001,2002
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#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
+ __ino_t __st_ino; /* 32bit 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
+#ifdef __USE_MISC
+ /* Nanosecond resolution timestamps are stored in a format
+ equivalent to 'struct timespec'. This is the type used
+ whenever possible but the Unix namespace rules do not allow the
+ identifier 'timespec' to appear in the <sys/stat.h> header.
+ Therefore we have to handle the use of this header in strictly
+ standard-compliant sources special. */
+ struct timespec st_atim; /* Time of last access. */
+ struct timespec st_mtim; /* Time of last modification. */
+ struct timespec st_ctim; /* Time of last status change. */
+# define st_atime st_atim.tv_sec /* Backward compatibility. */
+# define st_mtime st_mtim.tv_sec
+# define st_ctime st_ctim.tv_sec
+#else
+ __time_t st_atime; /* Time of last access. */
+ unsigned long int st_atimensec; /* Nscecs of last access. */
+ __time_t st_mtime; /* Time of last modification. */
+ unsigned long int st_mtimensec; /* Nsecs of last modification. */
+ __time_t st_ctime; /* Time of last status change. */
+ unsigned long int st_ctimensec; /* Nsecs of last status change. */
+#endif
+#ifndef __USE_FILE_OFFSET64
+ unsigned long int __unused4;
+ unsigned long int __unused5;
+#else
+ __ino64_t st_ino; /* File serial number. */
+#endif
+ };
+
+#ifdef __USE_LARGEFILE64
+struct stat64
+ {
+ __dev_t st_dev; /* Device. */
+ unsigned short int __pad1;
+
+ __ino_t __st_ino; /* 32bit 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. */
+#ifdef __USE_MISC
+ /* Nanosecond resolution timestamps are stored in a format
+ equivalent to 'struct timespec'. This is the type used
+ whenever possible but the Unix namespace rules do not allow the
+ identifier 'timespec' to appear in the <sys/stat.h> header.
+ Therefore we have to handle the use of this header in strictly
+ standard-compliant sources special. */
+ struct timespec st_atim; /* Time of last access. */
+ struct timespec st_mtim; /* Time of last modification. */
+ struct timespec st_ctim; /* Time of last status change. */
+#else
+ __time_t st_atime; /* Time of last access. */
+ unsigned long int st_atimensec; /* Nscecs of last access. */
+ __time_t st_mtime; /* Time of last modification. */
+ unsigned long int st_mtimensec; /* Nsecs of last modification. */
+ __time_t st_ctime; /* Time of last status change. */
+ unsigned long int st_ctimensec; /* Nsecs of last status change. */
+#endif
+ __ino64_t st_ino; /* File serial number. */
+ };
+#endif
+
+/* Tell code we have these members. */
+#define _STATBUF_ST_BLKSIZE
+#define _STATBUF_ST_RDEV
+/* Nanosecond resolution time values are supported. */
+#define _STATBUF_ST_NSEC
+
+/* 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. */
+#define __S_IFLNK 0120000 /* Symbolic link. */
+#define __S_IFSOCK 0140000 /* Socket. */
+
+/* POSIX.1b objects. Note that these macros always evaluate to zero. But
+ they do it by enforcing the correct use of the macros. */
+#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode)
+#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode)
+#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode)
+
+/* 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/linux/m68k/brk.c b/sysdeps/unix/sysv/linux/m68k/brk.c
new file mode 100644
index 0000000000..6b2c92852d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/brk.c
@@ -0,0 +1,48 @@
+/* brk system call for Linux/m68k.
+ Copyright (C) 1996, 1997, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sysdep.h>
+
+void *__curbrk = 0;
+
+/* Old braindamage in GCC's crtstuff.c requires this symbol in an attempt
+ to work around different old braindamage in the old Linux/x86 ELF
+ dynamic linker. Sigh. */
+weak_alias (__curbrk, ___brk_addr)
+
+int
+__brk (void *addr)
+{
+ void *newbrk;
+
+ INTERNAL_SYSCALL_DECL (err);
+ newbrk = (void *) INTERNAL_SYSCALL (brk, err, 1, addr);
+ __curbrk = newbrk;
+
+ if (newbrk < addr)
+ {
+ __set_errno (ENOMEM);
+ return -1;
+ }
+
+ return 0;
+}
+weak_alias (__brk, brk)
diff --git a/sysdeps/unix/sysv/linux/m68k/chown.c b/sysdeps/unix/sysv/linux/m68k/chown.c
new file mode 100644
index 0000000000..735fa5780a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/chown.c
@@ -0,0 +1,69 @@
+/* Copyright (C) 1998, 2000, 2002, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+#include <bp-checks.h>
+
+#include <linux/posix_types.h>
+#include "kernel-features.h"
+
+#ifdef __NR_chown32
+# if __ASSUME_32BITUIDS == 0
+/* This variable is shared with all files that need to check for 32bit
+ uids. */
+extern int __libc_missing_32bit_uids;
+# endif
+#endif /* __NR_chown32 */
+
+int
+__chown (const char *file, uid_t owner, gid_t group)
+{
+#if __ASSUME_32BITUIDS > 0
+ return INLINE_SYSCALL (chown32, 3, CHECK_STRING (file), owner, group);
+#else
+# ifdef __NR_chown32
+ if (__libc_missing_32bit_uids <= 0)
+ {
+ int result;
+ int saved_errno = errno;
+
+ result = INLINE_SYSCALL (chown32, 3, CHECK_STRING (file), owner, group);
+ if (result == 0 || errno != ENOSYS)
+ return result;
+
+ __set_errno (saved_errno);
+ __libc_missing_32bit_uids = 1;
+ }
+# endif /* __NR_chown32 */
+
+ if (((owner + 1) > (gid_t) ((__kernel_uid_t) -1U))
+ || ((group + 1) > (gid_t) ((__kernel_gid_t) -1U)))
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ return INLINE_SYSCALL (chown, 3, CHECK_STRING (file), owner, group);
+#endif
+}
+libc_hidden_def (__chown)
+weak_alias (__chown, chown)
diff --git a/sysdeps/unix/sysv/linux/m68k/clone.S b/sysdeps/unix/sysv/linux/m68k/clone.S
new file mode 100644
index 0000000000..6baf723d9b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/clone.S
@@ -0,0 +1,66 @@
+/* Copyright (C) 1996,97,98,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Andreas Schwab (schwab@issan.informatik.uni-dortmund.de)
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* clone is even more special than fork as it mucks with stacks
+ and invokes a function in the right context after its all over. */
+
+#include <sysdep.h>
+#define _ERRNO_H 1
+#include <bits/errno.h>
+
+/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
+
+ .text
+ENTRY (__clone)
+
+ /* Sanity check arguments. */
+ movel #-EINVAL, %d0
+ movel 4(%sp), %a0 /* no NULL function pointers */
+ tstl %a0
+ jeq SYSCALL_ERROR_LABEL
+ movel 8(%sp), %a1 /* no NULL stack pointers */
+ tstl %a1
+ jeq SYSCALL_ERROR_LABEL
+
+ /* Allocate space and copy the argument onto the new stack. */
+ movel 16(%sp), -(%a1)
+
+ /* Do the system call */
+ exg %d2, %a1 /* save %d2 and get stack pointer */
+ movel 12(%sp), %d1 /* get flags */
+ movel #SYS_ify (clone), %d0
+ trap #0
+ exg %d2, %a1 /* restore %d2 */
+
+ tstl %d0
+ jmi SYSCALL_ERROR_LABEL
+ jeq thread_start
+
+ rts
+
+thread_start:
+ subl %fp, %fp /* terminate the stack frame */
+ jsr (%a0)
+ movel %d0, %d1
+ movel #SYS_ify (exit), %d0
+ trap #0
+
+PSEUDO_END (__clone)
+
+weak_alias (__clone, clone)
diff --git a/sysdeps/unix/sysv/linux/m68k/dl-librecon.h b/sysdeps/unix/sysv/linux/m68k/dl-librecon.h
new file mode 100644
index 0000000000..dbb4e75712
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/dl-librecon.h
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/dl-librecon.h>
diff --git a/sysdeps/unix/sysv/linux/m68k/fchown.c b/sysdeps/unix/sysv/linux/m68k/fchown.c
new file mode 100644
index 0000000000..3a69ecc9e7
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/fchown.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/fchown.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/fcntl.c b/sysdeps/unix/sysv/linux/m68k/fcntl.c
new file mode 100644
index 0000000000..ea951bc4f9
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/fcntl.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/fcntl.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/fxstat.c b/sysdeps/unix/sysv/linux/m68k/fxstat.c
new file mode 100644
index 0000000000..4f219f0b9d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/fxstat.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/fxstat.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/getdents64.c b/sysdeps/unix/sysv/linux/m68k/getdents64.c
new file mode 100644
index 0000000000..0c75fb5a06
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/getdents64.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getdents64.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/getegid.c b/sysdeps/unix/sysv/linux/m68k/getegid.c
new file mode 100644
index 0000000000..37b4b4a530
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/getegid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getegid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/geteuid.c b/sysdeps/unix/sysv/linux/m68k/geteuid.c
new file mode 100644
index 0000000000..ebcb555b5e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/geteuid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/geteuid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/getgid.c b/sysdeps/unix/sysv/linux/m68k/getgid.c
new file mode 100644
index 0000000000..0a4d6061f0
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/getgid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getgid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/getgroups.c b/sysdeps/unix/sysv/linux/m68k/getgroups.c
new file mode 100644
index 0000000000..102ea24e14
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/getgroups.c
@@ -0,0 +1,2 @@
+/* We also have to rewrite the kernel gid_t to the user land type. */
+#include <sysdeps/unix/sysv/linux/i386/getgroups.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/getmsg.c b/sysdeps/unix/sysv/linux/m68k/getmsg.c
new file mode 100644
index 0000000000..3a1fa08525
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/getmsg.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getmsg.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/getpagesize.c b/sysdeps/unix/sysv/linux/m68k/getpagesize.c
new file mode 100644
index 0000000000..f7ffdc5185
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/getpagesize.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Andreas Schwab <schwab@suse.de>.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <unistd.h>
+#include <sys/param.h>
+#include <errno.h>
+
+#include <ldsodefs.h>
+#include <sysdep.h>
+#include <sys/syscall.h>
+
+/* Return the system page size. */
+int
+__getpagesize ()
+{
+#ifdef __NR_getpagesize
+ int result;
+#endif
+
+ if (GLRO(dl_pagesize) != 0)
+ return GLRO(dl_pagesize);
+
+#ifdef __NR_getpagesize
+ INTERNAL_SYSCALL_DECL (err);
+ result = INTERNAL_SYSCALL (getpagesize, err, 0);
+ /* The only possible error is ENOSYS. */
+ if (!INTERNAL_SYSCALL_ERROR_P (result, err))
+ return result;
+#endif
+
+ return 4096;
+}
+libc_hidden_def (__getpagesize)
+weak_alias (__getpagesize, getpagesize)
diff --git a/sysdeps/unix/sysv/linux/m68k/getresgid.c b/sysdeps/unix/sysv/linux/m68k/getresgid.c
new file mode 100644
index 0000000000..b703a414cc
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/getresgid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getresgid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/getresuid.c b/sysdeps/unix/sysv/linux/m68k/getresuid.c
new file mode 100644
index 0000000000..0b14cefe34
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/getresuid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getresuid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/getrlimit.c b/sysdeps/unix/sysv/linux/m68k/getrlimit.c
new file mode 100644
index 0000000000..fc06dbd641
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/getrlimit.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getrlimit.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/getrlimit64.c b/sysdeps/unix/sysv/linux/m68k/getrlimit64.c
new file mode 100644
index 0000000000..fef018f471
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/getrlimit64.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getrlimit64.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/getsysstats.c b/sysdeps/unix/sysv/linux/m68k/getsysstats.c
new file mode 100644
index 0000000000..23207e9bcb
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/getsysstats.c
@@ -0,0 +1,37 @@
+/* Determine various system internal values, Linux/m68k version.
+ Copyright (C) 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Andreas Schwab <schwab@suse.de>
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+
+/* We need to define a special parser for /proc/cpuinfo. */
+#define GET_NPROCS_PARSER(FP, BUFFER, RESULT) \
+ do \
+ { \
+ (RESULT) = 0; \
+ /* Read all lines and count the lines starting with the string \
+ "CPU:". We don't have to fear extremely long lines since \
+ the kernel will not generate them. 8192 bytes are really \
+ enough. */ \
+ while (fgets_unlocked (BUFFER, sizeof (BUFFER), FP) != NULL) \
+ if (strncmp (BUFFER, "CPU:", 4) == 0) \
+ ++(RESULT); \
+ } \
+ while (0)
+
+#include <sysdeps/unix/sysv/linux/getsysstats.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/getuid.c b/sysdeps/unix/sysv/linux/m68k/getuid.c
new file mode 100644
index 0000000000..d682c79a49
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/getuid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getuid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/glob64.c b/sysdeps/unix/sysv/linux/m68k/glob64.c
new file mode 100644
index 0000000000..82a9a296a7
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/glob64.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/glob64.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/lchown.c b/sysdeps/unix/sysv/linux/m68k/lchown.c
new file mode 100644
index 0000000000..c89de99ba2
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/lchown.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/lchown.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/ldconfig.h b/sysdeps/unix/sysv/linux/m68k/ldconfig.h
new file mode 100644
index 0000000000..953f192bcd
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/ldconfig.h
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/ldconfig.h>
diff --git a/sysdeps/unix/sysv/linux/m68k/lockf64.c b/sysdeps/unix/sysv/linux/m68k/lockf64.c
new file mode 100644
index 0000000000..a88f5a784a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/lockf64.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/lockf64.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/lxstat.c b/sysdeps/unix/sysv/linux/m68k/lxstat.c
new file mode 100644
index 0000000000..2371cd9719
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/lxstat.c
@@ -0,0 +1,2 @@
+#include <sysdeps/unix/sysv/linux/i386/lxstat.c>
+
diff --git a/sysdeps/unix/sysv/linux/m68k/mmap.S b/sysdeps/unix/sysv/linux/m68k/mmap.S
new file mode 100644
index 0000000000..086212a42b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/mmap.S
@@ -0,0 +1,43 @@
+/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+
+ .text
+ENTRY (__mmap)
+
+ move.l #SYS_ify (mmap), %d0 /* System call number in %d0. */
+
+ lea 4(%sp), %a0 /* Address of args is 1st arg. */
+ move.l %a0, %d1
+
+ /* Do the system call trap. */
+ trap #0
+
+ /* Kludge: negative numbers are among the legal return values.
+ If %d0 is between -4096 and 0 then there was an error. */
+ cmp.l #-4096, %d0
+ jhi SYSCALL_ERROR_LABEL
+
+ /* Successful; return the syscall's value. Copy it to %a0 because
+ mmap is declared to return a pointer. */
+ move.l %d0, %a0
+ rts
+PSEUDO_END (__mmap)
+
+weak_alias (__mmap, mmap)
diff --git a/sysdeps/unix/sysv/linux/m68k/mremap.S b/sysdeps/unix/sysv/linux/m68k/mremap.S
new file mode 100644
index 0000000000..68d961b553
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/mremap.S
@@ -0,0 +1,29 @@
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+
+/* The mremap system call is special because it needs to return
+ its value in register %a0. */
+
+ .text
+PSEUDO (__mremap, mremap, 4)
+ move.l %d0, %a0
+ rts
+PSEUDO_END (__mremap)
+weak_alias (__mremap, mremap)
diff --git a/sysdeps/unix/sysv/linux/m68k/msgctl.c b/sysdeps/unix/sysv/linux/m68k/msgctl.c
new file mode 100644
index 0000000000..9f9b8431a3
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/msgctl.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/msgctl.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/oldgetrlimit64.c b/sysdeps/unix/sysv/linux/m68k/oldgetrlimit64.c
new file mode 100644
index 0000000000..4c27e957bf
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/oldgetrlimit64.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/oldgetrlimit64.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/putmsg.c b/sysdeps/unix/sysv/linux/m68k/putmsg.c
new file mode 100644
index 0000000000..ebc1680ca7
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/putmsg.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/putmsg.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/readdir64.c b/sysdeps/unix/sysv/linux/m68k/readdir64.c
new file mode 100644
index 0000000000..2ea26dd409
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/readdir64.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/readdir64.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/readdir64_r.c b/sysdeps/unix/sysv/linux/m68k/readdir64_r.c
new file mode 100644
index 0000000000..9f54f897e3
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/readdir64_r.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/readdir64_r.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/register-dump.h b/sysdeps/unix/sysv/linux/m68k/register-dump.h
new file mode 100644
index 0000000000..a7ac3ca01c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/register-dump.h
@@ -0,0 +1,214 @@
+/* Dump registers.
+ Copyright (C) 1998, 2002, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Andreas Schwab <schwab@gnu.org>.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stddef.h>
+#include <sys/uio.h>
+#include <stdio-common/_itoa.h>
+
+/* We will print the register dump in this format:
+
+ D0: XXXXXXXX D1: XXXXXXXX D2: XXXXXXXX D3: XXXXXXXX
+ D4: XXXXXXXX D5: XXXXXXXX D6: XXXXXXXX D7: XXXXXXXX
+ A0: XXXXXXXX A1: XXXXXXXX A2: XXXXXXXX A3: XXXXXXXX
+ A4: XXXXXXXX A5: XXXXXXXX A6: XXXXXXXX A7: XXXXXXXX
+ PC: XXXXXXXX SR: XXXX
+
+ OldMask: XXXXXXXX Vector: XXXX
+
+ FP0: XXXXXXXXXXXXXXXXXXXXXXXX FP1: XXXXXXXXXXXXXXXXXXXXXXXX
+ FP2: XXXXXXXXXXXXXXXXXXXXXXXX FP3: XXXXXXXXXXXXXXXXXXXXXXXX
+ FP4: XXXXXXXXXXXXXXXXXXXXXXXX FP5: XXXXXXXXXXXXXXXXXXXXXXXX
+ FP6: XXXXXXXXXXXXXXXXXXXXXXXX FP7: XXXXXXXXXXXXXXXXXXXXXXXX
+ FPCR: XXXXXXXX FPSR: XXXXXXXX FPIAR: XXXXXXXX
+
+*/
+
+/* Linux saves only the call-clobbered registers in the sigcontext. We
+ need to use a trampoline that saves the rest so that the C code can
+ access them. We use the sc_fpstate field, since the handler is not
+ supposed to return anyway, thus it doesn't matter that it's clobbered. */
+
+/* static */ void catch_segfault (int, int, struct sigcontext *);
+
+/* Dummy function so that we can use asm with arguments. */
+static void __attribute_used__
+__dummy__ (void)
+{
+ asm ("\n\
+catch_segfault:\n\
+ move.l 12(%%sp),%%a0\n\
+ lea %c0(%%a0),%%a0\n\
+ /* Clear the first 4 bytes to make it a null fp state, just\n\
+ in case the handler does return. */\n\
+ clr.l (%%a0)+\n\
+ movem.l %%d2-%%d7/%%a2-%%a6,(%%a0)\n\
+ fmovem.x %%fp2-%%fp7,11*4(%%a0)\n\
+ jra real_catch_segfault"
+ : : "n" (offsetof (struct sigcontext, sc_fpstate)));
+}
+#define catch_segfault(a,b) \
+ __attribute_used__ real_catch_segfault(a,b)
+
+static void
+hexvalue (unsigned long int value, char *buf, size_t len)
+{
+ char *cp = _itoa_word (value, buf + len, 16, 0);
+ while (cp > buf)
+ *--cp = '0';
+}
+
+static void
+register_dump (int fd, struct sigcontext *ctx)
+{
+ char regs[20][8];
+ char fpregs[11][24];
+ struct iovec iov[63], *next_iov = iov;
+ unsigned long *p = (unsigned long *) ctx->sc_fpstate + 1;
+
+#define ADD_STRING(str) \
+ next_iov->iov_base = (char *) (str); \
+ next_iov->iov_len = strlen (str); \
+ ++next_iov
+#define ADD_MEM(str, len) \
+ next_iov->iov_base = (str); \
+ next_iov->iov_len = (len); \
+ ++next_iov
+
+ /* Generate strings of register contents. */
+ hexvalue (ctx->sc_d0, regs[0], 8);
+ hexvalue (ctx->sc_d1, regs[1], 8);
+ hexvalue (*p++, regs[2], 8);
+ hexvalue (*p++, regs[3], 8);
+ hexvalue (*p++, regs[4], 8);
+ hexvalue (*p++, regs[5], 8);
+ hexvalue (*p++, regs[6], 8);
+ hexvalue (*p++, regs[7], 8);
+ hexvalue (ctx->sc_a0, regs[8], 8);
+ hexvalue (ctx->sc_a1, regs[9], 8);
+ hexvalue (*p++, regs[10], 8);
+ hexvalue (*p++, regs[11], 8);
+ hexvalue (*p++, regs[12], 8);
+ hexvalue (*p++, regs[13], 8);
+ hexvalue (*p++, regs[14], 8);
+ hexvalue (ctx->sc_usp, regs[15], 8);
+ hexvalue (ctx->sc_pc, regs[16], 8);
+ hexvalue (ctx->sc_sr, regs[17], 4);
+ hexvalue (ctx->sc_mask, regs[18], 8);
+ hexvalue (ctx->sc_formatvec & 0xfff, regs[19], 4);
+ hexvalue (ctx->sc_fpregs[0], fpregs[0], 8);
+ hexvalue (ctx->sc_fpregs[1], fpregs[0] + 8, 8);
+ hexvalue (ctx->sc_fpregs[2], fpregs[0] + 16, 8);
+ hexvalue (ctx->sc_fpregs[3], fpregs[1], 8);
+ hexvalue (ctx->sc_fpregs[4], fpregs[1] + 8, 8);
+ hexvalue (ctx->sc_fpregs[5], fpregs[1] + 16, 8);
+ hexvalue (*p++, fpregs[2], 8);
+ hexvalue (*p++, fpregs[2] + 8, 8);
+ hexvalue (*p++, fpregs[2] + 16, 8);
+ hexvalue (*p++, fpregs[3], 8);
+ hexvalue (*p++, fpregs[3] + 8, 8);
+ hexvalue (*p++, fpregs[3] + 16, 8);
+ hexvalue (*p++, fpregs[4], 8);
+ hexvalue (*p++, fpregs[4] + 8, 8);
+ hexvalue (*p++, fpregs[4] + 16, 8);
+ hexvalue (*p++, fpregs[5], 8);
+ hexvalue (*p++, fpregs[5] + 8, 8);
+ hexvalue (*p++, fpregs[5] + 16, 8);
+ hexvalue (*p++, fpregs[6], 8);
+ hexvalue (*p++, fpregs[6] + 8, 8);
+ hexvalue (*p++, fpregs[6] + 16, 8);
+ hexvalue (*p++, fpregs[7], 8);
+ hexvalue (*p++, fpregs[7] + 8, 8);
+ hexvalue (*p++, fpregs[7] + 16, 8);
+ hexvalue (ctx->sc_fpcntl[0], fpregs[8], 8);
+ hexvalue (ctx->sc_fpcntl[1], fpregs[9], 8);
+ hexvalue (ctx->sc_fpcntl[2], fpregs[10], 8);
+
+ /* Generate the output. */
+ ADD_STRING ("Register dump:\n\n D0: ");
+ ADD_MEM (regs[0], 8);
+ ADD_STRING (" D1: ");
+ ADD_MEM (regs[1], 8);
+ ADD_STRING (" D2: ");
+ ADD_MEM (regs[2], 8);
+ ADD_STRING (" D3: ");
+ ADD_MEM (regs[3], 8);
+ ADD_STRING ("\n D4: ");
+ ADD_MEM (regs[4], 8);
+ ADD_STRING (" D5: ");
+ ADD_MEM (regs[5], 8);
+ ADD_STRING (" D6: ");
+ ADD_MEM (regs[6], 8);
+ ADD_STRING (" D7: ");
+ ADD_MEM (regs[7], 8);
+ ADD_STRING ("\n A0: ");
+ ADD_MEM (regs[8], 8);
+ ADD_STRING (" A1: ");
+ ADD_MEM (regs[9], 8);
+ ADD_STRING (" A2: ");
+ ADD_MEM (regs[10], 8);
+ ADD_STRING (" A3: ");
+ ADD_MEM (regs[11], 8);
+ ADD_STRING ("\n A4: ");
+ ADD_MEM (regs[12], 8);
+ ADD_STRING (" A5: ");
+ ADD_MEM (regs[13], 8);
+ ADD_STRING (" A6: ");
+ ADD_MEM (regs[14], 8);
+ ADD_STRING (" A7: ");
+ ADD_MEM (regs[15], 8);
+ ADD_STRING ("\n PC: ");
+ ADD_MEM (regs[16], 8);
+ ADD_STRING (" SR: ");
+ ADD_MEM (regs[17], 4);
+
+ ADD_STRING ("\n\n OldMask: ");
+ ADD_MEM (regs[18], 8);
+ ADD_STRING (" Vector: ");
+ ADD_MEM (regs[19], 4);
+
+ ADD_STRING ("\n\n FP0: ");
+ ADD_MEM (fpregs[0], 24);
+ ADD_STRING (" FP1: ");
+ ADD_MEM (fpregs[1], 24);
+ ADD_STRING ("\n FP2: ");
+ ADD_MEM (fpregs[2], 24);
+ ADD_STRING (" FP3: ");
+ ADD_MEM (fpregs[3], 24);
+ ADD_STRING ("\n FP4: ");
+ ADD_MEM (fpregs[4], 24);
+ ADD_STRING (" FP5: ");
+ ADD_MEM (fpregs[5], 24);
+ ADD_STRING ("\n FP6: ");
+ ADD_MEM (fpregs[6], 24);
+ ADD_STRING (" FP7: ");
+ ADD_MEM (fpregs[7], 24);
+ ADD_STRING ("\n FPCR: ");
+ ADD_MEM (fpregs[8], 8);
+ ADD_STRING (" FPSR: ");
+ ADD_MEM (fpregs[9], 8);
+ ADD_STRING (" FPIAR: ");
+ ADD_MEM (fpregs[10], 8);
+ ADD_STRING ("\n");
+
+ /* Write the stuff out. */
+ writev (fd, iov, next_iov - iov);
+}
+
+#define REGISTER_DUMP register_dump (fd, ctx)
diff --git a/sysdeps/unix/sysv/linux/m68k/scandir64.c b/sysdeps/unix/sysv/linux/m68k/scandir64.c
new file mode 100644
index 0000000000..506fd8877c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/scandir64.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/scandir64.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/semctl.c b/sysdeps/unix/sysv/linux/m68k/semctl.c
new file mode 100644
index 0000000000..e9b1a483c9
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/semctl.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/semctl.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/semtimedop.S b/sysdeps/unix/sysv/linux/m68k/semtimedop.S
new file mode 100644
index 0000000000..2775c124c6
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/semtimedop.S
@@ -0,0 +1,60 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Andreas Schwab <schwab@suse.de>, 2003.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+
+#define SYSOP_semtimedop 4
+
+#define SVRSP 8 /* saved register space */
+#define PARMS 4+SVRSP /* space for 3 saved regs */
+#define SEMID PARMS
+#define SOPS SEMID+4
+#define NSOPS SOPS+4
+#define TIMEOUT NSOPS+4
+
+ .text
+ENTRY (semtimedop)
+
+ /* Save registers. */
+ move.l %d2, %a1
+ move.l %d3, -(%sp)
+ move.l %d5, -(%sp)
+
+ move.l #SYSOP_semtimedop, %d1
+ move.l SEMID(%sp), %d2
+ move.l NSOPS(%sp), %d3
+ move.l SOPS(%sp), %d5
+ move.l TIMEOUT(%sp), %a0
+ move.l #SYS_ify (ipc), %d0
+
+ trap #0
+
+ /* Restore registers. */
+ move.l (%sp)+, %d5
+ move.l (%sp)+, %d3
+ move.l %a1, %d2
+
+ /* Check for error. */
+ tst.l %d0
+ jmi SYSCALL_ERROR_LABEL
+
+ /* Successful; return the syscall's value. */
+ ret
+
+PSEUDO_END (semtimedop)
diff --git a/sysdeps/unix/sysv/linux/m68k/setegid.c b/sysdeps/unix/sysv/linux/m68k/setegid.c
new file mode 100644
index 0000000000..2e3a54c893
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/setegid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setegid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/seteuid.c b/sysdeps/unix/sysv/linux/m68k/seteuid.c
new file mode 100644
index 0000000000..18e41d08c1
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/seteuid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/seteuid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/setfsgid.c b/sysdeps/unix/sysv/linux/m68k/setfsgid.c
new file mode 100644
index 0000000000..0886712569
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/setfsgid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setfsgid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/setfsuid.c b/sysdeps/unix/sysv/linux/m68k/setfsuid.c
new file mode 100644
index 0000000000..a9f22eb8ab
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/setfsuid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setfsuid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/setgid.c b/sysdeps/unix/sysv/linux/m68k/setgid.c
new file mode 100644
index 0000000000..377021d9ec
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/setgid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setgid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/setgroups.c b/sysdeps/unix/sysv/linux/m68k/setgroups.c
new file mode 100644
index 0000000000..0e7086278f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/setgroups.c
@@ -0,0 +1,2 @@
+/* We also have to rewrite the kernel gid_t to the user land type. */
+#include <sysdeps/unix/sysv/linux/i386/setgroups.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/setregid.c b/sysdeps/unix/sysv/linux/m68k/setregid.c
new file mode 100644
index 0000000000..99c57ad20f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/setregid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setregid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/setresgid.c b/sysdeps/unix/sysv/linux/m68k/setresgid.c
new file mode 100644
index 0000000000..daca1a4833
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/setresgid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setresgid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/setresuid.c b/sysdeps/unix/sysv/linux/m68k/setresuid.c
new file mode 100644
index 0000000000..3aeabe9ad7
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/setresuid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setresuid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/setreuid.c b/sysdeps/unix/sysv/linux/m68k/setreuid.c
new file mode 100644
index 0000000000..8ad61226e9
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/setreuid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setreuid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/setrlimit.c b/sysdeps/unix/sysv/linux/m68k/setrlimit.c
new file mode 100644
index 0000000000..bfaef74c38
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/setrlimit.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setrlimit.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/setuid.c b/sysdeps/unix/sysv/linux/m68k/setuid.c
new file mode 100644
index 0000000000..de394379be
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/setuid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setuid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/shmctl.c b/sysdeps/unix/sysv/linux/m68k/shmctl.c
new file mode 100644
index 0000000000..7eac6380dd
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/shmctl.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/shmctl.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/sigcontextinfo.h b/sysdeps/unix/sysv/linux/m68k/sigcontextinfo.h
new file mode 100644
index 0000000000..b7e08cfc95
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/sigcontextinfo.h
@@ -0,0 +1,26 @@
+/* Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>, 1998.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define SIGCONTEXT int _code, struct sigcontext *
+#define SIGCONTEXT_EXTRA_ARGS _code,
+#define GET_PC(ctx) ((void *) (ctx)->sc_pc)
+#define GET_FRAME(ctx) ((void *) __builtin_frame_address (1))
+#define GET_STACK(ctx) ((void *) (ctx)->sc_usp)
+#define CALL_SIGHANDLER(handler, signo, ctx) \
+ (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx))
diff --git a/sysdeps/unix/sysv/linux/m68k/socket.S b/sysdeps/unix/sysv/linux/m68k/socket.S
new file mode 100644
index 0000000000..1d10f33e17
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/socket.S
@@ -0,0 +1,111 @@
+/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep-cancel.h>
+#include <socketcall.h>
+
+#define P(a, b) P2(a, b)
+#define P2(a, b) a##b
+
+ .text
+/* The socket-oriented system calls are handled unusally in Linux.
+ They are all gated through the single `socketcall' system call number.
+ `socketcall' takes two arguments: the first is the subcode, specifying
+ which socket function is being called; and the second is a pointer to
+ the arguments to the specific function.
+
+ The .S files for the other calls just #define socket and #include this. */
+
+#ifndef __socket
+#ifndef NO_WEAK_ALIAS
+#define __socket P(__,socket)
+#else
+#define __socket socket
+#endif
+#endif
+
+.globl __socket
+ENTRY (__socket)
+#if defined NEED_CANCELLATION && defined CENABLE
+ SINGLE_THREAD_P
+ jne 1f
+#endif
+
+ /* Save registers. */
+ move.l %d2, %a0
+
+ move.l #SYS_ify (socketcall), %d0 /* System call number in %d0. */
+
+ /* Use ## so `socket' is a separate token that might be #define'd. */
+ move.l #P (SOCKOP_,socket), %d1 /* Subcode is first arg to syscall. */
+ lea 4(%sp), %a1 /* Address of args is 2nd arg. */
+ move.l %a1, %d2
+
+ /* Do the system call trap. */
+ trap #0
+
+ /* Restore registers. */
+ move.l %a0, %d2
+
+ /* %d0 is < 0 if there was an error. */
+ tst.l %d0
+ jmi SYSCALL_ERROR_LABEL
+
+ /* Successful; return the syscall's value. */
+ rts
+
+#if defined NEED_CANCELLATION && defined CENABLE
+1: /* Enable asynchronous cancellation. */
+ CENABLE
+
+ /* Save registers. */
+ move.l %d2, -(%sp)
+ move.l %d0, -(%sp)
+
+ move.l #SYS_ify (socketcall), %d0 /* System call number in %d0. */
+
+ /* Use ## so `socket' is a separate token that might be #define'd. */
+ move.l #P (SOCKOP_,socket), %d1 /* Subcode is first arg to syscall. */
+ lea 4+8(%sp), %a1 /* Address of args is 2nd arg. */
+ move.l %a1, %d2
+
+ /* Do the system call trap. */
+ trap #0
+
+ /* Restore cancellation. */
+ move.l %d0, %d2
+ CDISABLE
+ addq.l #4, %sp
+ move.l %d2, %d0
+
+ /* Restore registers. */
+ move.l (%sp)+, %d2
+
+ /* %d0 is < 0 if there was an error. */
+ tst.l %d0
+ jmi SYSCALL_ERROR_LABEL
+
+ /* Successful; return the syscall's value. */
+ rts
+#endif
+
+PSEUDO_END (__socket)
+
+#ifndef NO_WEAK_ALIAS
+weak_alias (__socket, socket)
+#endif
diff --git a/sysdeps/unix/sysv/linux/m68k/sys/procfs.h b/sysdeps/unix/sysv/linux/m68k/sys/procfs.h
new file mode 100644
index 0000000000..27abf8ef52
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/sys/procfs.h
@@ -0,0 +1,126 @@
+/* Copyright (C) 1996, 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_PROCFS_H
+#define _SYS_PROCFS_H 1
+
+/* This is somewhat modelled after the file of the same name on SVR4
+ systems. It provides a definition of the core file format for ELF
+ used on Linux. It doesn't have anything to do with the /proc file
+ system, even though Linux has one.
+
+ Anyway, the whole purpose of this file is for GDB and GDB only.
+ Don't read too much into it. Don't use it for anything other than
+ GDB unless you know what you are doing. */
+
+#include <features.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/user.h>
+
+__BEGIN_DECLS
+
+/* Type for a general-purpose register. */
+typedef unsigned long elf_greg_t;
+
+/* And the whole bunch of them. We could have used `struct
+ user_regs_struct' directly in the typedef, but tradition says that
+ the register set is an array, which does have some peculiar
+ semantics, so leave it that way. */
+#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t))
+typedef elf_greg_t elf_gregset_t[ELF_NGREG];
+
+/* Register set for the floating-point registers. */
+typedef struct user_m68kfp_struct elf_fpregset_t;
+
+
+/* Signal info. */
+struct elf_siginfo
+ {
+ int si_signo; /* Signal number. */
+ int si_code; /* Extra code. */
+ int si_errno; /* Errno. */
+ };
+
+
+/* Definitions to generate Intel SVR4-like core files. These mostly
+ have the same names as the SVR4 types with "elf_" tacked on the
+ front to prevent clashes with Linux definitions, and the typedef
+ forms have been avoided. This is mostly like the SVR4 structure,
+ but more Linuxy, with things that Linux does not support and which
+ GDB doesn't really use excluded. */
+
+struct elf_prstatus
+ {
+ struct elf_siginfo pr_info; /* Info associated with signal. */
+ short int pr_cursig; /* Current signal. */
+ unsigned long int pr_sigpend; /* Set of pending signals. */
+ unsigned long int pr_sighold; /* Set of held signals. */
+ __pid_t pr_pid;
+ __pid_t pr_ppid;
+ __pid_t pr_pgrp;
+ __pid_t pr_sid;
+ struct timeval pr_utime; /* User time. */
+ struct timeval pr_stime; /* System time. */
+ struct timeval pr_cutime; /* Cumulative user time. */
+ struct timeval pr_cstime; /* Cumulative system time. */
+ elf_gregset_t pr_reg; /* GP registers. */
+ int pr_fpvalid; /* True if math copro being used. */
+ };
+
+
+#define ELF_PRARGSZ (80) /* Number of chars for args. */
+
+struct elf_prpsinfo
+ {
+ char pr_state; /* Numeric process state. */
+ char pr_sname; /* Char for pr_state. */
+ char pr_zomb; /* Zombie. */
+ char pr_nice; /* Nice val. */
+ unsigned long int pr_flag; /* Flags. */
+ unsigned short int pr_uid;
+ unsigned short int pr_gid;
+ int pr_pid, pr_ppid, pr_pgrp, pr_sid;
+ /* Lots missing */
+ char pr_fname[16]; /* Filename of executable. */
+ char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */
+ };
+
+
+/* The rest of this file provides the types for emulation of the
+ Solaris <proc_service.h> interfaces that should be implemented by
+ users of libthread_db. */
+
+/* Addresses. */
+typedef void *psaddr_t;
+
+/* Register sets. Linux has different names. */
+typedef elf_gregset_t prgregset_t;
+typedef elf_fpregset_t prfpregset_t;
+
+/* We don't have any differences between processes and threads,
+ therefore have only one PID type. */
+typedef __pid_t lwpid_t;
+
+/* Process status and info. In the end we do provide typedefs for them. */
+typedef struct elf_prstatus prstatus_t;
+typedef struct elf_prpsinfo prpsinfo_t;
+
+__END_DECLS
+
+#endif /* sys/procfs.h */
diff --git a/sysdeps/unix/sysv/linux/m68k/sys/reg.h b/sysdeps/unix/sysv/linux/m68k/sys/reg.h
new file mode 100644
index 0000000000..418f8323f1
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/sys/reg.h
@@ -0,0 +1,89 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_REG_H
+#define _SYS_REG_H 1
+
+/* Index into an array of 4 byte integers returned from ptrace for
+ location of the users' stored general purpose registers. */
+
+enum
+{
+ PT_D1 = 0,
+#define PT_D1 PT_D1
+ PT_D2 = 1,
+#define PT_D2 PT_D2
+ PT_D3 = 2,
+#define PT_D3 PT_D3
+ PT_D4 = 3,
+#define PT_D4 PT_D4
+ PT_D5 = 4,
+#define PT_D5 PT_D5
+ PT_D6 = 5,
+#define PT_D6 PT_D6
+ PT_D7 = 6,
+#define PT_D7 PT_D7
+ PT_A0 = 7,
+#define PT_A0 PT_A0
+ PT_A1 = 8,
+#define PT_A1 PT_A1
+ PT_A2 = 9,
+#define PT_A2 PT_A2
+ PT_A3 = 10,
+#define PT_A3 PT_A3
+ PT_A4 = 11,
+#define PT_A4 PT_A4
+ PT_A5 = 12,
+#define PT_A5 PT_A5
+ PT_A6 = 13,
+#define PT_A6 PT_A6
+ PT_D0 = 14,
+#define PT_D0 PT_D0
+ PT_USP = 15,
+#define PT_USP PT_USP
+ PT_ORIG_D0 = 16,
+#define PT_ORIG_D0 PT_ORIG_D0
+ PT_SR = 17,
+#define PT_SR PT_SR
+ PT_PC = 18,
+#define PT_PC PT_PC
+ PT_FP0 = 21,
+#define PT_FP0 PT_FP0
+ PT_FP1 = 24,
+#define PT_FP1 PT_FP1
+ PT_FP2 = 27,
+#define PT_FP2 PT_FP2
+ PT_FP3 = 30,
+#define PT_FP3 PT_FP3
+ PT_FP4 = 33,
+#define PT_FP4 PT_FP4
+ PT_FP5 = 36,
+#define PT_FP5 PT_FP5
+ PT_FP6 = 39,
+#define PT_FP6 PT_FP6
+ PT_FP7 = 42,
+#define PT_FP7 PT_FP7
+ PT_FPCR = 45,
+#define PT_FPCR PT_FPCR
+ PT_FPSR = 46,
+#define PT_FPSR PT_FPSR
+ PT_FPIAR = 47
+#define PT_FPIAR PT_FPIAR
+};
+
+#endif /* _SYS_REG_H */
diff --git a/sysdeps/unix/sysv/linux/m68k/sys/ucontext.h b/sysdeps/unix/sysv/linux/m68k/sys/ucontext.h
new file mode 100644
index 0000000000..3c441dc5ce
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/sys/ucontext.h
@@ -0,0 +1,109 @@
+/* Copyright (C) 1997, 1999, 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* System V/m68k ABI compliant context switching support. */
+
+#ifndef _SYS_UCONTEXT_H
+#define _SYS_UCONTEXT_H 1
+
+#include <features.h>
+#include <signal.h>
+
+/* Type for general register. */
+typedef int greg_t;
+
+/* Number of general registers. */
+#define NGREG 18
+
+/* Container for all general registers. */
+typedef greg_t gregset_t[NGREG];
+
+/* Number of each register is the `gregset_t' array. */
+enum
+{
+ R_D0 = 0,
+#define R_D0 R_D0
+ R_D1 = 1,
+#define R_D1 R_D1
+ R_D2 = 2,
+#define R_D2 R_D2
+ R_D3 = 3,
+#define R_D3 R_D3
+ R_D4 = 4,
+#define R_D4 R_D4
+ R_D5 = 5,
+#define R_D5 R_D5
+ R_D6 = 6,
+#define R_D6 R_D6
+ R_D7 = 7,
+#define R_D7 R_D7
+ R_A0 = 8,
+#define R_A0 R_A0
+ R_A1 = 9,
+#define R_A1 R_A1
+ R_A2 = 10,
+#define R_A2 R_A2
+ R_A3 = 11,
+#define R_A3 R_A3
+ R_A4 = 12,
+#define R_A4 R_A4
+ R_A5 = 13,
+#define R_A5 R_A5
+ R_A6 = 14,
+#define R_A6 R_A6
+ R_A7 = 15,
+#define R_A7 R_A7
+ R_SP = 15,
+#define R_SP R_SP
+ R_PC = 16,
+#define R_PC R_PC
+ R_PS = 17
+#define R_PS R_PS
+};
+
+/* Structure to describe FPU registers. */
+typedef struct fpregset
+{
+ int f_fpregs[8][3];
+ int f_pcr;
+ int f_psr;
+ int f_fpiaddr;
+} fpregset_t;
+
+/* Context to describe whole processor state. */
+typedef struct
+{
+ int version;
+ gregset_t gregs;
+ fpregset_t fpregs;
+} mcontext_t;
+
+#define MCONTEXT_VERSION 2
+
+/* Userlevel context. */
+typedef struct ucontext
+{
+ unsigned long int uc_flags;
+ struct ucontext *uc_link;
+ __sigset_t uc_sigmask;
+ stack_t uc_stack;
+ mcontext_t uc_mcontext;
+ long int uc_filler[174];
+} ucontext_t;
+
+#endif /* sys/ucontext.h */
diff --git a/sysdeps/unix/sysv/linux/m68k/syscall.S b/sysdeps/unix/sysv/linux/m68k/syscall.S
new file mode 100644
index 0000000000..4f2c747c27
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/syscall.S
@@ -0,0 +1,33 @@
+/* Copyright (C) 1996, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+
+/* Please consult the file sysdeps/unix/sysv/linux/m68k/sysdep.h for
+ more information about the value -4095 used below.*/
+
+ .text
+ENTRY (syscall)
+ move.l 4(%sp), %d0 /* Load syscall number. */
+ _DOARGS_5 (24) /* Frob arguments. */
+ trap &0 /* Do the system call. */
+ UNDOARGS_5 /* Unfrob arguments. */
+ cmp.l &-4095, %d0 /* Check %d0 for error. */
+ jcc SYSCALL_ERROR_LABEL /* Jump to error handler if negative. */
+ rts /* Return to caller. */
+PSEUDO_END (syscall)
diff --git a/sysdeps/unix/sysv/linux/m68k/syscalls.list b/sysdeps/unix/sysv/linux/m68k/syscalls.list
new file mode 100644
index 0000000000..98d30667bd
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/syscalls.list
@@ -0,0 +1,5 @@
+# File name Caller Syscall name Args Strong name Weak names
+
+cacheflush EXTRA cacheflush i:iiii __cacheflush cacheflush
+oldgetrlimit EXTRA getrlimit i:ip __old_getrlimit getrlimit@GLIBC_2.0
+oldsetrlimit EXTRA setrlimit i:ip __old_setrlimit setrlimit@GLIBC_2.0
diff --git a/sysdeps/unix/sysv/linux/m68k/sysdep.S b/sysdeps/unix/sysv/linux/m68k/sysdep.S
new file mode 100644
index 0000000000..e4ec92d836
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/sysdep.S
@@ -0,0 +1,49 @@
+/* Copyright (C) 1996, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+
+
+/* The following code is only used in the shared library when we
+ compile the reentrant version. Otherwise each system call defines
+ each own version. */
+
+#ifndef PIC
+
+/* The syscall stubs jump here when they detect an error. */
+
+#undef CALL_MCOUNT
+#define CALL_MCOUNT /* Don't insert the profiling call, it clobbers %d0. */
+
+ .text
+ENTRY (__syscall_error)
+ neg.l %d0
+#ifndef _LIBC_REENTRANT
+ move.l %d0, errno
+#else
+ move.l %d0, -(%sp)
+ jbsr __errno_location
+ move.l (%sp)+, (%a0)
+#endif
+ move.l #-1, %d0
+ /* Copy return value to %a0 for syscalls that are declared to
+ return a pointer. */
+ move.l %d0, %a0
+ rts
+END (__syscall_error)
+#endif /* PIC */
diff --git a/sysdeps/unix/sysv/linux/m68k/sysdep.h b/sysdeps/unix/sysv/linux/m68k/sysdep.h
new file mode 100644
index 0000000000..091dfc9c7d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/sysdep.h
@@ -0,0 +1,295 @@
+/* Copyright (C) 1996, 1997, 1998, 2000, 2003, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Written by Andreas Schwab, <schwab@issan.informatik.uni-dortmund.de>,
+ December 1995.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdeps/unix/sysdep.h>
+#include <sysdeps/m68k/sysdep.h>
+
+/* Defines RTLD_PRIVATE_ERRNO. */
+#include <dl-sysdep.h>
+
+/* For Linux we can use the system call table in the header file
+ /usr/include/asm/unistd.h
+ of the kernel. But these symbols do not follow the SYS_* syntax
+ so we have to redefine the `SYS_ify' macro here. */
+#undef SYS_ify
+#ifdef __STDC__
+# define SYS_ify(syscall_name) __NR_##syscall_name
+#else
+# define SYS_ify(syscall_name) __NR_/**/syscall_name
+#endif
+
+#ifdef __ASSEMBLER__
+
+/* Linux uses a negative return value to indicate syscall errors, unlike
+ most Unices, which use the condition codes' carry flag.
+
+ Since version 2.1 the return value of a system call might be negative
+ even if the call succeeded. E.g., the `lseek' system call might return
+ a large offset. Therefore we must not anymore test for < 0, but test
+ for a real error by making sure the value in %d0 is a real error
+ number. Linus said he will make sure the no syscall returns a value
+ in -1 .. -4095 as a valid result so we can savely test with -4095. */
+
+/* We don't want the label for the error handler to be visible in the symbol
+ table when we define it here. */
+#ifdef PIC
+#define SYSCALL_ERROR_LABEL .Lsyscall_error
+#else
+#define SYSCALL_ERROR_LABEL __syscall_error
+#endif
+
+#undef PSEUDO
+#define PSEUDO(name, syscall_name, args) \
+ .text; \
+ ENTRY (name) \
+ DO_CALL (syscall_name, args); \
+ cmp.l &-4095, %d0; \
+ jcc SYSCALL_ERROR_LABEL
+
+#undef PSEUDO_END
+#define PSEUDO_END(name) \
+ SYSCALL_ERROR_HANDLER; \
+ END (name)
+
+#undef PSEUDO_NOERRNO
+#define PSEUDO_NOERRNO(name, syscall_name, args) \
+ .text; \
+ ENTRY (name) \
+ DO_CALL (syscall_name, args)
+
+#undef PSEUDO_END_NOERRNO
+#define PSEUDO_END_NOERRNO(name) \
+ END (name)
+
+#define ret_NOERRNO rts
+
+/* The function has to return the error code. */
+#undef PSEUDO_ERRVAL
+#define PSEUDO_ERRVAL(name, syscall_name, args) \
+ .text; \
+ ENTRY (name) \
+ DO_CALL (syscall_name, args); \
+ negl %d0
+
+#undef PSEUDO_END_ERRVAL
+#define PSEUDO_END_ERRVAL(name) \
+ END (name)
+
+#define ret_ERRVAL rts
+
+#ifdef PIC
+# if RTLD_PRIVATE_ERRNO
+# define SYSCALL_ERROR_HANDLER \
+SYSCALL_ERROR_LABEL: \
+ lea (rtld_errno, %pc), %a0; \
+ neg.l %d0; \
+ move.l %d0, (%a0); \
+ move.l &-1, %d0; \
+ /* Copy return value to %a0 for syscalls that are declared to return \
+ a pointer (e.g., mmap). */ \
+ move.l %d0, %a0; \
+ rts;
+# else /* !RTLD_PRIVATE_ERRNO */
+/* Store (- %d0) into errno through the GOT. */
+# if defined _LIBC_REENTRANT
+# define SYSCALL_ERROR_HANDLER \
+SYSCALL_ERROR_LABEL: \
+ neg.l %d0; \
+ move.l %d0, -(%sp); \
+ jbsr __errno_location@PLTPC; \
+ move.l (%sp)+, (%a0); \
+ move.l &-1, %d0; \
+ /* Copy return value to %a0 for syscalls that are declared to return \
+ a pointer (e.g., mmap). */ \
+ move.l %d0, %a0; \
+ rts;
+# else /* !_LIBC_REENTRANT */
+# define SYSCALL_ERROR_HANDLER \
+SYSCALL_ERROR_LABEL: \
+ move.l (errno@GOTPC, %pc), %a0; \
+ neg.l %d0; \
+ move.l %d0, (%a0); \
+ move.l &-1, %d0; \
+ /* Copy return value to %a0 for syscalls that are declared to return \
+ a pointer (e.g., mmap). */ \
+ move.l %d0, %a0; \
+ rts;
+# endif /* _LIBC_REENTRANT */
+# endif /* RTLD_PRIVATE_ERRNO */
+#else
+# define SYSCALL_ERROR_HANDLER /* Nothing here; code in sysdep.S is used. */
+#endif /* PIC */
+
+/* Linux takes system call arguments in registers:
+
+ syscall number %d0 call-clobbered
+ arg 1 %d1 call-clobbered
+ arg 2 %d2 call-saved
+ arg 3 %d3 call-saved
+ arg 4 %d4 call-saved
+ arg 5 %d5 call-saved
+
+ The stack layout upon entering the function is:
+
+ 20(%sp) Arg# 5
+ 16(%sp) Arg# 4
+ 12(%sp) Arg# 3
+ 8(%sp) Arg# 2
+ 4(%sp) Arg# 1
+ (%sp) Return address
+
+ (Of course a function with say 3 arguments does not have entries for
+ arguments 4 and 5.)
+
+ Separate move's are faster than movem, but need more space. Since
+ speed is more important, we don't use movem. Since %a0 and %a1 are
+ scratch registers, we can use them for saving as well. */
+
+#define DO_CALL(syscall_name, args) \
+ move.l &SYS_ify(syscall_name), %d0; \
+ DOARGS_##args \
+ trap &0; \
+ UNDOARGS_##args
+
+#define DOARGS_0 /* No arguments to frob. */
+#define UNDOARGS_0 /* No arguments to unfrob. */
+#define _DOARGS_0(n) /* No arguments to frob. */
+
+#define DOARGS_1 _DOARGS_1 (4)
+#define _DOARGS_1(n) move.l n(%sp), %d1; _DOARGS_0 (n)
+#define UNDOARGS_1 UNDOARGS_0
+
+#define DOARGS_2 _DOARGS_2 (8)
+#define _DOARGS_2(n) move.l %d2, %a0; move.l n(%sp), %d2; _DOARGS_1 (n-4)
+#define UNDOARGS_2 UNDOARGS_1; move.l %a0, %d2
+
+#define DOARGS_3 _DOARGS_3 (12)
+#define _DOARGS_3(n) move.l %d3, %a1; move.l n(%sp), %d3; _DOARGS_2 (n-4)
+#define UNDOARGS_3 UNDOARGS_2; move.l %a1, %d3
+
+#define DOARGS_4 _DOARGS_4 (16)
+#define _DOARGS_4(n) move.l %d4, -(%sp); move.l n+4(%sp), %d4; _DOARGS_3 (n)
+#define UNDOARGS_4 UNDOARGS_3; move.l (%sp)+, %d4
+
+#define DOARGS_5 _DOARGS_5 (20)
+#define _DOARGS_5(n) move.l %d5, -(%sp); move.l n+4(%sp), %d5; _DOARGS_4 (n)
+#define UNDOARGS_5 UNDOARGS_4; move.l (%sp)+, %d5
+
+
+#define ret rts
+#if 0 /* Not used by Linux */
+#define r0 %d0
+#define r1 %d1
+#define MOVE(x,y) movel x , y
+#endif
+
+#else /* not __ASSEMBLER__ */
+
+/* Define a macro which expands into the inline wrapper code for a system
+ call. */
+#undef INLINE_SYSCALL
+#define INLINE_SYSCALL(name, nr, args...) \
+ ({ unsigned int _sys_result = INTERNAL_SYSCALL (name, , nr, args); \
+ if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result, ), 0))\
+ { \
+ __set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, )); \
+ _sys_result = (unsigned int) -1; \
+ } \
+ (int) _sys_result; })
+
+#undef INTERNAL_SYSCALL_DECL
+#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
+
+/* Define a macro which expands inline into the wrapper code for a system
+ call. This use is for internal calls that do not need to handle errors
+ normally. It will never touch errno. This returns just what the kernel
+ gave back. */
+#undef INTERNAL_SYSCALL
+#define INTERNAL_SYSCALL(name, err, nr, args...) \
+ ({ unsigned int _sys_result; \
+ { \
+ /* Load argument values in temporary variables
+ to perform side effects like function calls
+ before the call used registers are set. */ \
+ LOAD_ARGS_##nr (args) \
+ LOAD_REGS_##nr \
+ register int _d0 asm ("%d0") = __NR_##name; \
+ asm volatile ("trap #0" \
+ : "=d" (_d0) \
+ : "0" (_d0) ASM_ARGS_##nr \
+ : "memory"); \
+ _sys_result = _d0; \
+ } \
+ (int) _sys_result; })
+
+#undef INTERNAL_SYSCALL_ERROR_P
+#define INTERNAL_SYSCALL_ERROR_P(val, err) \
+ ((unsigned int) (val) >= -4095U)
+
+#undef INTERNAL_SYSCALL_ERRNO
+#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
+
+#define LOAD_ARGS_0()
+#define LOAD_REGS_0
+#define ASM_ARGS_0
+#define LOAD_ARGS_1(a1) \
+ LOAD_ARGS_0 () \
+ int __arg1 = (int) (a1);
+#define LOAD_REGS_1 \
+ register int _d1 asm ("d1") = __arg1; \
+ LOAD_REGS_0
+#define ASM_ARGS_1 ASM_ARGS_0, "d" (_d1)
+#define LOAD_ARGS_2(a1, a2) \
+ LOAD_ARGS_1 (a1) \
+ int __arg2 = (int) (a2);
+#define LOAD_REGS_2 \
+ register int _d2 asm ("d2") = __arg2; \
+ LOAD_REGS_1
+#define ASM_ARGS_2 ASM_ARGS_1, "d" (_d2)
+#define LOAD_ARGS_3(a1, a2, a3) \
+ LOAD_ARGS_2 (a1, a2) \
+ int __arg3 = (int) (a3);
+#define LOAD_REGS_3 \
+ register int _d3 asm ("d3") = __arg3; \
+ LOAD_REGS_2
+#define ASM_ARGS_3 ASM_ARGS_2, "d" (_d3)
+#define LOAD_ARGS_4(a1, a2, a3, a4) \
+ LOAD_ARGS_3 (a1, a2, a3) \
+ int __arg4 = (int) (a4);
+#define LOAD_REGS_4 \
+ register int _d4 asm ("d4") = __arg4; \
+ LOAD_REGS_3
+#define ASM_ARGS_4 ASM_ARGS_3, "d" (_d4)
+#define LOAD_ARGS_5(a1, a2, a3, a4, a5) \
+ LOAD_ARGS_4 (a1, a2, a3, a4) \
+ int __arg5 = (int) (a5);
+#define LOAD_REGS_5 \
+ register int _d5 asm ("d5") = __arg5; \
+ LOAD_REGS_4
+#define ASM_ARGS_5 ASM_ARGS_4, "d" (_d5)
+#define LOAD_ARGS_6(a1, a2, a3, a4, a5, a6) \
+ LOAD_ARGS_5 (a1, a2, a3, a4, a5) \
+ int __arg6 = (int) (a6);
+#define LOAD_REGS_6 \
+ register int _a0 asm ("a0") = __arg6; \
+ LOAD_REGS_5
+#define ASM_ARGS_6 ASM_ARGS_5, "a" (_a0)
+
+#endif /* not __ASSEMBLER__ */
diff --git a/sysdeps/unix/sysv/linux/m68k/versionsort64.c b/sysdeps/unix/sysv/linux/m68k/versionsort64.c
new file mode 100644
index 0000000000..144b691e56
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/versionsort64.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/versionsort64.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/vfork.S b/sysdeps/unix/sysv/linux/m68k/vfork.S
new file mode 100644
index 0000000000..8027b2f801
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/vfork.S
@@ -0,0 +1,76 @@
+/* Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Andreas Schwab <schwab@gnu.org>.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+#define _ERRNO_H 1
+#include <bits/errno.h>
+#include <kernel-features.h>
+
+/* Clone the calling process, but without copying the whole address space.
+ The calling process is suspended until the new process exits or is
+ replaced by a call to `execve'. Return -1 for errors, 0 to the new process,
+ and the process ID of the new process to the old process. */
+
+ENTRY (__vfork)
+
+#ifdef __NR_vfork
+
+ /* Pop the return PC value into A0. */
+ movel %sp@+, %a0
+
+ /* Stuff the syscall number in D0 and trap into the kernel. */
+ movel #SYS_ify (vfork), %d0
+ trap #0
+ tstl %d0
+ jmi .Lerror /* Branch forward if it failed. */
+
+ /* Jump to the return PC. */
+ jmp %a0@
+
+.Lerror:
+ /* Push back the return PC. */
+ movel %a0,%sp@-
+
+# ifdef __ASSUME_VFORK_SYSCALL
+# ifndef PIC
+ jbra SYSCALL_ERROR_LABEL
+# endif
+# else
+ /* Check if vfork syscall is known at all. */
+ movel #-ENOSYS,%d1
+ cmpl %d0,%d1
+ jne SYSCALL_ERROR_LABEL
+
+# endif
+#endif
+
+#ifndef __ASSUME_VFORK_SYSCALL
+ /* If we don't have vfork, fork is close enough. */
+
+ movel #SYS_ify (fork), %d0
+ trap #0
+ tstl %d0
+ jmi SYSCALL_ERROR_LABEL
+ rts
+#endif
+
+PSEUDO_END (__vfork)
+libc_hidden_def (__vfork)
+
+weak_alias (__vfork, vfork)
diff --git a/sysdeps/unix/sysv/linux/m68k/xstat.c b/sysdeps/unix/sysv/linux/m68k/xstat.c
new file mode 100644
index 0000000000..e9869f5508
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/xstat.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/xstat.c>