about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1995-12-09 10:00:22 +0000
committerRoland McGrath <roland@gnu.org>1995-12-09 10:00:22 +0000
commit787e4db95ce0de5195bc066b4682f840bec7baaf (patch)
tree07076e97588c63a8d94b74c83603e5ddc071592e /sysdeps
parentc994299d50b9fae6fdd735a9c7bd183f89981d78 (diff)
downloadglibc-787e4db95ce0de5195bc066b4682f840bec7baaf.tar.gz
glibc-787e4db95ce0de5195bc066b4682f840bec7baaf.tar.xz
glibc-787e4db95ce0de5195bc066b4682f840bec7baaf.zip
Fri Dec 8 13:04:51 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu> cvs/libc-951210 cvs/libc-951209
	* locale/error.c, locale/error.h: Files removed.
	* locale/Makefile (distribute): Remove error.h.
	(lib-modules): Remove error.

	* hurd/hurdlookup.c (__hurd_file_name_lookup_retry): For "tty"
	magic, return ENXIO if no ctty.

	* sysdeps/mach/hurd/mmap.c: For MAP_FIXED, deallocate a previous
	mapping if vm_map fails for that reason.

	* posix/glob.c: Implement new options GLOB_ALTDIRFUNC, GLOB_BRACE,
	GLOB_TILDE, GLOB_NOMAGIC.
	(glob): Use stat instead of lstat to determine directoriness.
	* posix/glob.h (GLOB_ALTDIRFUNC, GLOB_BRACE, GLOB_NOMAGIC, GLOB_TILDE):
	New flag bits.
	(__GLOB_FLAGS): Include them.
	(glob_t): New members gl_closedir, gl_readdir, gl_opendir, gl_lstat,
	gl_stat.

	* elf/elf.h (ET_NUM, SHT_NUM, STB_NUM, STT_NUM, PT_NUM): New macros.

	* sysdeps/unix/sysv/linux/sys/mman.h: Include <linux/mman.h> to
	define all the bit values.
	(MAP_*, MCL_*): Macros removed.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/mach/hurd/mmap.c15
-rw-r--r--sysdeps/unix/sysv/linux/sys/mman.h47
2 files changed, 18 insertions, 44 deletions
diff --git a/sysdeps/mach/hurd/mmap.c b/sysdeps/mach/hurd/mmap.c
index 4f9304f4f5..0ef847f7c2 100644
--- a/sysdeps/mach/hurd/mmap.c
+++ b/sysdeps/mach/hurd/mmap.c
@@ -110,6 +110,21 @@ __mmap (caddr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
 		  (flags & MAP_INHERIT) == 0 ? VM_INHERIT_NONE :
 		  (flags & (MAP_COPY|MAP_PRIVATE)) ? VM_INHERIT_COPY :
 		  VM_INHERIT_SHARE);
+  if (err == KERN_NO_SPACE && (flags & MAP_FIXED))
+    {
+      /* XXX this is not atomic as it is in unix! */
+      /* The region is already allocated; deallocate it first.  */
+      err = __vm_deallocate (__mach_task_self (), mapaddr, len);
+      if (! err)
+	err = __vm_map (__mach_task_self (),
+			&mapaddr, (vm_size_t) len, (vm_address_t) 0,
+			0, memobj, (vm_offset_t) offset,
+			flags & (MAP_COPY|MAP_PRIVATE),
+			vmprot, VM_PROT_ALL,
+			(flags & MAP_INHERIT) == 0 ? VM_INHERIT_NONE :
+			(flags & (MAP_COPY|MAP_PRIVATE)) ? VM_INHERIT_COPY :
+			VM_INHERIT_SHARE);
+    }
 
   if (memobj != MACH_PORT_NULL)
     __mach_port_deallocate (__mach_task_self (), memobj);
diff --git a/sysdeps/unix/sysv/linux/sys/mman.h b/sysdeps/unix/sysv/linux/sys/mman.h
index 9f0ef72100..ac5940b663 100644
--- a/sysdeps/unix/sysv/linux/sys/mman.h
+++ b/sysdeps/unix/sysv/linux/sys/mman.h
@@ -26,52 +26,11 @@ Cambridge, MA 02139, USA.  */
 #define __need_size_t
 #include <stddef.h>
 
-
-/* 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_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	0x0000	/* Mapped from a file or device.  */
-#define	MAP_ANON	0x0020	/* Allocated from anonymous virtual memory.  */
-#define	MAP_TYPE	0x000f	/* Mask for type field.  */
-
-/* Sharing types (must choose one and only one of these).  */
-#define	MAP_COPY	MAP_PRIVATE	/* Virtual copy of region at mapping time.  */
-#define	MAP_SHARED	0x0001	/* Share changes.  */
-#define	MAP_PRIVATE	0x0002	/* Changes private; copy pages on write.  */
-
-/* Other flags.  */
-#define	MAP_FIXED	0x0010	/* Map address must be exactly as requested. */
-#define	MAP_NOEXTEND	0x0000	/* For MAP_FILE, don't change file size.
-				   Not available on Linux???  */
-#define	MAP_HASSEMPHORE	0x0000	/* Region may contain semaphores.
-				   Not available on Linux???  */
-#define	MAP_INHERIT	0x0000	/* Region is retained after exec.
-				   Not available on Linux???  */
-
-/* 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.  */
-
-/* Flags to `mlockall'.  */
-#define MCL_CURRENT     1	/* Lock all current mappings.  */
-#define MCL_FUTURE      2	/* Lock all future mappings.  */
-
 #include <sys/cdefs.h>
 
+/* Get the bit values from the kernel header file.  */
+#include <linux/mman.h>
+
 __BEGIN_DECLS
 /* Map addresses starting near ADDR and extending for LEN bytes.  from
    OFFSET into the file FD describes according to PROT and FLAGS.  If ADDR