caddr_t -> void *

PR/4269: Chris Demetriou: Add MS_* to msync()
This commit is contained in:
christos 1997-10-16 23:21:47 +00:00
parent 5345a8bef9
commit 14d765b9a0
7 changed files with 68 additions and 40 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: minherit.2,v 1.1 1997/09/08 18:42:44 chuck Exp $
.\" $NetBSD: minherit.2,v 1.2 1997/10/16 23:21:47 christos 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

View File

@ -1,4 +1,4 @@
.\" $NetBSD: mlock.2,v 1.3 1995/06/24 10:42:03 cgd Exp $
.\" $NetBSD: mlock.2,v 1.4 1997/10/16 23:21:50 christos Exp $
.\"
.\" Copyright (c) 1993
.\" The Regents of the University of California. All rights reserved.
@ -44,9 +44,9 @@
.Fd #include <sys/types.h>
.Fd #include <sys/mman.h>
.Ft int
.Fn mlock "caddr_t addr" "size_t len"
.Fn mlock "void *addr" "size_t len"
.Ft int
.Fn munlock "caddr_t addr" "size_t len"
.Fn munlock "void *addr" "size_t len"
.Sh DESCRIPTION
The
.Nm mlock

View File

@ -1,4 +1,4 @@
.\" $NetBSD: mmap.2,v 1.8 1997/07/15 06:47:38 mikel Exp $
.\" $NetBSD: mmap.2,v 1.9 1997/10/16 23:21:52 christos Exp $
.\"
.\" Copyright (c) 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@ -42,8 +42,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
.Nm mmap

View File

@ -1,4 +1,4 @@
/* $NetBSD: mmap.c,v 1.7 1997/07/13 20:25:31 christos Exp $ */
/* $NetBSD: mmap.c,v 1.8 1997/10/16 23:21:55 christos Exp $ */
/*
* Copyright (c) 1992, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)mmap.c 8.1 (Berkeley) 6/17/93";
#else
__RCSID("$NetBSD: mmap.c,v 1.7 1997/07/13 20:25:31 christos Exp $");
__RCSID("$NetBSD: mmap.c,v 1.8 1997/10/16 23:21:55 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -51,9 +51,9 @@ __RCSID("$NetBSD: mmap.c,v 1.7 1997/07/13 20:25:31 christos Exp $");
* 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;

View File

@ -1,4 +1,4 @@
.\" $NetBSD: mprotect.2,v 1.6 1995/10/12 15:41:08 jtc Exp $
.\" $NetBSD: mprotect.2,v 1.7 1997/10/16 23:21:56 christos 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 mprotect "caddr_t addr" "size_t len" "int prot"
.Fn mprotect "void *addr" "size_t len" "int prot"
.Sh DESCRIPTION
The
.Fn mprotect

View File

@ -1,4 +1,4 @@
.\" $NetBSD: msync.2,v 1.8 1995/10/12 15:41:09 jtc Exp $
.\" $NetBSD: msync.2,v 1.9 1997/10/16 23:21:57 christos Exp $
.\"
.\" Copyright (c) 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@ -33,23 +33,24 @@
.\"
.\" @(#)msync.2 8.1 (Berkeley) 6/9/93
.\"
.Dd June 9, 1993
.Dd October 10, 1997
.Dt MSYNC 2
.Os
.Os NetBSD 1.3
.Sh NAME
.Nm msync
.Nd synchronize a mapped region
.Sh SYNOPSIS
.Fd #include <sys/types.h>
.Fd #include <sys/mman.h>
.Ft int
.Fn msync "caddr_t addr" "size_t len"
.Fn msync "void *addr" "size_t len" "int flags"
.Sh DESCRIPTION
The
.Fn msync
system call
writes any modified pages back to the filesystem and updates
the file modification time.
system call writes all pages with shared modifications
in the specified
region of the process's address space back to permanent
storage, and, if requested, invalidates cached data mapped
in the region.
If
.Fa len
is 0, all modified pages within the region containing
@ -57,39 +58,66 @@ is 0, all modified pages within the region containing
will be flushed;
if
.Fa len
is non-zero, only the pages containing
is non-zero, only modified pages containing
.Fa addr
and
.Fa len
succeeding locations will be examined.
succeeding locations will be flushed.
Any required synchronization of memory caches
will also take place at this time.
Filesystem operations on a file that is mapped for shared modifications
are unpredictable except after an
.Fn msync .
.Pp
The
.Fa flags
argument is formed by
.Em or Ns 'ing
the following values
.Pp
.Bd -literal -offset indent -compact
MS_ASYNC Perform asynchronous writes.
MS_SYNC Perform synchronous writes.
MS_INVALIDATE Invalidate cached data after writing.
.Ed
.Sh ERRORS
The following errors may be reported:
.Bl -tag -width Er
.It Bq Er EBUSY
The
.Dv MS_INVALIDATE
flag was specified and a portion of the specified region
was locked with
.Xr mlock 2 .
.It Bq Er EINVAL
The specified
.Fa flags
argument was invalid.
.It Bq Er EINVAL
The
.Fa addr
parameter was not page aligned.
.It Bq Er EINVAL
The
.Fa addr
parameter did not specify an address part of a mapped region.
.It Bq Er EINVAL
The
.Fa len
parameter was negative.
.It Bq Er EIO
An I/O error occured while writing to the file system.
An I/O error occured while writing.
.It Bq Er ENOMEM
Addresses in the specified region are outside the range allowed
for the address space of the process, or specify one or more pages
which are unmapped.
.Sh SEE ALSO
.Xr madvise 2 ,
.Xr munmap 2 ,
.Xr mprotect 2 ,
.Xr mincore 2
.Xr mlock 2 ,
.Xr mmap 2 ,
.Xr munlock 2
.Sh BUGS
Writes are currently done synchronously even if the
.Dv MS_ASYNC
flag is specified.
.Sh HISTORY
The
.Fn msync
function first appeared in 4.4BSD.
function first appeared in
.Bx 4.4 .
It was modified to conform to
.St -p1003.1b-93
in
.Nx 1.3 .
.P

View File

@ -1,4 +1,4 @@
.\" $NetBSD: munmap.2,v 1.6 1997/07/15 06:52:43 mikel Exp $
.\" $NetBSD: munmap.2,v 1.7 1997/10/16 23:21:59 christos 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 munmap "caddr_t addr" "size_t len"
.Fn munmap "void *addr" "size_t len"
.Sh DESCRIPTION
The
.Fn munmap