summaryrefslogtreecommitdiffstats
path: root/Modules/mmapmodule.c
Commit message (Collapse)AuthorAgeFilesLines
* [Patch #708374] Only apply the check for file size if the file is a regular ↵Andrew M. Kuchling2003-07-151-1/+2
| | | | file, not a character or block device.
* Patch #708495: Port more stuff to OpenVMS.Martin v. Löwis2003-05-031-0/+4
|
* Fix two crashes on Windows:Guido van Rossum2003-04-091-2/+2
| | | | | - CHECK_VALID() was checking the wrong value for a closed fd - fseek(&_iob[fileno], ...) doesn't work for fileno >= 20
* SF patch #682514, mmapmodule.c write fix for LP64 executablesNeal Norwitz2003-02-071-1/+1
| | | | | | | Make length an int so we get the right value from PyArg_ParseTuple(args, "s#", &str, &length) Will backport.
* SF #665913, Fix mmap module core dump with unixNeal Norwitz2003-01-101-2/+4
| | | | | | Closing an mmap'ed file (calling munmap) twice on Solaris caused a core dump. Will backport.
* SF bug # 585792, Invalid mmap crashes Python interpreterNeal Norwitz2002-09-051-1/+11
| | | | | Raise ValueError if user passes a size to mmap which is larger than the file.
* Replace DL_IMPORT with PyMODINIT_FUNC and remove "/export:init..." linkMark Hammond2002-07-231-1/+1
| | | | | command line for Windows builds. This should allow MSVC to import and build the Python MSVC6 project files without error.
* Patch #569753: Remove support for WIN16.Martin v. Löwis2002-06-301-17/+17
| | | | Rename all occurrences of MS_WIN32 to MS_WINDOWS.
* SF bug 515943: searching for data with \0 in mmap.Tim Peters2002-03-081-9/+5
| | | | | | | | | mmap_find_method(): this obtained the string to find via s#, but it ignored its length, acting as if it were \0-terminated instead. Someone please run on Linux too (the extended test_mmap works on Windows). Bugfix candidate.
* Patch #477750: Use METH_ constants in Modules.Martin v. Löwis2002-01-171-13/+13
|
* Include <unistd.h> in Python.h. Fixes #500924.Martin v. Löwis2002-01-121-1/+0
|
* Patch supplied by Burton Radons for his own SF bug #487390: ModifyingGuido van Rossum2001-12-081-1/+1
| | | | | | | | | | | | | type.__module__ behavior. This adds the module name and a dot in front of the type name in every type object initializer, except for built-in types (and those that already had this). Note that it touches lots of Mac modules -- I have no way to test these but the changes look right. Apologies if they're not. This also touches the weakref docs, which contains a sample type object initializer. It also touches the mmap test output, because the mmap type's repr is included in that output. It touches object.h to put the correct description in a comment.
* CVS patch #477161: New "access" keyword for mmap, from Jay T Miller.Tim Peters2001-11-131-69/+166
| | | | | | | | | | This gives mmap() on Windows the ability to create read-only, write- through and copy-on-write mmaps. A new keyword argument is introduced because the mmap() signatures diverged between Windows and Unix, so while they (now) both support this functionality, there wasn't a way to spell it in a common way without introducing a new spelling gimmick. The old spellings are still accepted, so there isn't a backward- compatibility issue here.
* Remove obsolete e-mail addressAndrew M. Kuchling2001-11-051-1/+1
|
* Fix SF #441664: Python crash on del of a slice of a mmapThomas Wouters2001-07-161-0/+10
| | | | | | Check for slice/item deletion, which calls slice/item assignment with a NULL value, and raise a TypeError instead of coredumping. Bugreport and suggested fix by Alex Martelli.
* Fix new compiler warnings. Also boost "start" from (C) int to long andTim Peters2001-05-141-5/+5
| | | | | | | | return a (C) long: PyArg_ParseTuple and Py_BuildValue may not let us get at the size_t we really want, but C int is clearly too small for a 64-bit box, and both the start parameter and the return value should work for large mapped files even on 32-bit boxes. The code really needs to be rethought from scratch (not by me, though ...).
* Fix the .find() method for memory maps.Greg Stein2001-05-141-3/+12
| | | | | | | | | | 1) it didn't obey the "start" parameter (and when it does, we must validate the value) 2) the return value needs to be an absolute index, rather than relative to some arbitrary point in the file (checking CVS, it appears this method never worked; these changes bring it into line with typical .find() behavior)
* Minor fiddling related toTim Peters2001-05-091-5/+2
| | | | SF patch 416251 2.1c1 mmapmodule: unused vrbl cleanup
* SF but #417587: compiler warnings compiling 2.1.Tim Peters2001-04-211-1/+1
| | | | Repaired *some* of the SGI compiler warnings Sjoerd Mullender reported.
* SF bug 128713: type(mmap_object) blew up on Linux.Tim Peters2001-01-141-3/+4
|
* Part of SF patch #102409 by jlt63 to support building these modulesGuido van Rossum2001-01-101-7/+1
| | | | under CYGWIN as shared libraries (DLLs).
* Windows mmap should (as the docs probably <wink> say) create a mappingTim Peters2001-01-101-2/+2
| | | | | without a name when the optional tagname arg isn't specified. Was actually creating a mapping with an empty string as the name.
* my_getpagesize(): New function; returns the size of a page of memory.Fred Drake2000-10-011-12/+18
| | | | | | | | | | Versions are defined for Windows and Unix; the Unix flavor uses sysconf() to get the page size; this avoids the use of getpagesize(), which is deprecated and requires an additional library on some platforms (specifically, Reliant UNIX). This partially closes SourceForge bug #113797.
* For the benefit of SunOS 4.1.4, define MS_SYNC as 0 when it'sGuido van Rossum2000-09-251-0/+6
| | | | | | undefined. ccording to MvL, this is safe: the MS_SYNC flag means that msync() returns when all I/O operations are scheduled; without it, it waits until they are complete, which is acceptable behavior.
* More Windows changes.Mark Hammond2000-07-301-24/+38
| | | | | | | | * After discussion with Trent, all INT_PTR references have been removed in favour of the HANDLE it should always have been. Trent can see no 64bit issues here. * In this process, I noticed that the close operation was dangerous, in that we could end up passing bogus results to the Win32 API. These result of the API functions passed the bogus values were never (and still are not) checked, but this is closer to "the right thing" (tm) than before. Tested on Windows and Linux.
* Fixes for Windows (but also tested on Linux). Test suite now completes, and ↵Mark Hammond2000-07-301-6/+46
| | | | | | this module should not leak in the face of errors. Checkin that replaces the INT_PTR types with HANDLEs still TBD (but as that is a "spelling" patch, rather than a functional one, I will commit it seperately.
* Spelling fixes supplied by Rob W. W. Hooft. All these are fixes in eitherThomas Wouters2000-07-161-1/+1
| | | | | | | | | | comments, docstrings or error messages. I fixed two minor things in test_winreg.py ("didn't" -> "Didn't" and "Didnt" -> "Didn't"). There is a minor style issue involved: Guido seems to have preferred English grammar (behaviour, honour) in a couple places. This patch changes that to American, which is the more prominent style in the source. I prefer English myself, so if English is preferred, I'd be happy to supply a patch myself ;)
* - added (long) casts to a couple of Py_BuildValue calls,Fredrik Lundh2000-07-091-7/+7
| | | | | | | | | | just for the sake of it. note that this only covers the unlikely case that size_t is smaller than a long; it's probably more likely that there are platforms out there where size_t is *larger* than a long, and mmapmodule cannot really deal with that today.
* -- ANSI-fying, namesFredrik Lundh2000-07-081-82/+61
| | | | | | | (patch #100762 by Peter Schneider-Kamp, minus the indentation changes) -- added INT_PTR workaround to make it build under VC 5.0
* Remove definition of _GNU_SOURCE, since Python.h now does it for usAndrew M. Kuchling2000-07-051-5/+0
|
* clean up warnings in Win32 build of mmapmodule.cGuido van Rossum2000-07-011-6/+6
|
* Patch from Lorenzo M. Catucci:Andrew M. Kuchling2000-06-181-0/+5
| | | | | | I discovered the [MREMAP_MAYMOVE] symbol is only defined when _GNU_SOURCE is defined; therefore, here is the change: if we are compiling for linux, define _GNU_SOURCE before including mman.h, and all is done.
* Support resizing the mapping depending on whether HAVE_MREMAP is definedAndrew M. Kuchling2000-06-181-4/+6
| | | | Remove two unused variables
* Patch from Trent Mick:Andrew M. Kuchling2000-06-181-34/+105
| | | | | | | The seek() method is broken for any 'whence' value (seek from start, current, orend) other than the default. I have a patch that fixes that as well as gets mmap'd files working on Linux64 and Win64.
* Removed MS_INVALIDATE flagsAndrew M. Kuchling2000-06-181-2/+2
|
* Fix the size() method to return the size of the file on Unix, not theAndrew M. Kuchling2000-06-171-3/+12
| | | | | size of the mapped area. This seems to be what the Windows version does. This change requires keeping around the fd of the mapped file.
* Use PyArg_ParseTuple and specify the method names, following a suggestionAndrew M. Kuchling2000-06-031-5/+5
| | | | from Greg Stein
* Add missing PyArg_NoArgs() calls to methods that didn't take argumentsAndrew M. Kuchling2000-06-031-8/+16
| | | | (Pointed out by Moshe Zadka)
* Vladimir Marangozov's long-awaited malloc restructuring.Guido van Rossum2000-05-031-3/+3
| | | | | | | | | | For more comments, read the patches@python.org archives. For documentation read the comments in mymalloc.h and objimpl.h. (This is not exactly what Vladimir posted to the patches list; I've made a few changes, and Vladimir sent me a fix in private email for a problem that only occurs in debug mode. I'm also holding back on his change to main.c, which seems unnecessary to me.)
* Correct fix by Mark Favas for the cast problems.Guido van Rossum2000-04-101-4/+5
|
* I've had complaints about the comparison "where >= 0" before -- onGuido van Rossum2000-04-101-1/+1
| | | | IRIX, it doesn't even compile. Added a cast: "where >= (char *)0".
* Mark Hammond <mhammond@skippinet.com.au>:Fred Drake2000-04-051-6/+2
| | | | This patch fixes the mmap module on Windows 9x.
* Patch from Hrvoje Niksic <hniksic@iskon.hr>:Fred Drake2000-04-041-8/+8
| | | | | | | | | | | | | | The bug is in mmap_read_line_method(), and its loop that searches for newlines. After the loop reaches EOF, eol is incremented and points after the end of the memory. This results in readline() method sometimes picking up and returning a byte after the end of the string. This is usually a bogus \0, but it could cause SIGSEGV if it's after the end of the page). The patch fixes the problem. Also, it uses memchr() for finding a character, which is in fact the "strnchr" the comment is asking for. memchr() is already used in Python sources, so there should be no portability problems.
* Removed three unused variables from the Windows code.Guido van Rossum2000-03-311-3/+0
|
* Hacked for Win32 by Mark Hammond.Guido van Rossum2000-03-311-542/+569
| | | | | | | | | | | | | | | | | Reformatted for 8-space tabs and fitted into 80-char lines by GvR. Mark writes: * the Win32 version now accepts the same args as the Unix version. The win32 specific "tag" param is now optional. The end result is that the exact same test suite runs on Windows (definately a worthy goal!). * I changed the error object. All occurences of the error, except for 1, corresponds to an underlying OS error. This one was changed to a ValueError (a better error for that condition), and the module error object is now simply EnvironmentError. All win32 error routines now call the new Windows specific error handler.
* Added mmap module -- map a view of a file into memory on Win32 and Unix.Andrew M. Kuchling2000-03-301-0/+848
(Needs testing on Win32.)