Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
5055545f
Commit
5055545f
authored
Sep 25, 2001
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clarified some points about the interface to the mmap() function.
This closes SF bug #448918.
parent
c0765c23
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
10 deletions
+11
-10
Doc/lib/libmmap.tex
Doc/lib/libmmap.tex
+11
-10
No files found.
Doc/lib/libmmap.tex
View file @
5055545f
...
@@ -14,17 +14,20 @@ change a substring by assigning to a slice:
...
@@ -14,17 +14,20 @@ change a substring by assigning to a slice:
data starting at the current file position, and
\method
{
seek()
}
data starting at the current file position, and
\method
{
seek()
}
through the file to different positions.
through the file to different positions.
A memory-mapped file is created by the following function, which is
A memory-mapped file is created by the
\function
{
mmap()
}
function,
different on Unix and on Windows.
which is different on
\UNIX
{}
and on Windows. In either case you must
provide a file descriptor for a file opened for update.
If you wish to map an existing Python file object, use its
\method
{
fileno()
}
method to obtain the correct value for the
\var
{
fileno
}
parameter. Otherwise, you can open the file using the
\function
{
os.open()
}
function, which returns a file descriptor
directly (the file still needs to be closed when done).
\begin{funcdesc}
{
mmap
}{
fileno, length
\optional
{
, tagname
}}
\begin{funcdesc}
{
mmap
}{
fileno, length
\optional
{
, tagname
}}
\strong
{
(Windows version)
}
Maps
\var
{
length
}
bytes from the file
\strong
{
(Windows version)
}
Maps
\var
{
length
}
bytes from the file
specified by the file handle
\var
{
fileno
}
, and returns a mmap object.
specified by the file handle
\var
{
fileno
}
, and returns a mmap object.
If
\var
{
length
}
is
\code
{
0
}
, the maximum length of the map will be the
If
\var
{
length
}
is
\code
{
0
}
, the maximum length of the map will be the
current size of the file when
\function
{
mmap()
}
is called.
current size of the file when
\function
{
mmap()
}
is called.
If you wish to map an existing Python file object, use its
\method
{
fileno()
}
method to obtain the correct value for the
\var
{
fileno
}
parameter. The file must be opened for update.
\var
{
tagname
}
, if specified and not
\code
{
None
}
, is a string giving a
\var
{
tagname
}
, if specified and not
\code
{
None
}
, is a string giving a
tag name for the mapping. Windows allows you to have many different
tag name for the mapping. Windows allows you to have many different
...
@@ -35,12 +38,9 @@ created without a name. Avoiding the use of the tag parameter will
...
@@ -35,12 +38,9 @@ created without a name. Avoiding the use of the tag parameter will
assist in keeping your code portable between
\UNIX
{}
and Windows.
assist in keeping your code portable between
\UNIX
{}
and Windows.
\end{funcdesc}
\end{funcdesc}
\begin{funcdesc}
{
mmap
}{
fileno,
size
\optional
{
, flags, prot
}}
\begin{funcdesc}
{
mmap
}{
fileno,
length
\optional
{
, flags
\optional
{
, prot
}
}}
\strong
{
(
\UNIX
{}
version)
}
Maps
\var
{
length
}
bytes from the file
\strong
{
(
\UNIX
{}
version)
}
Maps
\var
{
length
}
bytes from the file
specified by the file handle
\var
{
fileno
}
, and returns a mmap object.
specified by the file descriptor
\var
{
fileno
}
, and returns a mmap object.
If you wish to map an existing Python file object, use its
\method
{
fileno()
}
method to obtain the correct value for the
\var
{
fileno
}
parameter. The file must be opened for update.
\var
{
flags
}
specifies the nature of the mapping.
\var
{
flags
}
specifies the nature of the mapping.
\constant
{
MAP
_
PRIVATE
}
creates a private copy-on-write mapping, so
\constant
{
MAP
_
PRIVATE
}
creates a private copy-on-write mapping, so
...
@@ -55,6 +55,7 @@ to specify that the pages may be read or written.
...
@@ -55,6 +55,7 @@ to specify that the pages may be read or written.
\var
{
prot
}
defaults to
\constant
{
PROT
_
READ | PROT
_
WRITE
}
.
\var
{
prot
}
defaults to
\constant
{
PROT
_
READ | PROT
_
WRITE
}
.
\end{funcdesc}
\end{funcdesc}
Memory-mapped file objects support the following methods:
Memory-mapped file objects support the following methods:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment