Commit Graph

402 Commits

Author SHA1 Message Date
Axel Dörfler
11add5a5d7 First baby step towards a lockless get_memory_map(): vm_get_current_user_address_space()
no longer needs to lock address space hash table - that also makes the lookup much
faster, too (and a direct pointer is used instead of a hash lookup).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17246 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-04-27 17:46:19 +00:00
Axel Dörfler
4827dbe47a Fixed a bug in the VFS that could cause BFS to corrupt an inode:
dir_remove() did not normalize the path, and thus, could forward a "." as
name for the removed directory - which BFS didn't catch because it assumed
our VFS would work correctly...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17165 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-04-18 17:40:27 +00:00
Axel Dörfler
a88c592fb3 Instead of ending up in an endless loop, fs_sync() will now bail out in
case get_vnode() fails.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17162 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-04-18 14:50:36 +00:00
Axel Dörfler
fde87a1094 Instead of waiting forever, get_vnode() will now fail after 3 seconds if the
vnode is not becoming unbusy (right now it even panics, but that can be removed
later on).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17161 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-04-18 13:55:47 +00:00
Axel Dörfler
80fda87e9c find_thread() now returns B_NAME_NOT_FOUND when it doesn't find the thread
as stated in the BeBook - this fixes bug #458 as Tracker directly compared
with that error code.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17144 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-04-16 17:53:10 +00:00
Axel Dörfler
b2536cb5d6 Fixed bug #483:
* vfs_get_fs_node_from_path() now also work for absolute paths again (but
  still for relative ones from the volume root) - it just tests if the
  mount IDs fit, so it only returns successful if the path really is on
  the desired mount.
* the Disk Device Manager publish functions now call devfs_publish_*()
  correctly (by omitting the "/dev/" mount point).
* devfs_publish_partition() now accepts absolute device paths but relative
  partition paths.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17138 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-04-16 11:44:54 +00:00
Michael Lotz
b026647574 Changed the temporary buffer to be static to avoid using that much stack. Replaced wrong maximum buffer length (oops).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17137 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-04-16 10:56:00 +00:00
Michael Lotz
1df23ecc52 Should finally fix the eaten up messages. We obviously must not use the output buffer to write the repeat count as the output buffer already contains the new message...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17131 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-04-14 12:38:31 +00:00
Axel Dörfler
9a11448fbd vfs_get_fs_node_from_path() didn't work correctly and ignored the mount_id
(ie. it only worked for absolute paths, but it shouldn't work for those at
all).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17127 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-04-13 18:06:30 +00:00
Axel Dörfler
97e069713b Added a "reenter" parameter to the {read|write}_pages() functions to give file
systems a chance to know if they have locked already.
This fixes a locking problem in BFS where one thread tried to acquire two read
locks (where someone else trying to acquire a write lock would have caused a
dead lock).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17108 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-04-12 13:34:04 +00:00
Michael Lotz
2f5143505b Another try at removing the "Last message repeated 1 times.", this time with locking.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17099 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-04-11 21:11:50 +00:00
Michael Lotz
6ac6b512a0 Reverted my last change as it causes a segfault with syslog output enabled.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17094 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-04-11 19:40:49 +00:00
Axel Dörfler
8645479b36 * cache_io() could insert a second page at the same position in the vm_cache
since it unlocked the cache while waiting on a busy page. Now, we're filling
  the pending request before unlocking the cache.
* Fixed the deadlock I mentioned in the last commit: if a page fault happens
  at the same time we're trying to read/write from/to a page, we no longer
  fight for the BFS inode lock, but eventually doing the job twice if needed.
  Will need to go over the "write modified" functions to make sure they are
  behaving as well.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17091 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-04-11 18:48:04 +00:00
Axel Dörfler
be891a5e5d No longer counts "\n" as repeated string - this seems to fix at least the cases
where I noticed missing debug output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17090 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-04-11 18:40:46 +00:00
Michael Lotz
d7faea3f20 Replaced "Last message repeated 1 times." with just reprinting the message (requested by Jerome Duval).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17060 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-04-10 21:28:43 +00:00
Axel Dörfler
675c19c9cf * fs_sync() and free_vnode() now use the file system's fsync() hook to write back
changes made to a file instead of directly using vm_cache_write_modified() -
  besides making the file system more independent from the file cache, this also
  works around a possible dead lock (that is to be fixed in a later commit).
* fs_sync() no longer uses vnodes from the mount's vnode list directly to write
  back the changes made to them, but gets them via ID instead - this makes sure
  the vnode is in a valid state and fixes a race condition with free_vnode().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17059 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-04-10 21:22:24 +00:00
Michael Lotz
f51fb4696c Corrected the repeat checks (did not compare the right buffers) and added a length argument to debug_puts() to safe the strlen in the syslog case. Also removed some leftover.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16991 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-04-03 20:48:30 +00:00
Michael Lotz
3647d70ded Replaced the hash based approach to repeat detection with the probably more efficient strncmp.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16970 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-04-02 16:45:04 +00:00
Michael Lotz
3352a462a7 Implemented the "Last message repeated x times." thing in the kernel (hash based).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16968 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-04-02 16:23:47 +00:00
Axel Dörfler
af3e5cd947 Renamed our runtime loader from rld.so to runtime_loader, and moved it into beos/system/.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16936 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-30 18:08:51 +00:00
Axel Dörfler
2a62d0d6c5 Added a second pass to the boot device retrieval in case nothing has been found.
Right now, the size of the device is ignored in the second pass. Maybe this helps
with bug #357.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16917 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-29 00:16:57 +00:00
Axel Dörfler
606e0d364e * Factored out the vnode disconnection code from fs_unmount() to a separate
function, and added a vfs_disconnect_vnode() for other kernel components.
* devfs_unpublish_device() can now optionally make use of this call.
* Fixed the type check of devfs' unpublish_node().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16907 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-28 01:13:12 +00:00
Axel Dörfler
065aa7f66c Added a basic unpublishing function for drivers, not yet tested, though (and even
though it looks so simple, I see no reason why it shouldn't work 8-)).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16906 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-28 00:13:44 +00:00
Axel Dörfler
fabe8c62ff The kernel boot code now supports the unknown bus/device method to identify the
boot volume. The other (better) methods are now disabled in the boot loader.
This fixes bug #241.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16895 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-27 17:01:10 +00:00
Axel Dörfler
d140fed68f Turned off some debug output, the device tree is no longer dumped (was a partial
tree only, anyway, as it was dumped before the recognition of any devices).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16893 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-27 15:14:30 +00:00
Axel Dörfler
c918a987a0 * Removed my old doubly linked list implementation, and stay with Ingo's.
* Adapt other sources where needed (the boot loader's RootFileSystem still
  used the old implementation).
* Implemented RootFileSystem::Rewind().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16889 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-27 10:27:05 +00:00
Axel Dörfler
7d2fafcac5 Forgot even more debug output...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16882 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-26 18:45:54 +00:00
Axel Dörfler
61106f7e86 Forgot to remove some debug output.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16881 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-26 17:11:43 +00:00
Axel Dörfler
c14a34a65f * Improved kernel ELF loader (and made it more similar to the one from the boot
loader): it now supports holes between segments, and accepts any segment order.
* Renamed elf.c to elf.cpp and fixed warnings.
* Renamed elf_image_info::dynamic_ptr and eheader to dynamic_section and elf_header.
* Some cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16878 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-26 15:58:43 +00:00
Axel Dörfler
342c2a73ab Improved debug output.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16871 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-24 21:27:01 +00:00
Axel Dörfler
5ba2a3839d Improved the filter capabilities of the "ports", "port", "sems", and "areas" debugger commands.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16870 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-24 12:59:23 +00:00
Axel Dörfler
db823da57e * Even though our current heap is a temporary solution, the heap size depends
now on the amount of memory installed in the system. Ie. if you have only
  128 MB the kernel heap will be only half in size.
* Minor cleanup in vm_page.c, renamed some variables to match our style guide.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16838 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-19 15:02:21 +00:00
Axel Dörfler
5f0bf2a3e1 We now track how many pages are in a vm_cache. Therefore, the area_info.ram_size
now reflects the number of pages in the areas cache, instead of just the size of the
area.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16834 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-18 20:17:31 +00:00
Axel Dörfler
66b7a0f477 Renamed the _kern_init_heap_address_range() syscall to _kern_reserve_heap_address_range()
and made it more powerful.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16825 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-18 12:52:01 +00:00
Axel Dörfler
c864c43bab Fixed warning I just introduced.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16793 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-14 20:29:50 +00:00
Axel Dörfler
baf7b0adf0 Broke the build once more: didn't remember that gettimeofday() was built
for the kernel as well, and thus we need to export _kern_get_timezone(),
too.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16792 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-14 20:22:50 +00:00
Axel Dörfler
f46bdd1c9a Added a _kern_get_timezone() syscall that can be used without needing to
re-evaluate the timezone file over and over.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16785 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-14 14:29:56 +00:00
Axel Dörfler
33dd85501f Minor cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16784 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-14 14:27:59 +00:00
Axel Dörfler
5d35aa2833 I don't think kill_thread() is actually supposed to wait for the thread
to be killed. Reverted ShutdownProcess.cpp to continue to use kill_team()
instead of sending a signal.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16780 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-14 01:54:49 +00:00
Axel Dörfler
51aacbbb39 * open_module_list() put the wrong base path length onto the stack, and thus,
no on-disk modules could be found... (since revision 16584).
* iterator_get_next_module() now makes use of the KPath features, and doesn't
  build the new path manually anymore.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16745 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-12 19:48:28 +00:00
Axel Dörfler
b0976eac74 * Reduced the effects of "priority boost on sem release" to a minimum;
the thread priority is now increased by one, we'll see how that turns
  out for real (I'm not even convinced that this feature is a good idea
  at all yet).
* Enabled debugging the last semaphore acquirer by default.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16744 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-12 17:24:31 +00:00
Axel Dörfler
6d24fdc557 Better means to debug apps that try to acquire kernel semaphores.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16695 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-10 23:55:50 +00:00
Axel Dörfler
abb84c7d51 Removing the nodes from the unused list in fs_unmount() had the side effect that
the root vnode was tried to be removed as well (which resulted in a crash).
Since playing with the root node reference count is a bad idea anyway and opens
a big race condition (with regards to the unused list), we no longer do that
now, until it's safe.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16665 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-08 22:57:53 +00:00
Axel Dörfler
17372b761e * If there are no free ranges left, the block cache will now reuse older
blocks - this is not enough, though as it would also need to ask other
  volumes to free ranges.
* Increased the number of blocks to free in case of low memory.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16663 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-08 21:43:45 +00:00
Axel Dörfler
f951ca0e6a Fixed a couple of bugs:
* fs_unmount() freed vnodes, but didn't remove them from the unused list if
  needed.
* vfs_get_module_path() could put a vnode twice under several situations.
* vnode_path_to_vnode() now always puts the dir vnode, even if the provided
  path is NULL. Documented the fact that it does eat the ref, too.
* Added a to-do item in vfs_get_vnode_cache() about a possible problem.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16662 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-08 21:42:14 +00:00
Axel Dörfler
4d664f91ca * Closing a port now also deletes the port's semaphores, so that a pending write_port(),
read_port() or port_buffer_size() will fail immediately.
* Made the functions above plus port_count() support this new way of closing
  a port.
* All of Marcus's port tests now succeed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16655 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-08 17:09:20 +00:00
Axel Dörfler
33a9adb376 * Added a wait_for_thread_etc() function that allows specifying semaphore flags
and a timeout.
* _user_wait_for_thread() was not interruptible before, ie. Control-C wouldn't
  work.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16654 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-08 16:41:03 +00:00
Axel Dörfler
457c814fdc read_port() and port_buffer_size() will now fail with B_BAD_PORT_ID when called
on a closed port with no messages left.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16647 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-08 15:08:48 +00:00
Axel Dörfler
311bcf391f Fixed a possible deadlock I've introduced earlier (since create_sem() calls
vfs_free_unused_vnodes()); the vnode mutex is now hold for much shorter times
only:
* Rewrote advisory_locking creation/maintenance to hold the vnode mutex only
  for very short times.
* the vnode mutex is no longer held during file cache construction; instead,
  the vnode is marked busy.
* Implemented an (incorrect for now) get_advisory_lock()


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16635 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-07 20:40:38 +00:00
Axel Dörfler
b4499305c7 vm_cache_resize() could remove one page too many, and thus eventually free
a modified page that mustn't be removed. This fixes bug #110.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16613 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-03-06 22:28:40 +00:00