summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/mmap.cc
Commit message (Collapse)AuthorAgeFilesLines
* fix various typos reported by spellintianDavid Kalnischkies2017-01-191-3/+3
| | | | | | | | Most of them in (old) code comments. The two instances of user visible string changes the po files of the manpages are fixed up as well. Gbp-Dch: Ignore Reported-By: spellintian
* Store the size of strings in the cacheJulian Andres Klode2016-01-081-2/+9
| | | | | By storing the size of the string in the cache, we can make use of it when comparing the names in the hashtable in pkgCache::FindGrp.
* mmap: Define _DEFAULT_SOURCE instead of _BSD_SOURCEJulian Andres Klode2015-12-111-1/+1
| | | | | | Fixes a warning reported by gcc. Gbp-Dch: ignore
* do not segfault in cache generation on mmap failureDavid Kalnischkies2015-11-201-5/+10
| | | | | | | | | | | | | | | Out of memory and similar circumstanzas could cause MMap::Map to fail and especially the mmap/malloc calls in it. With some additional checking we can avoid segfaults and similar in such situations – at least in theory as if this is a real out of memory everything we do to handle the error could just as well run into a memory problem as well… But at least in theory (if MMap::Map is made to fail always) we can deal with it so good that a user actually never sees a failure (as the cache it tries to load with it fails and is discarded, so that DynamicMMap takes over and a new one is build) instead of segfaulting. Closes: 803417
* avoid using global PendingError to avoid failing too often too soonDavid Kalnischkies2015-09-141-8/+8
| | | | | | | | | | | | | | | | | | | Our error reporting is historically grown into some kind of mess. A while ago I implemented stacking for the global error which is used in this commit now to wrap calls to functions which do not report (all) errors via return, so that only failures in those calls cause a failure to propergate down the chain rather than failing if anything (potentially totally unrelated) has failed at some point in the past. This way we can avoid stopping the entire acquire process just because a single source produced an error for example. It also means that after the acquire process the cache is generated – even if the acquire process had failures – as we still have the old good data around we can and should generate a cache for (again). There are probably more instances of this hiding, but all these looked like the easiest to work with and fix with reasonable (aka net-positive) effects.
* cleanup headers and especially #includes everywhereDavid Kalnischkies2014-03-131-2/+2
| | | | | | | | Beside being a bit cleaner it hopefully also resolves oddball problems I have with high levels of parallel jobs. Git-Dch: Ignore Reported-By: iwyu (include-what-you-use)
* warning: useless cast to type A [-Wuseless-cast]David Kalnischkies2014-03-131-1/+1
| | | | | Git-Dch: Ignore Reported-By: gcc -Wuseless-cast
* rework some code to fix some scan-build warningsDavid Kalnischkies2014-01-161-1/+7
| | | | | | | | No visible functional changes, just code moved around and additional checks to eliminate impossible branches Reported-By: scan-build Git-Dch: Ignore
* move the sysconf call behind the _POSIX_SYNCHRONIZED_IO guard thereDavid Kalnischkies2012-08-041-1/+1
| | | | it is used for the msync call
* apt-pkg/contrib/mmap.cc:Pino Toscano2012-08-041-7/+7
| | | | | | - guard only the msync call with _POSIX_SYNCHRONIZED_IO rather than also the fallback code as it breaks APT on hurd since 0.9.7.3 as the fallback is now always used on non-linux (Closes: #683354)
* for filesystems not supporting mmap'ing a file we need to use aDavid Kalnischkies2012-07-241-0/+1
| | | SyncToFd dummy just as we did for compressed files in 0.9.5
* trigger the usage of the fallback code for kfreebsd also in theDavid Kalnischkies2012-07-241-1/+11
| | | second (filebased) constructor of DynamicMMap (Closes: #677704)
* * apt-pkg/contrib/mmap.cc:David Kalnischkies2012-07-201-1/+1
| | | | - refer to APT::Cache-Start in case the growing failed as if -Limit is really the offender it will be noted in a previous error message.
* Fix previous commit: Do not call memset() if realloc() returned NULL.Julian Andres Klode2012-06-161-2/+3
|
* Zero out the new memory allocated with realloc().Julian Andres Klode2012-06-161-0/+2
|
* * apt-pkg/contrib/mmap.cc:Julian Andres Klode2012-06-161-9/+8
| | | | | - Fix the Fallback option to work correctly, by not calling realloc() on a map mapped by mmap(), and by using malloc and friends instead of new[].
* * apt-pkg/contrib/mmap.cc:David Kalnischkies2012-05-211-0/+1
| | | | | - have a dummy SyncToFd around in case of ReadOnly access to a compressed file as we otherwise on Close() do not delete[] the char buffer but munmap() it… (Closes: #673815)
* improve error reporting in case of errors in combination with zlibDavid Kalnischkies2012-01-181-1/+1
|
* Allow the FileFd to use an external Compressor to uncompress a given fileDavid Kalnischkies2011-12-131-1/+8
| | | | | | | | | | | internally so that it is exported and can be used like a "normal" uncompressed file with FileFd This allows us to hide th zlib usage in the implementation and use gzip instead if we don't have zlib builtin (the same for other compressors). The code includes quiet a few FIXME's so while all tests are working it shouldn't be used just yet outside of libapt as it might break.
* - add a ReadLine methodDavid Kalnischkies2011-12-111-1/+12
| | | - drop the explicit export of gz-compression handling
* use forward declaration in headers if possible instead of includesDavid Kalnischkies2011-09-191-0/+1
|
* Support large files in the complete toolset. Indexes of thisDavid Kalnischkies2011-09-131-8/+8
| | | | size are pretty unlikely for now, but we need it for deb packages which could become bigger than 4GB now (LP: #815895)
* reorder includes: add <config.h> if needed and include it at firstDavid Kalnischkies2011-09-131-4/+5
|
* MAP_ANON is deprecated in favor of MAP_ANONYMOUS, but telesphoreo needsDavid Kalnischkies2011-05-131-0/+8
| | | | to ships a patch for this so pretend to be nice and make it work (TM)
* * apt-pkg/contrib/fileutl.cc:David Kalnischkies2011-02-141-2/+2
| | | | | | | - really detect bigendian machines by including config.h, so we can really (Closes: #612986) * apt-pkg/contrib/mmap.cc: - Base has as 'valid' failure states 0 and -1 so add a simple validData method to check for failure states
* * apt-pkg/contrib/mmap.cc:David Kalnischkies2011-02-121-0/+2
| | | - do not try to free the mapping if its is unset
* * doc/apt.conf.5.xml:David Kalnischkies2010-07-091-0/+2
| | | - add and document APT::Cache-{Start,Grow,Limit} options for mmap control
* * apt-pkg/pkgcachegen.{cc,h}:David Kalnischkies2010-07-081-9/+18
| | | | - make the used MMap moveable (and therefore dynamic resizeable) by applying (some) mad pointer magic (Closes: #195018)
* make the MMap Grow Error a fatal one as while in theory the code shouldDavid Kalnischkies2010-06-261-1/+1
| | | | never segfault it still tend to do it so better show it directly
* * contrib/mmap.cc:David Kalnischkies2010-05-131-2/+2
| | | | - clarify "MMap reached size limit" error message, thanks Ivan Masár!
* * apt-pkg/contrib/mmap.{h,cc}:David Kalnischkies2010-02-271-11/+59
| | | | | | - add char[] fallback for filesystems without shared writable mmap() like JFFS2. Thanks to Marius Vollmer for writing and to Loïc Minier for pointing to the patch! (Closes: #314334)
* extent the mmap to be able to handle currently not implementedDavid Kalnischkies2009-11-091-42/+85
| | | | (but planed) growable mmaps
* * apt-pkg/contrib/mmap.cc:Julian Andres Klode2009-08-021-1/+1
| | | | - Fix FTBFS on GNU/kFreeBSD by disabling DynamicMMap::Grow() on non-Linux architectures (as it uses mremap).
* merge with lp:apt/debian-sidDavid Kalnischkies2009-07-261-1/+1
| | | | | Remove a bug (= an evil amok running if) introduced by the merge in 1817 which cause a segfault in the destructor for the dynamic mmap.
* merge from the donkult branchMichael Vogt2009-07-241-4/+11
|\
| * [apt-pkg] yet another bit of mmap and pkgcachegen housekeepingDavid Kalnischkies2009-07-231-6/+14
| | | | | | | | | | | | | | | | | | * add mmap error message also to the dynamic mmap * remove some more {Ver,Desc} == 0 checks in for loops * try to respect the given flags to the dynamic mmap * open cached caches not as ReadOnly and not as Shared, so we always have a copy of the cache in the memory we can modify (e.g. set the hold state on-the-fly)
* | The 'not dead yet' releaseMichael Vogt2009-07-211-34/+79
|\| | | | | | | | | | | | | | | | | | | | | * add hook for MarkInstall and MarkDelete (closes: #470035) * add the various foldmarkers in apt-pkg & cmdline (no code change) * versions with a pin of -1 shouldn't be a candidate (Closes: #355237) * prefer mmap as memory allocator in MMap instead of a static char array which can (at least in theory) grow dynamic * eliminate (hopefully all) segfaults in pkgcachegen.cc and mmap.cc which can arise if cache doesn't fit into the mmap (Closes: #535218) * display warnings instead of errors if the parts dirs doesn't exist * honor the dpkg hold state in new Marker hooks (closes: #64141)
| * eliminate (hopefully all) segfaults in pkgcachegen.cc and mmap.ccDavid Kalnischkies2009-07-211-45/+23
| | | | | | | | | | | | | | which can arise if cache doesn't fit into the mmap (Closes: #535218) This removes also the previously introduced SegfaultSignalHandler: The handler works, but is ugly by design...
| * add a segfault handler to MMap to show the Cache-Limit message, whichDavid Kalnischkies2009-07-081-0/+24
| | | | | | | | can be deactivated with MMap::SegfaultHandler=false (Closes: 535218)
| * [contrib/mmap] implements a theoretical dynamic growing mmapDavid Kalnischkies2009-07-081-21/+63
|/ | | | | | | | | based on Michael Vogts patch in #195018 this commit implements the use of mmap (as preferred) instead of a static char array. In theory this made it possible to grow the mmap as needed, but as it is currently impossible to move the mmap around in the memory the grow is likely to fail but it improve the memory usage a bit, so it is not totally useless for now - and maybe we can adjust the pointers in the future...
* Added instruction how to work around MMap error in MMap error message.Eugene V. Lyubimkin2008-11-261-2/+4
|
* fix various -Wall warningsMichael Vogt2008-10-281-2/+3
|
* * apt-pkg/acquire-item.cc:Michael Vogt2007-09-271-2/+2
| | | | | - fix crash in diff acquire code * apt-pkg/contrib/mmap.cc: - don't fail if msync() returns > 0
* * make apt build with g++ 4.3Michael Vogt2007-09-101-0/+2
|
* * remove all the remaining #pragma implementationMichael Vogt2007-06-081-4/+0
|
* * leak fix for debian #250583Michael Vogt2005-09-281-2/+2
|
* Ensure the memory buffer is 0'dArch Librarian2004-09-201-1/+2
| | | | | | Author: jgg Date: 2001-05-27 05:19:30 GMT Ensure the memory buffer is 0'd
* Join with aliencodeArch Librarian2004-09-201-8/+15
| | | | | | Author: jgg Date: 2001-02-20 07:03:16 GMT Join with aliencode
* More or group patchesArch Librarian2004-09-201-3/+3
| | | | | | Author: jgg Date: 1999-10-02 04:14:53 GMT More or group patches
* Fixed msync thingyArch Librarian2004-09-201-3/+1
| | | | | | Author: jgg Date: 1999-08-30 04:20:26 GMT Fixed msync thingy