mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-12-23 18:14:56 +01:00
Convert caddr_t --> void * for sys/mman.h functions.
mlock, mmap, mprotect, msync, munlock, and munmap are defined by POSIX as taking void *. The const modifier has been added to mlock, munlock, and mprotect as the standard dictates. minherit comes from OpenBSD and has been updated to conform with their recent change to void *. madvise and mincore are not defined by POSIX, but their arguments have been modified to be consistent with the POSIX-defined functions. mincore takes a const pointer, but madvise does not due to the MADV_FREE case. Discussed with: bde
This commit is contained in:
parent
00c5ae6b03
commit
7167d5b04c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=32131
@ -30,7 +30,7 @@
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)madvise.2 8.1 (Berkeley) 6/9/93
|
||||
.\" $Id: madvise.2,v 1.10 1997/02/22 15:04:03 peter Exp $
|
||||
.\" $Id: madvise.2,v 1.11 1997/12/30 05:17:33 alex Exp $
|
||||
.\"
|
||||
.Dd Jul 19, 1996
|
||||
.Dt MADVISE 2
|
||||
@ -42,7 +42,7 @@
|
||||
.Fd #include <sys/types.h>
|
||||
.Fd #include <sys/mman.h>
|
||||
.Ft int
|
||||
.Fn madvise "caddr_t addr" "size_t len" "int behav"
|
||||
.Fn madvise "void *addr" "size_t len" "int behav"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn madvise
|
||||
|
@ -30,7 +30,7 @@
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)mincore.2 8.1 (Berkeley) 6/9/93
|
||||
.\" $Id: mincore.2,v 1.8 1997/02/22 15:04:05 peter Exp $
|
||||
.\" $Id: mincore.2,v 1.9 1997/12/30 04:05:47 alex Exp $
|
||||
.\"
|
||||
.Dd June 9, 1993
|
||||
.Dt MINCORE 2
|
||||
@ -42,7 +42,7 @@
|
||||
.Fd #include <sys/types.h>
|
||||
.Fd #include <sys/mman.h>
|
||||
.Ft int
|
||||
.Fn mincore "caddr_t addr" "size_t len" "char *vec"
|
||||
.Fn mincore "const void *addr" "size_t len" "char *vec"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn mincore
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $Id$
|
||||
.\" $Id: minherit.2,v 1.4 1997/02/22 15:04:06 peter Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1991, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
@ -43,7 +43,7 @@
|
||||
.Fd #include <sys/types.h>
|
||||
.Fd #include <sys/mman.h>
|
||||
.Ft int
|
||||
.Fn minherit "caddr_t addr" "size_t len" "int inherit"
|
||||
.Fn minherit "void *addr" "size_t len" "int inherit"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn minherit
|
||||
|
@ -42,9 +42,9 @@
|
||||
.Fd #include <sys/types.h>
|
||||
.Fd #include <sys/mman.h>
|
||||
.Ft int
|
||||
.Fn mlock "caddr_t addr" "size_t len"
|
||||
.Fn mlock "const void *addr" "size_t len"
|
||||
.Ft int
|
||||
.Fn munlock "caddr_t addr" "size_t len"
|
||||
.Fn munlock "const void *addr" "size_t len"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn mlock
|
||||
|
@ -40,8 +40,8 @@
|
||||
.Sh SYNOPSIS
|
||||
.Fd #include <sys/types.h>
|
||||
.Fd #include <sys/mman.h>
|
||||
.Ft caddr_t
|
||||
.Fn mmap "caddr_t addr" "size_t len" "int prot" "int flags" "int fd" "off_t offset"
|
||||
.Ft void *
|
||||
.Fn mmap "void * addr" "size_t len" "int prot" "int flags" "int fd" "off_t offset"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn mmap
|
||||
|
@ -43,9 +43,9 @@ static char sccsid[] = "@(#)mmap.c 8.1 (Berkeley) 6/17/93";
|
||||
* This function provides 64-bit offset padding that
|
||||
* is not supplied by GCC 1.X but is supplied by GCC 2.X.
|
||||
*/
|
||||
caddr_t
|
||||
void *
|
||||
mmap(addr, len, prot, flags, fd, offset)
|
||||
caddr_t addr;
|
||||
void * addr;
|
||||
size_t len;
|
||||
int prot;
|
||||
int flags;
|
||||
@ -53,6 +53,6 @@ mmap(addr, len, prot, flags, fd, offset)
|
||||
off_t offset;
|
||||
{
|
||||
|
||||
return((caddr_t)__syscall((quad_t)SYS_mmap, addr, len, prot, flags,
|
||||
return((void *)__syscall((quad_t)SYS_mmap, addr, len, prot, flags,
|
||||
fd, 0, offset));
|
||||
}
|
||||
|
@ -41,7 +41,7 @@
|
||||
.Fd #include <sys/types.h>
|
||||
.Fd #include <sys/mman.h>
|
||||
.Ft int
|
||||
.Fn mprotect "caddr_t addr" "size_t len" "int prot"
|
||||
.Fn mprotect "const void *addr" "size_t len" "int prot"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn mprotect
|
||||
|
@ -41,7 +41,7 @@
|
||||
.Fd #include <sys/types.h>
|
||||
.Fd #include <sys/mman.h>
|
||||
.Ft int
|
||||
.Fn msync "caddr_t addr" "size_t len" "int flags"
|
||||
.Fn msync "void *addr" "size_t len" "int flags"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn msync
|
||||
|
@ -41,7 +41,7 @@
|
||||
.Fd #include <sys/types.h>
|
||||
.Fd #include <sys/mman.h>
|
||||
.Ft int
|
||||
.Fn munmap "caddr_t addr" "size_t len"
|
||||
.Fn munmap "void *addr" "size_t len"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Fn munmap
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)mman.h 8.2 (Berkeley) 1/9/95
|
||||
* $Id: mman.h,v 1.18 1997/04/13 15:38:09 bde Exp $
|
||||
* $Id: mman.h,v 1.19 1997/12/02 21:30:03 dyson Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_MMAN_H_
|
||||
@ -66,7 +66,7 @@
|
||||
/*
|
||||
* Error return from mmap()
|
||||
*/
|
||||
#define MAP_FAILED ((caddr_t)-1)
|
||||
#define MAP_FAILED ((void *)-1)
|
||||
|
||||
/*
|
||||
* msync() flags
|
||||
@ -105,18 +105,18 @@
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
int madvise __P((void *, size_t, int));
|
||||
int mincore __P((const void *, size_t, char *));
|
||||
int minherit __P((void *, size_t, int));
|
||||
int mlock __P((const void *, size_t));
|
||||
#ifndef _MMAP_DECLARED
|
||||
#define _MMAP_DECLARED
|
||||
caddr_t mmap __P((caddr_t, size_t, int, int, int, off_t));
|
||||
void * mmap __P((void *, size_t, int, int, int, off_t));
|
||||
#endif
|
||||
int mprotect __P((caddr_t, size_t, int));
|
||||
int munmap __P((caddr_t, size_t));
|
||||
int msync __P((caddr_t, size_t, int));
|
||||
int mlock __P((caddr_t, size_t));
|
||||
int munlock __P((caddr_t, size_t));
|
||||
int madvise __P((caddr_t, size_t, int));
|
||||
int mincore __P((caddr_t, size_t, char *));
|
||||
int minherit __P((caddr_t, size_t, int));
|
||||
int mprotect __P((const void *, size_t, int));
|
||||
int msync __P((void *, size_t, int));
|
||||
int munlock __P((const void *, size_t));
|
||||
int munmap __P((void *, size_t));
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !KERNEL */
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)types.h 8.6 (Berkeley) 2/19/95
|
||||
* $Id: types.h,v 1.20 1997/04/13 15:38:10 bde Exp $
|
||||
* $Id: types.h,v 1.21 1997/05/08 13:50:36 peter Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_TYPES_H_
|
||||
@ -172,7 +172,7 @@ off_t lseek __P((int, off_t, int));
|
||||
#endif
|
||||
#ifndef _MMAP_DECLARED
|
||||
#define _MMAP_DECLARED
|
||||
caddr_t mmap __P((caddr_t, size_t, int, int, int, off_t));
|
||||
void * mmap __P((void *, size_t, int, int, int, off_t));
|
||||
#endif
|
||||
#ifndef _TRUNCATE_DECLARED
|
||||
#define _TRUNCATE_DECLARED
|
||||
|
Loading…
Reference in New Issue
Block a user