about summary refs log tree commit diff
path: root/sysdeps/unix
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/Subdirs1
-rw-r--r--sysdeps/unix/bsd/osf/sys/mman.h77
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/sys/mman.h53
-rw-r--r--sysdeps/unix/bsd/ultrix4/sys/mman.h45
-rw-r--r--sysdeps/unix/sysv/irix4/sys/mman.h77
-rw-r--r--sysdeps/unix/sysv/linux/alpha/Dist13
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/mman.h83
-rw-r--r--sysdeps/unix/sysv/linux/bits/socket.h2
-rw-r--r--sysdeps/unix/sysv/linux/i386/Dist4
-rw-r--r--sysdeps/unix/sysv/linux/i386/bits/mman.h75
-rw-r--r--sysdeps/unix/sysv/linux/if_index.c6
-rw-r--r--sysdeps/unix/sysv/linux/m68k/Dist1
-rw-r--r--sysdeps/unix/sysv/linux/mips/Dist12
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/mman.h75
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/Dist1
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/bits/mman.h84
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/kernel_termios.h5
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/profil-counter.h26
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/profil.c2
-rw-r--r--sysdeps/unix/sysv/linux/sparc/Dist3
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/mman.h77
-rw-r--r--sysdeps/unix/sysv/linux/sparc64/Dist7
-rw-r--r--sysdeps/unix/sysv/linux/sparc64/bits/mman.h77
-rw-r--r--sysdeps/unix/sysv/linux/sys/mman.h20
-rw-r--r--sysdeps/unix/sysv/linux/sys/sysmacros.h4
25 files changed, 690 insertions, 140 deletions
diff --git a/sysdeps/unix/Subdirs b/sysdeps/unix/Subdirs
new file mode 100644
index 0000000000..a46884d4f8
--- /dev/null
+++ b/sysdeps/unix/Subdirs
@@ -0,0 +1 @@
+login
diff --git a/sysdeps/unix/bsd/osf/sys/mman.h b/sysdeps/unix/bsd/osf/sys/mman.h
index 72846195d2..816f271e30 100644
--- a/sysdeps/unix/bsd/osf/sys/mman.h
+++ b/sysdeps/unix/bsd/osf/sys/mman.h
@@ -1,5 +1,5 @@
 /* Definitions for BSD-style memory management.  OSF/1 version.
-   Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1994, 1995, 1996, 1997 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
@@ -32,46 +32,53 @@
    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_NONE	0x00	/* No access.  */
-#define	PROT_READ	0x01	/* Pages can be read.  */
-#define	PROT_WRITE	0x02	/* Pages can be written.  */
-#define	PROT_EXEC	0x04	/* Pages can be executed.  */
+#define	PROT_NONE	 0x00	/* No access.  */
+#define	PROT_READ	 0x01	/* Pages can be read.  */
+#define	PROT_WRITE	 0x02	/* Pages can be written.  */
+#define	PROT_EXEC	 0x04	/* Pages can be executed.  */
 
 
 /* Flags contain mapping type, sharing type and options.  */
 
 /* Mapping type (must choose one and only one of these).  */
-#define	MAP_FILE	0x00	/* Mapped from a file or device.  */
-#define	MAP_ANON	0x10	/* Allocated from anonymous virtual memory.  */
-#define	MAP_ANONYMOUS	MAP_ANON
-#define	MAP_TYPE	0xf0	/* Mask for type field.  */
+#ifdef __USE_BSD
+# define MAP_FILE	 0x00	/* Mapped from a file or device.  */
+# define MAP_ANON	 0x10	/* Allocated from anonymous virtual memory.  */
+# define MAP_ANONYMOUS	 MAP_ANON
+# define MAP_TYPE	 0xf0	/* Mask for type field.  */
+#endif
 
 /* Sharing types (must choose one and only one of these).  */
-#define	MAP_SHARED	0x01	/* Share changes.  */
-#define	MAP_PRIVATE	0x02	/* Changes private; copy pages on write.  */
+#define	MAP_SHARED	 0x01	/* Share changes.  */
+#define	MAP_PRIVATE	 0x02	/* Changes private; copy pages on write.  */
 
 /* Other flags.  */
-#define	MAP_FIXED	0x0100	/* Map address must be exactly as requested. */
-#define	MAP_VARIABLE	0	/* Absence of MAP_FIXED.  */
-#define	MAP_HASSEMPHORE	0x0200	/* Region may contain semaphores.  */
-#define	MAP_INHERIT	0x0400	/* Region is retained after exec.  */
-#define	MAP_UNALIGNED	0x0800	/* File offset need not be page-aligned.  */
+#define	MAP_FIXED	 0x0100	/* Map address must be exactly as requested. */
+#ifdef __USE_BSD
+# define MAP_VARIABLE	 0	/* Absence of MAP_FIXED.  */
+# define MAP_HASSEMPHORE 0x0200	/* Region may contain semaphores.  */
+# define MAP_INHERIT	 0x0400	/* Region is retained after exec.  */
+# define MAP_UNALIGNED	 0x0800	/* File offset need not be page-aligned.  */
+#endif
 
 /* Advice to `madvise'.  */
-#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.  */
-#define	MADV_SPACEAVAIL	5	/* Ensure that resources are available.  */
+#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.  */
+# define MADV_SPACEAVAIL 5	/* Ensure that resources are available.  */
+#endif
 
 /* Flags to `msync'.  */
 #define MS_ASYNC	1		/* Asynchronous cache flush.  */
 #define MS_SYNC		3		/* Synchronous cache flush.  */
 #define MS_INVALIDATE	4		/* Invalidate cached pages.  */
 
+/* Return value of `mmap' in case of an error.  */
+#define MAP_FAILED	((__caddr_t) -1)
 
-#include <sys/cdefs.h>
 
 __BEGIN_DECLS
 /* Map addresses starting near ADDR and extending for LEN bytes.  from
@@ -79,34 +86,36 @@ __BEGIN_DECLS
    is nonzero, it is the desired mapping address.  If the MAP_FIXED bit is
    set in FLAGS, the mapping will be at ADDR exactly (which must be
    page-aligned); otherwise the system chooses a convenient nearby address.
-   The return value is the actual mapping address chosen or (caddr_t) -1
+   The return value is the actual mapping address chosen or MAP_FAILED
    for errors (in which case `errno' is set).  A successful `mmap' call
    deallocates any previous mapping for the affected region.  */
 
-__caddr_t __mmap __P ((__caddr_t __addr, size_t __len,
-		       int __prot, int __flags, int __fd, off_t __offset));
-__caddr_t mmap __P ((__caddr_t __addr, size_t __len,
-		     int __prot, int __flags, int __fd, off_t __offset));
+extern __caddr_t __mmap __P ((__caddr_t __addr, size_t __len, int __prot,
+			      int __flags, int __fd, off_t __offset));
+extern __caddr_t mmap __P ((__caddr_t __addr, size_t __len, int __prot,
+			    int __flags, int __fd, off_t __offset));
 
 /* Deallocate any mapping for the region starting at ADDR and extending LEN
    bytes.  Returns 0 if successful, -1 for errors (and sets errno).  */
-int __munmap __P ((__caddr_t __addr, size_t __len));
-int munmap __P ((__caddr_t __addr, size_t __len));
+extern int __munmap __P ((__caddr_t __addr, size_t __len));
+extern int munmap __P ((__caddr_t __addr, size_t __len));
 
 /* Change the memory protection of the region starting at ADDR and
    extending LEN bytes to PROT.  Returns 0 if successful, -1 for errors
    (and sets errno).  */
-int __mprotect __P ((__caddr_t __addr, size_t __len, int __prot));
-int mprotect __P ((__caddr_t __addr, size_t __len, int __prot));
+extern int __mprotect __P ((__caddr_t __addr, size_t __len, int __prot));
+extern int mprotect __P ((__caddr_t __addr, size_t __len, int __prot));
 
 /* Synchronize the region starting at ADDR and extending LEN bytes with the
    file it maps.  Filesystem operations on a file being mapped are
    unpredictable before this is done.  */
-int msync __P ((__caddr_t __addr, size_t __len, int __flags));
+extern int msync __P ((__caddr_t __addr, size_t __len, int __flags));
 
+#ifdef __USE_BSD
 /* Advise the system about particular usage patterns the program follows
    for the region starting at ADDR and extending LEN bytes.  */
-int madvise __P ((__caddr_t __addr, size_t __len, int __advice));
+extern int madvise __P ((__caddr_t __addr, size_t __len, int __advice));
+#endif
 
 __END_DECLS
 
diff --git a/sysdeps/unix/bsd/sun/sunos4/sys/mman.h b/sysdeps/unix/bsd/sun/sunos4/sys/mman.h
index 65771a2aac..d2a8998d9a 100644
--- a/sysdeps/unix/bsd/sun/sunos4/sys/mman.h
+++ b/sysdeps/unix/bsd/sun/sunos4/sys/mman.h
@@ -1,5 +1,5 @@
 /* Definitions for BSD-style memory management.  SunOS 4 version.
-   Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1994, 1995, 1996, 1997 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
@@ -41,14 +41,18 @@
 /* Sharing types (must choose one and only one of these).  */
 #define	MAP_SHARED	0x01	/* Share changes.  */
 #define	MAP_PRIVATE	0x02	/* Changes private; copy pages on write.  */
-#define	MAP_TYPE	0x0f	/* Mask for sharing type.  */
+#ifdef __USE_BSD
+# define MAP_TYPE	0x0f	/* Mask for sharing type.  */
+#endif
 
 /* Other flags.  */
 #define	MAP_FIXED	0x10	/* Map address must be exactly as requested. */
 /* The following three flags are not actually implemented in SunOS 4.1.  */
-#define	MAP_RENAME	0x20	/* Rename private pages to file.  */
-#define	MAP_NORESERVE	0x40	/* Don't reserve needed swap area.  */
-#define	MAP_INHERIT	0x80	/* Region is retained after exec.  */
+#ifdef __USE_BSD
+# define MAP_RENAME	0x20	/* Rename private pages to file.  */
+# define MAP_NORESERVE	0x40	/* Don't reserve needed swap area.  */
+# define MAP_INHERIT	0x80	/* Region is retained after exec.  */
+#endif
 
 /* This is an internal flag that is always set in `mmap' system calls.  In
    older versions of SunOS 4 `mmap' did not return the actual mapping
@@ -57,18 +61,21 @@
 #define	_MAP_NEW	0x80000000
 
 /* Advice to `madvise'.  */
-#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.  */
+#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
 
 /* Flags to `msync'.  */
 #define	MS_ASYNC	0x1		/* Return immediately, don't fsync.  */
 #define	MS_INVALIDATE	0x2		/* Invalidate caches.  */
 
+/* Return value of `mmap' in case of an error.  */
+#define MAP_FAILED	((__caddr_t) -1)
 
-#include <sys/cdefs.h>
 
 __BEGIN_DECLS
 /* Map addresses starting near ADDR and extending for LEN bytes.  from
@@ -76,34 +83,36 @@ __BEGIN_DECLS
    is nonzero, it is the desired mapping address.  If the MAP_FIXED bit is
    set in FLAGS, the mapping will be at ADDR exactly (which must be
    page-aligned); otherwise the system chooses a convenient nearby address.
-   The return value is the actual mapping address chosen or (caddr_t) -1
+   The return value is the actual mapping address chosen or MAP_FAILED
    for errors (in which case `errno' is set).  A successful `mmap' call
    deallocates any previous mapping for the affected region.  */
 
-__caddr_t __mmap __P ((__caddr_t __addr, size_t __len,
-		       int __prot, int __flags, int __fd, __off_t __offset));
-__caddr_t mmap __P ((__caddr_t __addr, size_t __len,
-		     int __prot, int __flags, int __fd, __off_t __offset));
+extern __caddr_t __mmap __P ((__caddr_t __addr, size_t __len, int __prot,
+			      int __flags, int __fd, __off_t __offset));
+extern __caddr_t mmap __P ((__caddr_t __addr, size_t __len, int __prot,
+			    int __flags, int __fd, __off_t __offset));
 
 /* Deallocate any mapping for the region starting at ADDR and extending LEN
    bytes.  Returns 0 if successful, -1 for errors (and sets errno).  */
-int __munmap __P ((__caddr_t __addr, size_t __len));
-int munmap __P ((__caddr_t __addr, size_t __len));
+extern int __munmap __P ((__caddr_t __addr, size_t __len));
+extern int munmap __P ((__caddr_t __addr, size_t __len));
 
 /* Change the memory protection of the region starting at ADDR and
    extending LEN bytes to PROT.  Returns 0 if successful, -1 for errors
    (and sets errno).  */
-int __mprotect __P ((__caddr_t __addr, size_t __len, int __prot));
-int mprotect __P ((__caddr_t __addr, size_t __len, int __prot));
+extern int __mprotect __P ((__caddr_t __addr, size_t __len, int __prot));
+extern int mprotect __P ((__caddr_t __addr, size_t __len, int __prot));
 
 /* Synchronize the region starting at ADDR and extending LEN bytes with the
    file it maps.  Filesystem operations on a file being mapped are
    unpredictable before this is done.  */
-int msync __P ((__caddr_t __addr, size_t __len, int __flags));
+extern int msync __P ((__caddr_t __addr, size_t __len, int __flags));
 
+#ifdef __USE_BSD
 /* Advise the system about particular usage patterns the program follows
    for the region starting at ADDR and extending LEN bytes.  */
-int madvise __P ((__caddr_t __addr, size_t __len, int __advice));
+extern int madvise __P ((__caddr_t __addr, size_t __len, int __advice));
+#endif
 
 __END_DECLS
 
diff --git a/sysdeps/unix/bsd/ultrix4/sys/mman.h b/sysdeps/unix/bsd/ultrix4/sys/mman.h
index 989bf21754..4262fce438 100644
--- a/sysdeps/unix/bsd/ultrix4/sys/mman.h
+++ b/sysdeps/unix/bsd/ultrix4/sys/mman.h
@@ -1,5 +1,5 @@
 /* Definitions for BSD-style memory management.  Ultrix 4 version.
-   Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1994, 1995, 1996, 1997 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
@@ -41,20 +41,25 @@
 /* Sharing types (must choose one and only one of these).  */
 #define	MAP_SHARED	0x01	/* Share changes.  */
 #define	MAP_PRIVATE	0x02	/* Changes private; copy pages on write.  */
-#define	MAP_TYPE	0x0f	/* Mask for sharing type.  */
+#ifdef __USE_BSD
+# define MAP_TYPE	0x0f	/* Mask for sharing type.  */
+#endif
 
 /* Other flags.  */
 #define	MAP_FIXED	0x10	/* Map address must be exactly as requested. */
 
 /* Advice to `madvise'.  */
-#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.  */
+#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
 
+/* Return value of `mmap' in case of an error.  */
+#define MAP_FAILED	((__caddr_t) -1)
 
-#include <sys/cdefs.h>
 
 __BEGIN_DECLS
 /* Map addresses starting near ADDR and extending for LEN bytes.  from
@@ -62,36 +67,38 @@ __BEGIN_DECLS
    is nonzero, it is the desired mapping address.  If the MAP_FIXED bit is
    set in FLAGS, the mapping will be at ADDR exactly (which must be
    page-aligned); otherwise the system chooses a convenient nearby address.
-   The return value is the actual mapping address chosen or (caddr_t) -1
+   The return value is the actual mapping address chosen or MAP_FAILED
    for errors (in which case `errno' is set).  A successful `mmap' call
    deallocates any previous mapping for the affected region.  */
 
-__caddr_t __mmap __P ((__caddr_t __addr, size_t __len,
-		       int __prot, int __flags, int __fd, off_t __offset));
-__caddr_t mmap __P ((__caddr_t __addr, size_t __len,
-		     int __prot, int __flags, int __fd, off_t __offset));
+extern __caddr_t __mmap __P ((__caddr_t __addr, size_t __len, int __prot,
+			      int __flags, int __fd, off_t __offset));
+extern __caddr_t mmap __P ((__caddr_t __addr, size_t __len, int __prot,
+			    int __flags, int __fd, off_t __offset));
 
 /* Deallocate any mapping for the region starting at ADDR and extending LEN
    bytes.  Returns 0 if successful, -1 for errors (and sets errno).  */
-int __munmap __P ((__caddr_t __addr, size_t __len));
-int munmap __P ((__caddr_t __addr, size_t __len));
+extern int __munmap __P ((__caddr_t __addr, size_t __len));
+extern int munmap __P ((__caddr_t __addr, size_t __len));
 
 /* Change the memory protection of the region starting at ADDR and
    extending LEN bytes to PROT.  Returns 0 if successful, -1 for errors
    (and sets errno).  */
-int __mprotect __P ((__caddr_t __addr, size_t __len, int __prot));
-int mprotect __P ((__caddr_t __addr, size_t __len, int __prot));
+extern int __mprotect __P ((__caddr_t __addr, size_t __len, int __prot));
+extern int mprotect __P ((__caddr_t __addr, size_t __len, int __prot));
 
 /* Ultrix 4 does not implement `msync' or `madvise'.  */
 
 /* Synchronize the region starting at ADDR and extending LEN bytes with the
    file it maps.  Filesystem operations on a file being mapped are
    unpredictable before this is done.  */
-int msync __P ((caddr_t __addr, size_t __len));
+extern int msync __P ((caddr_t __addr, size_t __len));
 
+#ifdef __USE_BSD
 /* Advise the system about particular usage patterns the program follows
    for the region starting at ADDR and extending LEN bytes.  */
-int madvise __P ((__caddr_t __addr, size_t __len, int __advice));
+extern int madvise __P ((__caddr_t __addr, size_t __len, int __advice));
+#endif
 
 __END_DECLS
 
diff --git a/sysdeps/unix/sysv/irix4/sys/mman.h b/sysdeps/unix/sysv/irix4/sys/mman.h
index f42a9f67aa..c3a923832a 100644
--- a/sysdeps/unix/sysv/irix4/sys/mman.h
+++ b/sysdeps/unix/sysv/irix4/sys/mman.h
@@ -1,5 +1,5 @@
 /* Definitions for BSD-style memory management.  Irix 4 version.
-   Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1994, 1995, 1996, 1997 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
@@ -23,8 +23,6 @@
 #include <features.h>
 
 #include <bits/types.h>
-#define __need_size_t
-#include <stddef.h>
 
 
 /* Protections are chosen from these bits, OR'd together.  The
@@ -32,37 +30,46 @@
    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_NONE	0x00	/* No access.  */
-#define	PROT_READ	0x04	/* Pages can be read.  */
-#define	PROT_WRITE	0x02	/* Pages can be written.  */
-#define	PROT_EXEC	0x01	/* Pages can be executed.  */
-#define	PROT_EXECUTE	PROT_EXEC
+#define	PROT_NONE	 0x00	/* No access.  */
+#define	PROT_READ	 0x04	/* Pages can be read.  */
+#define	PROT_WRITE	 0x02	/* Pages can be written.  */
+#define	PROT_EXEC	 0x01	/* Pages can be executed.  */
+#ifdef __USE_MISC
+# define PROT_EXECUTE	 PROT_EXEC
+#endif
 
 
 /* Sharing types (must choose one and only one of these).  */
-#define	MAP_SHARED	0x01	/* Share changes.  */
-#define	MAP_PRIVATE	0x02	/* Changes private; copy pages on write.  */
-#define	MAP_TYPE	0x0f	/* Mask for sharing type.  */
+#define	MAP_SHARED	 0x01	/* Share changes.  */
+#define	MAP_PRIVATE	 0x02	/* Changes private; copy pages on write.  */
+#ifdef __USE_BSD
+# define MAP_TYPE	 0x0f	/* Mask for sharing type.  */
+#endif
 
 /* Other flags.  */
-#define	MAP_FIXED	0x10	/* Map address must be exactly as requested. */
-#define	MAP_RENAME	0x20	/* Rename private pages to file.  */
-#define	MAP_AUTOGROW	0x40	/* Grow file as pages are written.  */
-#define	MAP_LOCAL	0x80	/* Copy the mapped region on fork.  */
+#define	MAP_FIXED	 0x10	/* Map address must be exactly as requested. */
+#ifdef __USE_MISC
+# define MAP_RENAME	 0x20	/* Rename private pages to file.  */
+# define MAP_AUTOGROW	 0x40	/* Grow file as pages are written.  */
+# define MAP_LOCAL	 0x80	/* Copy the mapped region on fork.  */
+#endif
 
 /* Advice to `madvise'.  */
-#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.  */
+#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
 
 /* Flags to `msync'.  */
-#define	MS_ASYNC	0x1		/* Return immediately, don't fsync.  */
-#define	MS_INVALIDATE	0x2		/* Invalidate caches.  */
+#define	MS_ASYNC	 0x1		/* Return immediately, don't fsync.  */
+#define	MS_INVALIDATE	 0x2		/* Invalidate caches.  */
 
+/* Return value of `mmap' in case of an error.  */
+#define MAP_FAILED	((__caddr_t) -1)
 
-#include <sys/cdefs.h>
 
 __BEGIN_DECLS
 /* Map addresses starting near ADDR and extending for LEN bytes.  from
@@ -70,34 +77,36 @@ __BEGIN_DECLS
    is nonzero, it is the desired mapping address.  If the MAP_FIXED bit is
    set in FLAGS, the mapping will be at ADDR exactly (which must be
    page-aligned); otherwise the system chooses a convenient nearby address.
-   The return value is the actual mapping address chosen or (caddr_t) -1
+   The return value is the actual mapping address chosen or MAP_FAILED
    for errors (in which case `errno' is set).  A successful `mmap' call
    deallocates any previous mapping for the affected region.  */
 
-__caddr_t __mmap __P ((__caddr_t __addr, size_t __len,
-		       int __prot, int __flags, int __fd, __off_t __offset));
-__caddr_t mmap __P ((__caddr_t __addr, size_t __len,
-		     int __prot, int __flags, int __fd, __off_t __offset));
+extern __caddr_t __mmap __P ((__caddr_t __addr, size_t __len, int __prot,
+			      int __flags, int __fd, __off_t __offset));
+extern __caddr_t mmap __P ((__caddr_t __addr, size_t __len, int __prot,
+			    int __flags, int __fd, __off_t __offset));
 
 /* Deallocate any mapping for the region starting at ADDR and extending LEN
    bytes.  Returns 0 if successful, -1 for errors (and sets errno).  */
-int __munmap __P ((__caddr_t __addr, size_t __len));
-int munmap __P ((__caddr_t __addr, size_t __len));
+extern int __munmap __P ((__caddr_t __addr, size_t __len));
+extern int munmap __P ((__caddr_t __addr, size_t __len));
 
 /* Change the memory protection of the region starting at ADDR and
    extending LEN bytes to PROT.  Returns 0 if successful, -1 for errors
    (and sets errno).  */
-int __mprotect __P ((__caddr_t __addr, size_t __len, int __prot));
-int mprotect __P ((__caddr_t __addr, size_t __len, int __prot));
+extern int __mprotect __P ((__caddr_t __addr, size_t __len, int __prot));
+extern int mprotect __P ((__caddr_t __addr, size_t __len, int __prot));
 
 /* Synchronize the region starting at ADDR and extending LEN bytes with the
    file it maps.  Filesystem operations on a file being mapped are
    unpredictable before this is done.  */
-int msync __P ((caddr_t __addr, size_t __len, int __flags));
+extern int msync __P ((caddr_t __addr, size_t __len, int __flags));
 
+#ifdef __USE_BSD
 /* Advise the system about particular usage patterns the program follows
    for the region starting at ADDR and extending LEN bytes.  */
-int madvise __P ((__caddr_t __addr, size_t __len, int __advice));
+extern int madvise __P ((__caddr_t __addr, size_t __len, int __advice));
+#endif
 
 __END_DECLS
 
diff --git a/sysdeps/unix/sysv/linux/alpha/Dist b/sysdeps/unix/sysv/linux/alpha/Dist
index 1b1f771853..ae71c2feb3 100644
--- a/sysdeps/unix/sysv/linux/alpha/Dist
+++ b/sysdeps/unix/sysv/linux/alpha/Dist
@@ -1,11 +1,14 @@
-alpha/ptrace.h alpha/regdef.h
-ieee_get_fp_control.S ieee_set_fp_control.S
-ioperm.c
-init-first.h
+alpha/ptrace.h
+alpha/regdef.h
+bits/mman.h
 clone.S
+ieee_get_fp_control.S
+ieee_set_fp_control.S
+init-first.h
+ioperm.c
 kernel_sigaction.h
 kernel_stat.h
 kernel_termios.h
-sys/io.h
 sys/acct.h
+sys/io.h
 sys/procfs.h
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/mman.h b/sysdeps/unix/sysv/linux/alpha/bits/mman.h
new file mode 100644
index 0000000000..1bef0cb525
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/bits/mman.h
@@ -0,0 +1,83 @@
+/* Definitions for POSIX memory map inerface.  Linux/Alpha version.
+   Copyright (C) 1997 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_MMAN_H
+# error "Never include this file directly.  Use <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.  */
+
+/* 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	  0x100		/* Interpret addr exactly.  */
+#ifdef __USE_MISC
+# define MAP_FILE	  0
+# define MAP_ANONYMOUS	  0x10		/* Don't use a file.  */
+# define MAP_ANON	  MAP_ANONYMOUS
+#endif
+
+/* Not used by Linux, but here to make sure we don't clash with OSF/1
+   defines.  */
+#ifdef __USE_BSD
+# define MAP_HASSEMAPHORE 0x0200
+# define MAP_INHERIT	  0x0400
+# define MAP_UNALIGNED	  0x0800
+#endif
+
+/* These are Linux-specific.  */
+#ifdef __USE_MISC
+# define MAP_GROWSDOWN	  0x1000	/* Stack-like segment.  */
+# define MAP_DENYWRITE	  0x2000	/* ETXTBSY */
+# define MAP_EXECUTABLE	  0x4000	/* Mark it as an executable.  */
+# define MAP_LOCKED	  0x8000	/* Lock the mapping.  */
+# define MAP_NORESERVE	  0x10000	/* Don't check for reservations.  */
+#endif
+
+/* Flags to `msync'.  */
+#define MS_ASYNC	  1		/* Sync memory asynchronously.  */
+#define MS_SYNC		  2		/* Synchronous memory sync.  */
+#define MS_INVALIDATE	  4		/* Invalidate the caches.  */
+
+/* Flags for `mlockall'.  */
+#define MCL_CURRENT	  8192		/* Lock all currently mapped pages.  */
+#define MCL_FUTURE	  16384		/* Lock all additions to address
+					   space.  */
+
+/* Flags for `mremap'.  */
+#ifdef __USE_GNU
+# define MREMAP_MAYMOVE	1
+#endif
diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h
index fd13e124a8..2a8d6ed004 100644
--- a/sysdeps/unix/sysv/linux/bits/socket.h
+++ b/sysdeps/unix/sysv/linux/bits/socket.h
@@ -136,7 +136,7 @@ struct msghdr
     socklen_t msg_namelen;	/* Length of address data.  */
 
     struct iovec *msg_iov;	/* Vector of data to send/receive into.  */
-    size_t msg_iovlen;		/* Number of elements in the vector.  */
+    int msg_iovlen;		/* Number of elements in the vector.  */
 
     __ptr_t msg_control;	/* Ancillary data (eg BSD filedesc passing). */
     socklen_t msg_controllen;	/* Ancillary data buffer length.  */
diff --git a/sysdeps/unix/sysv/linux/i386/Dist b/sysdeps/unix/sysv/linux/i386/Dist
index d5cc620549..d762dc9416 100644
--- a/sysdeps/unix/sysv/linux/i386/Dist
+++ b/sysdeps/unix/sysv/linux/i386/Dist
@@ -1,2 +1,4 @@
-sys/perm.h sys/vm86.h
+bits/mman.h
 clone.S
+sys/perm.h
+sys/vm86.h
diff --git a/sysdeps/unix/sysv/linux/i386/bits/mman.h b/sysdeps/unix/sysv/linux/i386/bits/mman.h
new file mode 100644
index 0000000000..e70b220f9f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/bits/mman.h
@@ -0,0 +1,75 @@
+/* Definitions for POSIX memory map inerface.  Linux/i386 version.
+   Copyright (C) 1997 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_MMAN_H
+# error "Never include this file directly.  Use <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.  */
+
+/* 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	0x0100		/* Stack-like segment.  */
+# define MAP_DENYWRITE	0x0800		/* ETXTBSY */
+# define MAP_EXECUTABLE	0x1000		/* Mark it as an executable.  */
+# define MAP_LOCKED	0x2000		/* Lock the mapping.  */
+# define MAP_NORESERVE	0x4000		/* Don't check for reservations.  */
+#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
diff --git a/sysdeps/unix/sysv/linux/if_index.c b/sysdeps/unix/sysv/linux/if_index.c
index c8eefa9b98..f64fe1e1ca 100644
--- a/sysdeps/unix/sysv/linux/if_index.c
+++ b/sysdeps/unix/sysv/linux/if_index.c
@@ -182,11 +182,9 @@ if_indextoname (unsigned int ifindex, char *ifname)
 #else
   struct if_nameindex *idx = if_nameindex ();
   struct if_nameindex *p;
-  char *result;
+  char *result = NULL;
 
-  if (idx == NULL)
-    result = NULL;
-  else
+  if (idx != NULL)
     {
       for (p = idx; p->if_index || p->if_name; ++p)
 	if (p->if_index == ifindex)
diff --git a/sysdeps/unix/sysv/linux/m68k/Dist b/sysdeps/unix/sysv/linux/m68k/Dist
index e7d5949d51..25aa20bcfa 100644
--- a/sysdeps/unix/sysv/linux/m68k/Dist
+++ b/sysdeps/unix/sysv/linux/m68k/Dist
@@ -1,2 +1,3 @@
+bits/mman.h
 clone.S
 mremap.S
diff --git a/sysdeps/unix/sysv/linux/mips/Dist b/sysdeps/unix/sysv/linux/mips/Dist
index a205c94f95..6be6876fe7 100644
--- a/sysdeps/unix/sysv/linux/mips/Dist
+++ b/sysdeps/unix/sysv/linux/mips/Dist
@@ -1,3 +1,15 @@
+bits/mman.h
 clone.S
 kernel_sigaction.h
 kernel_stat.h
+kernel_termios.h
+entry.h
+regdef.h
+fpregdef.h
+sys/acct.h
+sys/asm.h
+sys/cachectl.h
+sys/fpregdef.h
+sys/procfs.h
+sys/regdef.h
+sys/sysmips.h
diff --git a/sysdeps/unix/sysv/linux/mips/bits/mman.h b/sysdeps/unix/sysv/linux/mips/bits/mman.h
new file mode 100644
index 0000000000..15a343ff76
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/bits/mman.h
@@ -0,0 +1,75 @@
+/* Definitions for POSIX memory map inerface.  Linux/PowerPC version.
+   Copyright (C) 1997 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_MMAN_H
+# error "Never include this file directly.  Use <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.  */
+
+/* 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	0x00
+# define MAP_ANONYMOUS	0x20		/* Don't use a file.  */
+# define MAP_ANON	MAP_ANONYMOUS
+# define MAP_RENAME	MAP_ANONYMOUS
+#endif
+
+/* These are Linux-specific.  */
+#ifdef __USE_MISC
+# define MAP_GROWSDOWN	0x0100		/* Stack-like segment.  */
+# define MAP_DENYWRITE	0x0800		/* ETXTBSY */
+# define MAP_EXECUTABLE	0x1000		/* Mark it as an executable.  */
+# define MAP_NORESERVE	0x0040		/* Don't check for reservations.  */
+#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	0x2000		/* Lock all currently mapped pages.  */
+#define MCL_FUTURE	0x4000		/* Lock all additions to address
+					   space.  */
+
+/* Flags for `mremap'.  */
+#ifdef __USE_GNU
+# define MREMAP_MAYMOVE	1
+#endif
diff --git a/sysdeps/unix/sysv/linux/powerpc/Dist b/sysdeps/unix/sysv/linux/powerpc/Dist
index cd6d6d12e5..0213c45f51 100644
--- a/sysdeps/unix/sysv/linux/powerpc/Dist
+++ b/sysdeps/unix/sysv/linux/powerpc/Dist
@@ -1,3 +1,4 @@
+bits/mman.h
 clone.S
 kernel_stat.h
 kernel_termios.h
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/mman.h b/sysdeps/unix/sysv/linux/powerpc/bits/mman.h
new file mode 100644
index 0000000000..da5ad0eb45
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/mman.h
@@ -0,0 +1,84 @@
+/* Definitions for POSIX memory map inerface.  Linux/MIPS version.
+   Copyright (C) 1997 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_MMAN_H
+# error "Never include this file directly.  Use <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.  */
+
+/* Sharing types (must choose one and only one of these).  */
+#define MAP_SHARED	0x001		/* Share changes.  */
+#define MAP_PRIVATE	0x002		/* Changes are private.  */
+#ifdef __USE_MISC
+# define MAP_TYPE	0x00f		/* Mask for type of mapping.  */
+#endif
+
+/* Other flags.  */
+#define MAP_FIXED	0x010		/* Interpret addr exactly.  */
+#ifdef __USE_MISC
+# define MAP_FILE	0x000
+# define MAP_ANONYMOUS	0x800		/* Don't use a file.  */
+# define MAP_ANON	MAP_ANONYMOUS
+#endif
+
+/* Not used by Linux, but here to make sure we don't clash with ABI
+   defines.  */
+#ifdef __USE_MISC
+# define MAP_RENAME	0x020		/* Assign page to file.  */
+# define MAP_AUTOGROW	0x040		/* File may grow by writing.  */
+# define MAP_LOCAL	0x080		/* Copy on fork/sproc.  */
+# define MAP_AUTORSRV	0x100		/* Logical swap reserved on demand.  */
+#endif
+
+/* These are Linux-specific.  */
+#ifdef __USE_MISC
+# define MAP_GROWSDOWN	0x1000		/* Stack-like segment.  */
+# define MAP_DENYWRITE	0x2000		/* ETXTBSY */
+# define MAP_EXECUTABLE	0x4000		/* Mark it as an executable.  */
+# define MAP_LOCKED	0x8000		/* Lock the mapping.  */
+# define MAP_NORESERVE	0x0400		/* Don't check for reservations.  */
+#endif
+
+/* Flags to `msync'.  */
+#define MS_ASYNC	1		/* Sync memory asynchronously.  */
+#define MS_SYNC		0		/* 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
diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel_termios.h b/sysdeps/unix/sysv/linux/powerpc/kernel_termios.h
index 9a5e830c31..49460661e2 100644
--- a/sysdeps/unix/sysv/linux/powerpc/kernel_termios.h
+++ b/sysdeps/unix/sysv/linux/powerpc/kernel_termios.h
@@ -18,7 +18,6 @@
 
 #ifndef _KERNEL_TERMIOS_H
 #define _KERNEL_TERMIOS_H 1
-/* The following corresponds to the values from the Linux 2.0.28 kernel.  */
 
 /* We need the definition of tcflag_t, cc_t, and speed_t.  */
 #include <bits/termios.h>
@@ -33,8 +32,8 @@ struct __kernel_termios
     tcflag_t c_lflag;		/* local mode flags */
     cc_t c_cc[__KERNEL_NCCS];	/* control characters */
     cc_t c_line;		/* line discipline */
-    int c_ispeed;               /* input speed */
-    int c_ospeed;               /* output speed */
+    speed_t c_ispeed;           /* input speed */
+    speed_t c_ospeed;           /* output speed */
   };
 
 #define _HAVE_C_ISPEED 1
diff --git a/sysdeps/unix/sysv/linux/powerpc/profil-counter.h b/sysdeps/unix/sysv/linux/powerpc/profil-counter.h
new file mode 100644
index 0000000000..fed0913574
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/profil-counter.h
@@ -0,0 +1,26 @@
+/* Low-level statistical profiling support function.  Linux/PowerPC version.
+   Copyright (C) 1996, 1997 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>
+
+void
+profil_counter (int signo, struct sigcontext sc)
+{
+  profil_count ((void *) sc.regs->nip);
+}
diff --git a/sysdeps/unix/sysv/linux/powerpc/profil.c b/sysdeps/unix/sysv/linux/powerpc/profil.c
deleted file mode 100644
index 6ab8065da3..0000000000
--- a/sysdeps/unix/sysv/linux/powerpc/profil.c
+++ /dev/null
@@ -1,2 +0,0 @@
-/* For now.  */
-#include <sysdeps/stub/profil.c>
diff --git a/sysdeps/unix/sysv/linux/sparc/Dist b/sysdeps/unix/sysv/linux/sparc/Dist
index d93c648651..9729f0709b 100644
--- a/sysdeps/unix/sysv/linux/sparc/Dist
+++ b/sysdeps/unix/sysv/linux/sparc/Dist
@@ -1,7 +1,8 @@
 __sigtrampoline.S
+bits/mman.h
 clone.S
 pipe.S
 fork.S
 kernel_stat.h
-kernel_sigaction.h
 init-first.h
+sys/trap.h
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/mman.h b/sysdeps/unix/sysv/linux/sparc/bits/mman.h
new file mode 100644
index 0000000000..3e7f2900fa
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/bits/mman.h
@@ -0,0 +1,77 @@
+/* Definitions for POSIX memory map inerface.  Linux/SPARC version.
+   Copyright (C) 1997 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_MMAN_H
+# error "Never include this file directly.  Use <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.  */
+
+/* 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	0x00
+# define MAP_ANONYMOUS	0x20		/* Don't use a file.  */
+# define MAP_ANON	MAP_ANONYMOUS
+# define MAP_RENAME	MAP_ANONYMOUS
+#endif
+
+/* These are Linux-specific.  */
+#ifdef __USE_MISC
+# define MAP_GROWSDOWN	0x0100		/* Stack-like segment.  */
+# define MAP_DENYWRITE	0x0800		/* ETXTBSY */
+# define MAP_EXECUTABLE	0x1000		/* Mark it as an executable.  */
+# define MAP_LOCKED	0x0100		/* Lock the mapping.  */
+# define MAP_NORESERVE	0x0040		/* Don't check for reservations.  */
+# define _MAP_NEW	0x80000000	/* Binary compatibility with SunOS.  */
+#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	0x2000		/* Lock all currently mapped pages.  */
+#define MCL_FUTURE	0x4000		/* Lock all additions to address
+					   space.  */
+
+/* Flags for `mremap'.  */
+#ifdef __USE_GNU
+# define MREMAP_MAYMOVE	1
+#endif
diff --git a/sysdeps/unix/sysv/linux/sparc64/Dist b/sysdeps/unix/sysv/linux/sparc64/Dist
new file mode 100644
index 0000000000..e770e20eb9
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc64/Dist
@@ -0,0 +1,7 @@
+bits/mman.h
+clone.S
+kernel_stat.h
+getcontext.S
+setcontext.S
+ucontext.h
+init-first.h
diff --git a/sysdeps/unix/sysv/linux/sparc64/bits/mman.h b/sysdeps/unix/sysv/linux/sparc64/bits/mman.h
new file mode 100644
index 0000000000..3e7f2900fa
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc64/bits/mman.h
@@ -0,0 +1,77 @@
+/* Definitions for POSIX memory map inerface.  Linux/SPARC version.
+   Copyright (C) 1997 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_MMAN_H
+# error "Never include this file directly.  Use <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.  */
+
+/* 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	0x00
+# define MAP_ANONYMOUS	0x20		/* Don't use a file.  */
+# define MAP_ANON	MAP_ANONYMOUS
+# define MAP_RENAME	MAP_ANONYMOUS
+#endif
+
+/* These are Linux-specific.  */
+#ifdef __USE_MISC
+# define MAP_GROWSDOWN	0x0100		/* Stack-like segment.  */
+# define MAP_DENYWRITE	0x0800		/* ETXTBSY */
+# define MAP_EXECUTABLE	0x1000		/* Mark it as an executable.  */
+# define MAP_LOCKED	0x0100		/* Lock the mapping.  */
+# define MAP_NORESERVE	0x0040		/* Don't check for reservations.  */
+# define _MAP_NEW	0x80000000	/* Binary compatibility with SunOS.  */
+#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	0x2000		/* Lock all currently mapped pages.  */
+#define MCL_FUTURE	0x4000		/* Lock all additions to address
+					   space.  */
+
+/* Flags for `mremap'.  */
+#ifdef __USE_GNU
+# define MREMAP_MAYMOVE	1
+#endif
diff --git a/sysdeps/unix/sysv/linux/sys/mman.h b/sysdeps/unix/sysv/linux/sys/mman.h
index dc9f8f7e48..0f56a70c32 100644
--- a/sysdeps/unix/sysv/linux/sys/mman.h
+++ b/sysdeps/unix/sysv/linux/sys/mman.h
@@ -23,20 +23,12 @@
 #include <features.h>
 
 #include <bits/types.h>
-#define __need_size_t
-#include <stddef.h>
-
-#include <sys/cdefs.h>
 
 /* Get the bit values from the kernel header file.  */
-#include <linux/mman.h>
+#include <bits/mman.h>
 
-#ifndef MAP_ANON
-#define MAP_ANON	MAP_ANONYMOUS
-#endif
-#ifndef MAP_FILE
-#define MAP_FILE	0
-#endif
+/* Return value of `mmap' in case of an error.  */
+#define MAP_FAILED	((__caddr_t) -1)
 
 __BEGIN_DECLS
 /* Map addresses starting near ADDR and extending for LEN bytes.  from
@@ -44,7 +36,7 @@ __BEGIN_DECLS
    is nonzero, it is the desired mapping address.  If the MAP_FIXED bit is
    set in FLAGS, the mapping will be at ADDR exactly (which must be
    page-aligned); otherwise the system chooses a convenient nearby address.
-   The return value is the actual mapping address chosen or (caddr_t) -1
+   The return value is the actual mapping address chosen or MAP_FAILED
    for errors (in which case `errno' is set).  A successful `mmap' call
    deallocates any previous mapping for the affected region.  */
 
@@ -69,9 +61,11 @@ extern int mprotect __P ((__caddr_t __addr, size_t __len, int __prot));
    unpredictable before this is done.  Flags are from the MS_* set.  */
 extern int msync __P ((__caddr_t __addr, size_t __len, int __flags));
 
+#ifdef __USE_BSD
 /* Advise the system about particular usage patterns the program follows
    for the region starting at ADDR and extending LEN bytes.  */
 extern int madvise __P ((__caddr_t __addr, size_t __len, int __advice));
+#endif
 
 /* Cause all currently mapped pages of the process to be memory resident
    until unlocked by a call to the `munlockall', until the process exits,
@@ -89,6 +83,7 @@ extern int mlock __P ((__caddr_t __addr, size_t __len));
 /* Unlock whole pages previously mapped by the range [ADDR,ADDR+LEN).  */
 extern int munlock __P ((__caddr_t __addr, size_t __len));
 
+#ifdef __USE_MISC
 /* Remap pages mapped by the range [ADDR,ADDR+OLD_LEN) to new length
    NEW_LEN.  If MAY_MOVE is MREMAP_MAYMOVE the returned address may
    differ from ADDR.  */
@@ -96,6 +91,7 @@ extern __caddr_t __mremap __P ((__caddr_t __addr, size_t __old_len,
 				size_t __new_len, int __may_move));
 extern __caddr_t mremap __P ((__caddr_t __addr, size_t __old_len,
 			      size_t __new_len, int __may_move));
+#endif
 
 __END_DECLS
 
diff --git a/sysdeps/unix/sysv/linux/sys/sysmacros.h b/sysdeps/unix/sysv/linux/sys/sysmacros.h
index 85b1b85d2e..5c1e1f7441 100644
--- a/sysdeps/unix/sysv/linux/sys/sysmacros.h
+++ b/sysdeps/unix/sysv/linux/sys/sysmacros.h
@@ -22,8 +22,8 @@
 #define _SYS_SYSMACROS_H	1
 
 /* For compatibility we provide alternative names.  */
-#define major(dev) (((dev) >> 8) & 0xff)
-#define minor(dev) ((dev) & 0xff)
+#define major(dev) ((int)(((dev) >> 8) & 0xff))
+#define minor(dev) ((int)((dev) & 0xff))
 #define makedev(major, minor) (((major) << 8) | (minor))
 
 #endif /* _SYS_SYSMACROS_H */