summaryrefslogtreecommitdiff
path: root/sysdeps/mach/hurd/mmap.c
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/mach/hurd/mmap.c
parentc994299d50b9fae6fdd735a9c7bd183f89981d78 (diff)
downloadglibc-787e4db95ce0de5195bc066b4682f840bec7baaf.tar.gz
Fri Dec 8 13:04:51 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>cvs/libc-951210cvs/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/mach/hurd/mmap.c')
-rw-r--r--sysdeps/mach/hurd/mmap.c15
1 files changed, 15 insertions, 0 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);