diff options
author | Joseph Myers <joseph@codesourcery.com> | 2017-08-08 17:14:49 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2017-08-08 17:14:49 +0000 |
commit | f17a42333f2eb0bd7ef5194167dd52f9770a6680 (patch) | |
tree | 412b74849f8d26ddf201a572a4d1f7f644fe2198 /sysdeps/mach/hurd/mmap.c | |
parent | 0df595b23a829c9169ec418a19eef9006b4ae801 (diff) | |
download | glibc-f17a42333f2eb0bd7ef5194167dd52f9770a6680.tar.gz |
Do not use __ptr_t.
sys/cdefs.h has a macro __ptr_t, which a few places in glibc use
instead of void *. void * is a well-understood standard type for that
purpose and in a post-C89 context there is no need for a macro for it;
this patch changes those places to use void * directly instead.
Unlike __long_double_t, __ptr_t is widely used outside glibc (or at
least has many hits on codesearch.debian.net). I don't know how many
of those uses would break if sys/cdefs.h ceased to define the macro,
but there's enough risk that this patch leaves the definition and just
removes the uses within glibc; removal of the definition can be
considered separately if desired.
Tested for x86_64, and with build-many-glibcs.py.
* malloc/mcheck.c (old_free_hook): Use void * instead of __ptr_t.
(old_malloc_hook): Likewise.
(old_memalign_hook): Likewise.
(old_realloc_hook): Likewise.
(struct hdr): Likewise.
(flood): Likewise.
(freehook): Likewise.
(mallochook): Likewise.
(memalignhook): Likewise.
(reallochook): Likewise.
(mprobe): Likewise.
* malloc/mtrace.c (mallwatch): Likewise.
(tr_old_free_hook): Likewise.
(tr_old_malloc_hook): Likewise.
(tr_old_realloc_hook): Likewise.
(tr_old_memalign_hook): Likewise.
(tr_where): Likewise.
(lock_and_info): Likewise.
(tr_freehook): Likewise.
(tr_mallochook): Likewise.
(tr_reallochook): Likewise.
(tr_memalignhook): Likewise.
* misc/err.h [!__GNUC_VA_LIST] (__gnuc_va_list): Likewise.
* misc/mmap.c (__mmap): Likewise.
* misc/mmap64.c (__mmap64): Likewise.
* misc/mprotect.c (__mprotect): Likewise.
* misc/msync.c (msync): Likewise.
* misc/munmap.c (__munmap): Likewise.
* posix/posix_madvise.c (posix_madvise): Likewise.
* socket/send.c (__send): Likewise.
* socket/sendto.c (__sendto): Likewise.
* socket/setsockopt.c (__setsockopt): Likewise.
* string/memcmp.c (__ptr_t): Remove macro.
(MEMCMP): Use void * instead of ptr_t.
* string/memrchr.c (__ptr_t): Remove macro.
(__memrchr): Use void * instead of ptr_t.
* sysdeps/mach/hurd/dl-sysdep.c (__mmap): Likewise.
* sysdeps/mach/hurd/mmap.c (__mmap): Likewise.
* sysdeps/mach/hurd/mmap64.c (__mmap64): Likewise.
* sysdeps/mach/mprotect.c (__mprotect): Likewise.
* sysdeps/mach/msync.c (msync): Likewise.
* sysdeps/mach/munmap.c (__munmap): Likewise.
* sysdeps/mips/bits/setjmp.h (struct __jmp_buf_internal_tag):
Likewise.
* sysdeps/posix/getcwd.c (__getcwd): Likewise.
* sysdeps/powerpc/powerpc32/memset.S (memset): Likewise.
* sysdeps/powerpc/powerpc32/power4/memcpy.S (memcpy): Likewise.
* sysdeps/powerpc/powerpc32/power4/memset.S (memset): Likewise.
* sysdeps/powerpc/powerpc32/power6/memcpy.S (memcpy): Likewise.
* sysdeps/powerpc/powerpc32/power6/memset.S (memset): Likewise.
* sysdeps/powerpc/powerpc32/power7/memcpy.S (memcpy): Likewise.
* sysdeps/powerpc/powerpc32/power7/mempcpy.S (__mempcpy):
Likewise.
* sysdeps/powerpc/powerpc32/power7/memset.S (memset): Likewise.
* sysdeps/powerpc/powerpc64/memcpy.S (memcpy): Likewise.
* sysdeps/powerpc/powerpc64/memset.S (memset): Likewise.
* sysdeps/powerpc/powerpc64/power4/memcpy.S (memcpy): Likewise.
* sysdeps/powerpc/powerpc64/power4/memset.S (memset): Likewise.
* sysdeps/powerpc/powerpc64/power6/memcpy.S (memcpy): Likewise.
* sysdeps/powerpc/powerpc64/power6/memset.S (memset): Likewise.
* sysdeps/powerpc/powerpc64/power7/memcpy.S (memcpy): Likewise.
* sysdeps/powerpc/powerpc64/power7/mempcpy.S (__mempcpy):
Likewise.
* sysdeps/powerpc/powerpc64/power7/memset.S (memset): Likewise.
* sysdeps/powerpc/powerpc64/power8/memset.S (memset): Likewise.
* sysdeps/tile/memcmp.c (__ptr_t): Remove macro.
(MEMCMP): Use void * instead of ptr_t.
* sysdeps/unix/sysv/linux/alpha/oldglob.c (old_glob_t): Likewise.
* sysdeps/unix/sysv/linux/mmap.c (__mmap): Likewise.
Diffstat (limited to 'sysdeps/mach/hurd/mmap.c')
-rw-r--r-- | sysdeps/mach/hurd/mmap.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/sysdeps/mach/hurd/mmap.c b/sysdeps/mach/hurd/mmap.c index dbd718a688..72706c3332 100644 --- a/sysdeps/mach/hurd/mmap.c +++ b/sysdeps/mach/hurd/mmap.c @@ -26,12 +26,12 @@ 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 (__ptr_t) -1 + The return value is the actual mapping address chosen or (void *) -1 for errors (in which case `errno' is set). A successful `mmap' call deallocates any previous mapping for the affected region. */ -__ptr_t -__mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset) +void * +__mmap (void *addr, size_t len, int prot, int flags, int fd, off_t offset) { error_t err; vm_prot_t vmprot; @@ -42,7 +42,7 @@ __mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset) /* ADDR and OFFSET must be page-aligned. */ if ((mapaddr & (__vm_page_size - 1)) || (offset & (__vm_page_size - 1))) - return (__ptr_t) (long int) __hurd_fail (EINVAL); + return (void *) (long int) __hurd_fail (EINVAL); if ((flags & (MAP_TYPE|MAP_INHERIT)) == MAP_ANON && prot == (PROT_READ|PROT_WRITE)) /* cf VM_PROT_DEFAULT */ @@ -64,7 +64,7 @@ __mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset) err = __vm_allocate (__mach_task_self (), &mapaddr, len, 1); } - return err ? (__ptr_t) (long int) __hurd_fail (err) : (__ptr_t) mapaddr; + return err ? (void *) (long int) __hurd_fail (err) : (void *) mapaddr; } vmprot = VM_PROT_NONE; @@ -78,7 +78,7 @@ __mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset) switch (flags & MAP_TYPE) { default: - return (__ptr_t) (long int) __hurd_fail (EINVAL); + return (void *) (long int) __hurd_fail (EINVAL); case MAP_ANON: memobj = MACH_PORT_NULL; @@ -92,7 +92,7 @@ __mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset) { if (err == MIG_BAD_ID || err == EOPNOTSUPP || err == ENOSYS) err = ENODEV; /* File descriptor doesn't support mmap. */ - return (__ptr_t) (long int) __hurd_dfail (fd, err); + return (void *) (long int) __hurd_dfail (fd, err); } switch (prot & (PROT_READ|PROT_WRITE)) { @@ -129,7 +129,7 @@ __mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset) else { __mach_port_deallocate (__mach_task_self (), wobj); - return (__ptr_t) (long int) __hurd_fail (EACCES); + return (void *) (long int) __hurd_fail (EACCES); } break; default: @@ -180,9 +180,9 @@ __mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset) __mach_port_deallocate (__mach_task_self (), memobj); if (err) - return (__ptr_t) (long int) __hurd_fail (err); + return (void *) (long int) __hurd_fail (err); - return (__ptr_t) mapaddr; + return (void *) mapaddr; } weak_alias (__mmap, mmap) |