Age | Commit message (Collapse) | Author |
|
Original commit message:
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
LP: #1815129
|
|
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)
|
|
Git-Dch: Ignore
Reported-By: gcc -Wuseless-cast
|
|
No visible functional changes, just code moved around and additional
checks to eliminate impossible branches
Reported-By: scan-build
Git-Dch: Ignore
|
|
it is used for the msync call
|
|
- 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)
|
|
SyncToFd dummy just as we did for compressed files in 0.9.5
|
|
second (filebased) constructor of DynamicMMap (Closes: #677704)
|
|
- 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 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[].
|
|
- 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)
|
|
|
|
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.
|
|
- drop the explicit export of gz-compression handling
|
|
|
|
size are pretty unlikely for now, but we need it for deb
packages which could become bigger than 4GB now (LP: #815895)
|
|
|
|
to ships a patch for this so pretend to be nice and make it work (TM)
|
|
- 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
|
|
- do not try to free the mapping if its is unset
|
|
- add and document APT::Cache-{Start,Grow,Limit} options for mmap control
|
|
- make the used MMap moveable (and therefore dynamic resizeable) by
applying (some) mad pointer magic (Closes: #195018)
|
|
never segfault it still tend to do it so better show it directly
|
|
- clarify "MMap reached size limit" error message, thanks Ivan Masár!
|
|
- 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)
|
|
(but planed) growable mmaps
|
|
- Fix FTBFS on GNU/kFreeBSD by disabling DynamicMMap::Grow() on
non-Linux architectures (as it uses mremap).
|
|
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.
|
|
|
|
* 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)
|
|
* 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)
|
|
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...
|
|
can be deactivated with MMap::SegfaultHandler=false (Closes: 535218)
|
|
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...
|
|
|
|
|
|
- fix crash in diff acquire code
* apt-pkg/contrib/mmap.cc:
- don't fail if msync() returns > 0
|
|
|
|
|
|
|
|
Author: jgg
Date: 2001-05-27 05:19:30 GMT
Ensure the memory buffer is 0'd
|
|
Author: jgg
Date: 2001-02-20 07:03:16 GMT
Join with aliencode
|
|
Author: jgg
Date: 1999-10-02 04:14:53 GMT
More or group patches
|
|
Author: jgg
Date: 1999-08-30 04:20:26 GMT
Fixed msync thingy
|
|
Author: jgg
Date: 1999-08-28 01:49:07 GMT
Fixed sign conversion
|
|
Author: jgg
Date: 1999-08-02 03:07:47 GMT
A few functions migrated around
|
|
Author: jgg
Date: 1999-07-18 05:58:40 GMT
Small range check bug
|
|
Author: jgg
Date: 1999-04-18 06:36:36 GMT
Support for memory-only caching
|