summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/mmap.cc
AgeCommit message (Collapse)AuthorFilesLines
2018-05-07Remove obsolete RCS keywordsGuillem Jover1-1/+0
Prompted-by: Jakub Wilk <jwilk@debian.org>
2017-12-13convert various c-style casts to C++-styleDavid Kalnischkies1-2/+1
gcc was warning about ignored type qualifiers for all of them due to the last 'const', so dropping that and converting to static_cast in the process removes the here harmless warning to avoid hidden real issues in them later on. Reported-By: gcc Gbp-Dch: Ignore
2017-07-12Reformat and sort all includes with clang-formatJulian Andres Klode1-4/+4
This makes it easier to see which headers includes what. The changes were done by running git grep -l '#\s*include' \ | grep -E '.(cc|h)$' \ | xargs sed -i -E 's/(^\s*)#(\s*)include/\1#\2 include/' To modify all include lines by adding a space, and then running ./git-clang-format.sh.
2017-01-19fix various typos reported by spellintianDavid Kalnischkies1-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
2016-01-08Store the size of strings in the cacheJulian Andres Klode1-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.
2015-12-11mmap: Define _DEFAULT_SOURCE instead of _BSD_SOURCEJulian Andres Klode1-1/+1
Fixes a warning reported by gcc. Gbp-Dch: ignore
2015-11-20do not segfault in cache generation on mmap failureDavid Kalnischkies1-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
2015-09-14avoid using global PendingError to avoid failing too often too soonDavid Kalnischkies1-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.
2014-03-13cleanup headers and especially #includes everywhereDavid Kalnischkies1-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)
2014-03-13warning: useless cast to type A [-Wuseless-cast]David Kalnischkies1-1/+1
Git-Dch: Ignore Reported-By: gcc -Wuseless-cast
2014-01-16rework some code to fix some scan-build warningsDavid Kalnischkies1-1/+7
No visible functional changes, just code moved around and additional checks to eliminate impossible branches Reported-By: scan-build Git-Dch: Ignore
2012-08-04move the sysconf call behind the _POSIX_SYNCHRONIZED_IO guard thereDavid Kalnischkies1-1/+1
it is used for the msync call
2012-08-04apt-pkg/contrib/mmap.cc:Pino Toscano1-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)
2012-07-24for filesystems not supporting mmap'ing a file we need to use aDavid Kalnischkies1-0/+1
SyncToFd dummy just as we did for compressed files in 0.9.5
2012-07-24trigger the usage of the fallback code for kfreebsd also in theDavid Kalnischkies1-1/+11
second (filebased) constructor of DynamicMMap (Closes: #677704)
2012-07-20* apt-pkg/contrib/mmap.cc:David Kalnischkies1-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.
2012-06-16Fix previous commit: Do not call memset() if realloc() returned NULL.Julian Andres Klode1-2/+3
2012-06-16Zero out the new memory allocated with realloc().Julian Andres Klode1-0/+2
2012-06-16* apt-pkg/contrib/mmap.cc:Julian Andres Klode1-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[].
2012-05-21* apt-pkg/contrib/mmap.cc:David Kalnischkies1-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)
2012-01-18improve error reporting in case of errors in combination with zlibDavid Kalnischkies1-1/+1
2011-12-13Allow the FileFd to use an external Compressor to uncompress a given fileDavid Kalnischkies1-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.
2011-12-11 - add a ReadLine methodDavid Kalnischkies1-1/+12
- drop the explicit export of gz-compression handling
2011-09-19use forward declaration in headers if possible instead of includesDavid Kalnischkies1-0/+1
2011-09-13Support large files in the complete toolset. Indexes of thisDavid Kalnischkies1-8/+8
size are pretty unlikely for now, but we need it for deb packages which could become bigger than 4GB now (LP: #815895)
2011-09-13reorder includes: add <config.h> if needed and include it at firstDavid Kalnischkies1-4/+5
2011-05-13MAP_ANON is deprecated in favor of MAP_ANONYMOUS, but telesphoreo needsDavid Kalnischkies1-0/+8
to ships a patch for this so pretend to be nice and make it work (TM)
2011-02-14* apt-pkg/contrib/fileutl.cc:David Kalnischkies1-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
2011-02-12* apt-pkg/contrib/mmap.cc:David Kalnischkies1-0/+2
- do not try to free the mapping if its is unset
2010-07-09* doc/apt.conf.5.xml:David Kalnischkies1-0/+2
- add and document APT::Cache-{Start,Grow,Limit} options for mmap control
2010-07-08* apt-pkg/pkgcachegen.{cc,h}:David Kalnischkies1-9/+18
- make the used MMap moveable (and therefore dynamic resizeable) by applying (some) mad pointer magic (Closes: #195018)
2010-06-26make the MMap Grow Error a fatal one as while in theory the code shouldDavid Kalnischkies1-1/+1
never segfault it still tend to do it so better show it directly
2010-05-13* contrib/mmap.cc:David Kalnischkies1-2/+2
- clarify "MMap reached size limit" error message, thanks Ivan Masár!
2010-02-27* apt-pkg/contrib/mmap.{h,cc}:David Kalnischkies1-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)
2009-11-09extent the mmap to be able to handle currently not implementedDavid Kalnischkies1-42/+85
(but planed) growable mmaps
2009-08-02* apt-pkg/contrib/mmap.cc:Julian Andres Klode1-1/+1
- Fix FTBFS on GNU/kFreeBSD by disabling DynamicMMap::Grow() on non-Linux architectures (as it uses mremap).
2009-07-26merge with lp:apt/debian-sidDavid Kalnischkies1-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.
2009-07-24merge from the donkult branchMichael Vogt1-4/+11
2009-07-23[apt-pkg] yet another bit of mmap and pkgcachegen housekeepingDavid Kalnischkies1-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)
2009-07-21The 'not dead yet' releaseMichael Vogt1-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)
2009-07-21eliminate (hopefully all) segfaults in pkgcachegen.cc and mmap.ccDavid Kalnischkies1-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...
2009-07-08add a segfault handler to MMap to show the Cache-Limit message, whichDavid Kalnischkies1-0/+24
can be deactivated with MMap::SegfaultHandler=false (Closes: 535218)
2009-07-08[contrib/mmap] implements a theoretical dynamic growing mmapDavid Kalnischkies1-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...
2008-11-26Added instruction how to work around MMap error in MMap error message.Eugene V. Lyubimkin1-2/+4
2008-10-28fix various -Wall warningsMichael Vogt1-2/+3
2007-09-27* apt-pkg/acquire-item.cc:Michael Vogt1-2/+2
- fix crash in diff acquire code * apt-pkg/contrib/mmap.cc: - don't fail if msync() returns > 0
2007-09-10* make apt build with g++ 4.3Michael Vogt1-0/+2
2007-06-08* remove all the remaining #pragma implementationMichael Vogt1-4/+0
2005-09-28* leak fix for debian #250583Michael Vogt1-2/+2
2004-09-20Ensure the memory buffer is 0'dArch Librarian1-1/+2
Author: jgg Date: 2001-05-27 05:19:30 GMT Ensure the memory buffer is 0'd