Commit Graph

5506 Commits

Author SHA1 Message Date
Axel Dörfler 29bb91d6e5 * Cleaned up DormantNodeManager.
* Renamed global variable _DormantNodeManager to gDormantNodeManager.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34538 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-07 21:11:13 +00:00
Ingo Weinhold 522c2f19d4 * Added a simple mechanism to wait for events to VMCache. WaitForPageEvents()
waits for certain events on a given page, NotifyPageEvents() wakes up
  waiting threads respectively.
* Used the new feature instead of condition variables for waiting on busy
  pages. We save publishing and unpublishing of a condition variable whenever
  a page is marked busy. There's only something to do, if there's at least
  one thread waiting in the list of the respective cache. The general
  assumption is that this is only rarely the case and even if it happens,
  there should be only very few threads.
* Added an apparently missing notification in cache_io(). At least I didn't
  see the reason for it not being there.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34537 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-07 15:42:08 +00:00
Ingo Weinhold 6440406a59 Style changes
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34536 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-07 14:28:56 +00:00
Ingo Weinhold be7328a9f6 Moved VMCache related definitions to <vm/VMCache.h>.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34535 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-07 14:14:21 +00:00
Ingo Weinhold e55886c3a3 Make iteration safe. VMKernelAddressSpace::Next() doesn't like NULL pointers.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34531 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-07 01:56:01 +00:00
Ingo Weinhold 40cd019ea0 * Renamed VMAddressSpace::ResizeArea{Head,Tail}() to ShrinkArea{Head,Tail}()
to clarify that they never enlarge the area.
* Reimplemented VMKernelAddressSpace. It is somewhat inspired by Bonwick's
  vmem resource allocator (though we have different requirements):
  - We consider the complete address space to be divided into contiguous
    ranges of type free, reserved, or area, each range being represented by
    a VMKernelAddressRange object.
  - The range objects are managed in an AVL tree and a doubly linked list
    (the latter only for faster iteration) sorted by address. This provides
    O(log(n)) lookup, insertion and removal.
  - For each power of two size we maintain a list of free ranges of at least
    that size. Thus for the most common case of B_ANY*_ADDRESS area
    allocation, we find a free range in constant time (the rest of the
    processing being O(log(n))) with a rather good fit. This should also
    help avoiding address space fragmentation.
  While the new implementation should be faster, particularly with an
  increasing number of areas, I couldn't measure any difference in the -j2
  haiku build. From a cursory test the -j8 build hasn't tangibly benefitted
  either.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34528 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-06 17:18:04 +00:00
Ingo Weinhold a54549a8cd * AVLTree:
- Renamed to AVLTreeBase and moved it into its own header/source file.
  - Renamed FindClose() to FindClosest().
  - Added CheckTree() method for debugging purposes. It checks the validity
    of the tree.
* Added a templatized class AVLTree which doesn't offer a map-like interface
  like AVLTreeMap, but rather one similar to BOpenHashMap and SplayTree. It
  is more convenient to use, if one wants to store objects that already
  contain the key.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34526 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-06 15:59:37 +00:00
Ingo Weinhold 4fb60da357 Removed the DoublyLinkedListLink constructor and destructor. They are not
necessary and prevent the structures from being used in a union.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34525 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-06 15:47:34 +00:00
Ingo Weinhold 6490c5b621 Fixed __HAIKU_PRI_PREFIX_ADDR definition.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34524 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-06 15:46:03 +00:00
Stephan Aßmus b8ec67f491 * Simplified and optimized a lot the "ToString()" debugging facilities.
* *::Index() is now const, thanks to the BList improvements.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34521 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-06 13:14:45 +00:00
Stephan Aßmus b0850e9ba1 * Code and header indentation cleanup
* Added operator== and !=
 * Added check for list != this in operator=
 * Added HasItem() and IndexOf() versions that take const void*, duplicating
   the code, since I didn't want to introduce another function call in these
   potentially time critical methods.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34520 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-06 12:44:38 +00:00
Axel Dörfler 2f9ed888a2 * The SharedBufferList is now only cloned once in a team, no longer once for
each buffer, and once for each buffer group.
* Also, SharedBufferList::Get() now gets the area to clone from itself, if
  necessary, the caller no longer has to provide it.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34502 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-05 11:52:01 +00:00
Axel Dörfler 9dec231042 Sorry for this large commit in advance; it's not really possible to divide this
into smaller parts:

media_addon_server:
* Removed (broken) use of (broken and inefficient) home-brewn Map, and List
  classes. This also fixes a crash on shutdown when used with the malloc_debug
  implementation. It's using stl::vector, and stl::map now instead.

_shared_buffer_list:
* Renamed _shared_buffer_list to SharedBufferList, and put it into the BPrivate
  namespace. Also, made a class out of it.
* Separated shared buffer list creation from cloning.
* Enlarged maximum number of buffers to something that is not that evil, but
  actually uses the space it has (ie. is a useful multiple of
  shared_buffer_info that fills a multiple of B_PAGE_SIZE as much as possible).
* No longer drops into the debugger if the
* The list that is currently used is very inefficient for the features it
  provides though (no change there).

_buffer_id_cache:
* Renamed to BufferCache, and put it into the private namespace
* It now deletes its buffers on deletion; since the BBufferConsumer will be
  gone, too, at this point, there is little chance that there are still buffers
  in use.
* Also, it's now using std::map instead of the (see above) Map class.

BBuffer:
* Got rid of the fBufferID member.

Misc.:
* Got rid of the global "team" variable; the media kit is now using the
  private app kit's current_team() now.
* Added a lot of missing error checks (mostly memory allocations).
* Renamed fields like "flavorid" to flavor_id, renamed "dfi_*" fields to
  something more detailed.
* Moved ServerInterface.h from src/servers/media/ to headers/private/media.
* Notifications.h was not self contained.
* Added missing licenses.
* Lots of cleanups, and coding style fixes.

What this doesn't fix:
* Bug #4954 which started all this (this comes next, though)
* Deinitialization is broken, as the PortPool is uninitialized too early, and
  still used afterwards.
* The strange add-on monitoring code in the media_addon_server


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34500 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-05 11:11:28 +00:00
Ingo Weinhold 2c1886aeae * Added VMArea subclasses VM{Kernel,User}Area and moved the address space list
link to them.
* VM{Kernel,User}AddressSpace manage the respective VMArea subclass now, and
  VMAddressSpace has grown factory methods {Create,Delete}Area.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34493 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-04 17:07:16 +00:00
Ingo Weinhold e2518ddbb1 Made VMAddressSpace an abstract base class and moved the area management into
new derived classes VM{Kernel,User}AddressSpace. Currently those are
identical, but that will change.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34492 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-04 14:45:08 +00:00
Ingo Weinhold 38a97b2c36 Moved all knowledge of reserved areas from vm.cpp to VMAddressSpace. It's a
pure address space feature, so it should be handled there.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34491 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-04 13:33:25 +00:00
Axel Dörfler 4ed344af25 * Moved _SoundPlayNode into the BPrivate namespace and dismissed the '_' prefix.
* Further cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34482 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-03 22:16:54 +00:00
Axel Dörfler 812fde99a1 * When you even already have the typedefs, why wouldn't you want to use them?
* Some cleanup, no functional change.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34474 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-03 19:48:11 +00:00
Ingo Weinhold f69032f22b * Added VMAddressSpace::ResizeArea{Head,Tail}() to adjust an area's base
and size.
* Made VMArea::Set{Base,Size}() private and made VMAddressSpace a friend.
  In vm.cpp the new VMAddressSpace::ResizeArea{Head,Tail}() are used
  instead.
Finally all address space changes happen in VMAddressSpace only. *phew*
Now it's ready to be thoroughly butchered. :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34467 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-03 15:21:18 +00:00
Axel Dörfler 751ce9e228 * Removed the interface fallback from the datalink module's is_local_address().
* Instead, added a new function is_local_link_address() which returns the
  interface with the matching link level address, and can additionally test
  for unconfigured interfaces.
* Merged the two versions of fill_sockaddr_in() together in ipv4.cpp.
* ipv4 now uses the new is_local_link_address() function to figure out whether
  the received packet should be processed or not. This should fix a few DHCP
  issues with multiple and configured interfaces as recently explained on the
  mailing list.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34466 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-03 14:31:39 +00:00
Ingo Weinhold bbd97b4bb4 Made the VMArea fields base and size private and added accessors instead.
This makes it more explicit where the fields are modified.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34464 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-03 14:18:24 +00:00
Colin Günther af983c175d Coding style cleanups. Thanks axeld.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34462 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-03 13:05:39 +00:00
Ingo Weinhold f5251d5b60 Added comment regarding use restriction.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34460 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-03 12:47:29 +00:00
Ingo Weinhold 35d940014e * Changed the address space area list to doubly linked. The reason is to
simplify migration of the area management, but as a side effect, it also
  makes area deletion O(1) (instead of O(n), n == number of areas in the
  address space).
* Moved more area management functionality from vm.cpp to VMAddressSpace and
  VMArea structure creation to VMArea. Made the list and list link members
  itself private.
* VMAddressSpace tracks its amount of free space, now. This also replaces
  the previous mechanism to do that only for the kernel address space. It
  was broken anyway, since delete_area() subtracted the area size instead of
  adding it.
* vm_free_unused_boot_loader_range():
  - lastEnd could be set to a value < start, which could cause memory
    outside of the given range to be unmapped. Haven't checked whether this
    could happen in practice -- if so, it would be seriously unhealthy.
  - The range between the end of the last area in the range and the end of
    the range would never be freed.
  - Fixed potential integer overflows when computing addresses.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34459 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-03 12:41:11 +00:00
Colin Günther 1581b764e0 * Adding static Notify{One,All} functions. This allows a cleaner implementation
of the condition variable and synchronization subsystem of the freebsd compat
  layer which will be committed next.
* Also there was a discussion about adding these functions on the commit
  mailing list. The mail in http://www.freelists.org/post/haiku-commits/r34395-in-haikutrunksrclibscompatfreebsd-network-compatsys,3
  is a good sum up of it (need to scroll somewhat down, though).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34458 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-03 12:24:17 +00:00
Ingo Weinhold f34a1dd5d7 Created VMArea.{h,cpp} and moved VMArea and the global area hash table (new
class VMAreaHash) there.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34450 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-02 19:55:59 +00:00
Ingo Weinhold e50cf8765b * Moved the VM headers into subdirectory vm/.
* Renamed vm_cache.h/vm_address_space.h to VMCache.h/VMAddressSpace.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34449 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-02 18:05:10 +00:00
Ingo Weinhold 90d870c155 * Moved VMAddressSpace definition to vm_address_space.h.
* "Classified" VMAddressSpace, i.e. turned the vm_address_space_*() functions
  into methods, made all attributes (but "areas") private, and added
  accessors.
* Also turned the vm.cpp functions vm_area_lookup() and
  remove_area_from_address_space() into VMAddressSpace methods. The rest of
  the area management functionality will follow soon.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34447 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-02 16:12:15 +00:00
Ingo Weinhold fc7864091e Attempt at allowing to use C++ structures in C only code: We use the
CreateAsmStructOffsetsHeader mechanism to generate a header with macros
defined to the sizes of the structures we're interested in and when compiling
in C mode define the structures as "struct { char bytes[size]; }".
It works in principle, but due to how jam works, one would have to specify the
dependency to the generated header for all sources that include it directly or
indirectly.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34441 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-02 10:56:10 +00:00
Ingo Weinhold a477e3cf20 Finished renaming of vm_cache to VMCache.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34424 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-01 17:45:55 +00:00
Ingo Weinhold a99eb6b56f vm_area -> VMArea
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34423 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-01 17:40:04 +00:00
Ingo Weinhold b0db552cd9 Renamed vm_address_space to VMAddressSpace.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34422 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-01 17:27:09 +00:00
Axel Dörfler ccedee2295 * Replaced rtm_* placeholders with a real implementation based on the boot
loader's heap. Unlike the BeBook documents, we always lock their memory,
  though.
* Added Haiku extension rtm_available() that returns how much space is left in
  a pool.
* I've disabled the undocumented functions for now - please open a bug report
  if you encounter them used in applications.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34419 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-01 17:21:46 +00:00
Axel Dörfler 8de72f9d58 * Cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34416 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-01 16:32:48 +00:00
Ingo Weinhold e182b46db6 Since there were no further complaints: Added mutex_lock_with_timeout().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34403 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-01 09:38:34 +00:00
Ingo Weinhold f8ec4c04a0 Initialize BRoster's MIME messenger lazily.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34402 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-01 09:36:23 +00:00
Ingo Weinhold 840be9d6e6 Added __init_once(), an almost exact clone of pthread_once(), with the
difference that the initialization function has an additional void* argument,
so that it is suitable for initializing stuff in objects.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34400 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-01 09:34:58 +00:00
Ingo Weinhold bc0693b219 * Construct the MIME data base directories lazily.
* Automatic whitespace cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34399 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-01 08:52:13 +00:00
Axel Dörfler 6bb7a8908c * Cleanup, removed author information.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34398 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-01 07:58:45 +00:00
Axel Dörfler ec1bcf6243 * Added private methods get_app_server_port() (that stores the server port,
and doesn't have to find it every time), and create_desktop_connection() that
  is now used from BApplication::_ConnectToServer() as well as the DesktopLink.
* Move PortLink::SetTo() into base class ServerLink.
* Eliminated duplicated member fReplyPort in DesktopLink.
* Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34397 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-01 07:53:09 +00:00
Ingo Weinhold 4701b640d9 * Give the BClipboard lock a name.
* be_clipboard is no longer created at libbe initialization time. The
  BApplication creates it as done in BeOS. This requires manual
  initialization in the registrar to avoid a deadlock on shutdown.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34388 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-30 17:14:00 +00:00
Ingo Weinhold 240a2c89e8 Removed no longer needed gInitializationLock.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34385 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-30 16:34:13 +00:00
Ingo Weinhold 015943d78f Use pthread_once() to guard the initialization of sPaletteConverter. This
changes the semantics slightly: Previously after a failed initialization
another invocation of InitializeDefault() could theoretically initialize the
converter. Since the only error conditions are out of memory and broken app
server connection, this shouldn't really matter, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34383 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-30 16:26:10 +00:00
Ingo Weinhold 1cbfe2ef6e Moved the static stuff into a singleton.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34376 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-30 14:43:35 +00:00
Ingo Weinhold 4b9cf09f14 * Got rid of is_running_on_haiku(). It was used for the test environment,
but wouldn't work when running it on Haiku anyway. At any rate, it was
  relatively expensive (uname()) and used already in the libbe
  initialization.
* Got rid of the non-Haiku support of main_thread_for().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34371 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-30 12:14:02 +00:00
Ingo Weinhold 879f9a0937 Got rid of the static app resources lock. We use pthread_once() now.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34370 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-30 11:54:30 +00:00
Ingo Weinhold adcb834590 * The WidthBuffer lock was unnecessarily static. Made it an object member.
* Automatic whitespace cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34367 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-30 11:25:13 +00:00
Ingo Weinhold 4ac097c559 Made the BToolTipManager lock non-static. Create the singleton via
pthread_once().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34366 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-30 11:06:51 +00:00
Ingo Weinhold 258b34c594 * Fixed wrong parameter of lazy_mutex_destroy().
* Split locks.cpp into mutex.cpp, recursive_lock.cpp, and rw_lock.cpp (new
  subdirectory locks/).
* runtime_loader no longer includes the rw_lock, allowing removal of the TLS
  dependency again.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34364 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-30 10:29:51 +00:00
Colin Günther 53b11310d4 Needed header to allow compilation of the wlan stack.
Bosii is a transcription of 802.11. It is a work-in-progress title to
point out parts of the wlan stack which are still in an experimental state.
For example the control codes within bosii_driver.h are moving targets.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34349 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-29 18:09:33 +00:00