Commit Graph

1458 Commits

Author SHA1 Message Date
Ingo Weinhold
ad3a563d43 create_special_node() supports creating a special node without entry,
now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24822 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-06 02:44:37 +00:00
Ingo Weinhold
3af6d6a43a Commented out some debug output. The sources will be reworked soon.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24821 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-06 02:42:18 +00:00
Ingo Weinhold
9583c41d8a Added TODO regarding potential deadlock.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24820 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-06 02:35:07 +00:00
Ingo Weinhold
d4016ffdbb * A pipe can now be inactive and active. After creation it remains
inactive until at least one reader and one writer have opened it. As
  long as it is inactive, reads from and writes to it just block. When
  active, they behave as before (if there's no counterpart writes fail:
  SIGPIPE + EPIPE, reads return 0). When both reader and writer count
  drop to zero, the pipe becomes inactive again.
* Allocate the ring buffer lazily when the pipe becomes active and
  delete it when it becomes inactive.

This makes the pipe implementation FIFO compatible. IOW, FIFOs work as
expected as far as I've tested them.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24819 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-06 01:40:01 +00:00
Ingo Weinhold
a8cba5904f The rootfs was calling remove_vnode() on nodes for which it might not
have had a reference.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24818 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-06 00:27:36 +00:00
Ingo Weinhold
717705d816 We get a reference to the node from create_special_node(), so we have to
release it.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24817 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-06 00:26:15 +00:00
Ingo Weinhold
7ffafac8d7 * Reorganized the FS interface a little:
- Moved most file_system_module_info hooks into separate structures.
    Those that operate on mounted volumes to fs_volume_ops, those
    operating on a vnode to fs_vnode_ops.
  - Got rid of the fs_volume, fs_cookie, fs_vnode typedefs. We use void*
    again.
  - Instead of a void* volume and node cookie hooks are passed a
    fs_volume and fs_vnode structure pointer, which contain the cookie
    and an ops pointer (fs_volume a few more things).
  - The VFS {new,publish,get,...}_vnode() functions take a fs_volume*
    instead of the volume ID. So does vfs_get_fs_node_from_path().
  - Added type and flags arguments to publish_vnode() and the
    get_vnode() hook and removed the type argument from lookup() hook.
    Added vnode::type using formerly unused bits to store the node type.
    Simplified a few things in the VFS due to the now always available
    node type.
  - Added fs_volume_ops::{create,delete}_sub_vnode() and
    fs_vnode_ops::get_super_vnode() hooks. They are used to support file
    system layers, e.g. allowing to extend an FS not supporting BeOS
    attribute with attribute support. Needs some more work in the VFS.
  - Added fs_vnode_ops::create_special_node() hook for creating special
    nodes (e.g. FIFOs).
* Adjusted the built-in file systems and BFS according to the interface
  changes. Removed all other FSs from the image for the time being.
  We'll see whether further API changes are necessary before porting
  them.
* Adjusted the bfs_shell accordingly.
* Implemented create_special_node() in rootfs to support special nodes.
* Added support for FIFOs:
  - Added syscall _kern_create_fifo() (used by mkfifo()), which creates
    a special node (type S_IFIFO) in the respective file system.
  - When a special node is published the VFS creates a respective sub
    node. Currently only FIFOs are supported.
  - Added a little support for FIFO subnodes by using functionality from
    the pipefs.
  - Added mkfifo to the image. It can create FIFOs in the rootfs, but
    the FIFOs aren't really usable ATM, since they still work like
    pipes, i.e. readers and writers need to have them open at the same
    time.
* Some smaller changes in the VFS:
  - Made the *_CALL macros nicer to use (vargs).
  - Refactored FS entry lookup into new function lookup_dir_entry().
  - create_vnode() no longer just calls the FS create() hook. First it
    looks up the entry and uses open_vnode(), if it already exists. This
    is necessary for two reasons: 1) The FS might not support create()
    while still allowing to open() entries. 2) When the FS has other
    layers on to of it (or the respective node) it might not be
    responsible for opening the node.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24816 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-05 23:05:16 +00:00
Michael Lotz
5d7ee5e84a * Replace the path based lstat in the device watcher with the new device/node
based one. The path based version could not have worked for entry removed
  notifications at all as the node is removed from the directory at this point
  already
* Forgot to delete the device watcher instance after removing all monitors
* The PartitionRegistrar in DeleteDevice() was set to already locked which is
  not the case
* Someone probably forgot to add a PartitionRegistrar to the media checker - it
  did register the device on each run but never actually unregistered it, which
  obviously messed up the reference counting a bit

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24815 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-05 22:08:47 +00:00
Michael Lotz
efb965d559 Introduce vfs_stat_entry_ref() that allows to stat a vnode based on a dev_t
and ino_t instead of a path. Supposed to work with node monitoring messages.
Took the name from vfs_entry_ref_to_path() that takes the same arguments, but
suggestions for a better name are welcome.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24813 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-05 22:01:05 +00:00
Stephan Aßmus
d0fc7c65c6 Patch by Philippe Saint-Pierre:
* Implemented RLE compression for the boot splash images, resulting in
  smaller kernel and boot loader.
* Only the boot loader contains the RLE compressed images, the decompressed
  buffer for the icons is passed to  the kernel via kernel args.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24812 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-05 21:15:43 +00:00
Axel Dörfler
98b7d71b7c The wait_for_notifications() function now detects if it has been run from
within the notifier/writer thread, and will then flush the notifications
directly. This should fix #2008 again.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24806 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-05 10:23:11 +00:00
Stephan Aßmus
75ab36bd50 Refined again the boot splash artwork. Everything is now centered as a whole.
The dividing line is back although with a little more spacing. Also the icon
spacing is a little increased and I added a subtle outline as well as a little
brighter background for the active icon look. The placement logic is now not
independant of each other anymore, otherwise I couldn't center both images
as a unit. But only the vertical placement is affected.
Comments as always on the commit mailing list... :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24796 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-04 19:13:00 +00:00
Axel Dörfler
7686d00c6f * This should fix a deadlock as reported by bga.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24793 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-04 15:11:37 +00:00
Axel Dörfler
807d3aa8e3 * If BFS's Journal::_WriteTransactionToLog() noticed there wasn't enough free
space left for the new log entry, it did call cache_sync_transaction(), and
  then just assumed the space would be ready. But since the transaction could
  have been written before that call by the block writer, and since the
  _TransactionWritten() hook is now called asynchronously,
  cache_sync_transaction() actually has to flush all pending TRANSACTION_WRITTEN
  notifications before returning to the caller.
* To implement this, block_cache now publishs a condition variable, and
  wait_for_notifications() adds a fake notification that signals that one.
  Since the notifications are handled in FIFO order, this guarantees that
  the previous TRANSACTION_WRITTEN hook is done.
* notify_transaction_listeners() could accidently delete notifications that
  still had pending signals. Now, it will defer the deletion to the notification
  thread instead in that case. This should fix bug #2008.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24792 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-04 14:02:30 +00:00
Michael Lotz
06da81f012 Implement node monitoring in the kernel disk device manager.
* Added {Create|Delete}Device() analogous to {Create|Delete}FileDevice
* Added a small DeviceWatcher class that reacts to entry creation/removal
* Implemented a way to start/stop node monitoring
* Start watching for devices after the boot volume has been mounted and the
  the second initial scan was run

The disk device manager now creates and scans a device when a "raw" node is
published and deletes the device on removal. This makes hot-plugging of disk
devices (for example memory sticks using usb_disk) work. Their partitions will
be scanned and published so they can be mounted. Somehow the removal of the
partitions does not yet work however, any insights are welcome.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24777 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-03 18:14:11 +00:00
Stephan Aßmus
64379118a9 * Revised boot splash artwork, the logo is back in the lower right corner,
the icons are centered.
* The boot loader and kernel now use the placement info that
  generate_boot_screen now generates.
* Made the code that draws the images handle the case where any of the images
  is larger than the frame buffer.
* All drawing functions need to know the image width (analogous for bytes per
  row).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24773 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-03 14:24:10 +00:00
Axel Dörfler
9a87228642 * Removed the "transaction_changed" leftover member.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24769 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-03 11:22:14 +00:00
Axel Dörfler
816957bd74 * Decoupled notifications from the block cache functions; they are now
called without having the cache's lock held.
* The only downside to this approach is that ending a transaction now needs
  additional memory, and might therefore fail - that could be fixed by
  allocating that memory upfront with the start of the new transaction,
  though.
* Therefore, I reverted the cache lock to a benaphore, as the recursive
  lock is no longer needed.
* The block writer thread is now a block writer and notifier thread: it will
  wait for up to 2 seconds on the sEventSemaphore, and if nothing comes in,
  it will continue with its previously sole job.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24768 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-03 11:21:00 +00:00
Axel Dörfler
025b367502 * Renamed publish_node() to new_node().
* Introduced a new publish_node() which then actually publishs the node,
  similar to the VFS's new_vnode(), and publish_vnode() semantics.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24762 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-03 08:24:50 +00:00
Ingo Weinhold
a5140cad6a cache_end_transaction() doesn't remove the transaction, so that the
check in notify_transaction_listeners() didn't hold, although the
cache_hooks were deleted anyway. I've introduced a listener_change
counter to detect changes to the listener list while iterating, since
any change makes the iteration unsafe. Should fix bug #2008 for real.
Nevertheless I thing the transaction listener concept needs revision.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24761 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-03 02:24:46 +00:00
Michael Lotz
3130aa793d Change the NodeMonitorService lock from a mutex to a recursive_lock. This
allows event listeners to add new listeners inside a node monitoring event
(i.e. if one wants to add a listener for the entry that has just been created
and triggered the current notification).

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24760 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-02 23:20:37 +00:00
Michael Lotz
2509807a53 Change publish_node() of the devfs to not insert the node into the directory.
Instead return the directory vnode, so the calling function can insert it after
all vnode initialization is done. Otherwise entry created notifications are
sent upon inserting the node into the directory for vnodes that are not yet
fully initialized (i.e. they have no type or the device hooks are not yet set).
That would cause for example ioctls to fail when someone would react to a
notification of a newly created device.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24759 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-02 23:07:22 +00:00
Axel Dörfler
38c4c33487 * A notification can cause a transaction to be deleted - in this case, the
block_writer() as well as notify_transaction_listeners() must update their
  data or quit. This fixes newly introduced bug #2008.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24749 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-02 13:51:34 +00:00
Axel Dörfler
4f5bc0cfe9 * Reenabled used page reporting based on vm_available_memory().
* Prettyfied memory info in the sysinfo app.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24746 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-02 12:47:08 +00:00
Axel Dörfler
6b53669383 * Renamed vm_get_available_memory() to vm_available_memory() to fit better
into our usual naming scheme.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24745 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-02 12:30:06 +00:00
Axel Dörfler
129d25e0da * Removed old /bin/init startup code - it hasn't been needed for ages anymore.
* Some cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24743 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-02 12:27:25 +00:00
Axel Dörfler
62f892990b * Fixed several occasions of bugs with respect to the handling of
overcommitting stores:
  - has_precommitted was incorrectly set to true in the constructor
  - when a precommitted page was committed, vm_store::committed_size
    was still changed.
  - unreserving memory did not update vm_store::committed_size.
  - when precommitted pages were committed, their page count instead of their
    size was reserved.
* All this lead to bug #1970 which should be fixed now.
* Cleanup of vm_cache.cpp, no functional change.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24742 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-02 12:19:28 +00:00
Axel Dörfler
0aee496bd0 * block_cache_private.h is no longer needed, moved its contents into
block_cache.cpp.
* Fixed warning.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24739 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-02 10:44:08 +00:00
Axel Dörfler
16d8ff2dad * Added a TRANSACTION_IDLE notification that is sent when the transaction
hasn't been used for more than 2 seconds.
* Replaced the block_cache::lock benaphore with a recursive lock, so that
  you can call cache functions from within the notification listeners.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24737 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-02 09:37:22 +00:00
Ingo Weinhold
de73100825 Also check whether the supplied vnode is a directory, if there's only
one path component.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24736 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-02 01:55:37 +00:00
Ingo Weinhold
0cc0b6fc8f * Fixed resolution of symlinks path components, broken since
r24721/r24722. After resolving a symlink we weren't updating the local
  type variable to the type of the link target, so that the directory
  check in the next iteration would always fail.
* Added TODO.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24735 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-02 00:51:43 +00:00
Axel Dörfler
ebe5326de3 * Minor cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24724 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-01 18:21:47 +00:00
Axel Dörfler
b987779d7f Revised my previous patch as outlined in the previous one:
* No longer checks for the path delimiter twice.
* Now also checks if the first part of the path is a directory.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24722 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-01 17:59:51 +00:00
Axel Dörfler
6800e4f8ba Reverted r24720, and at least fixed the problematic return code after the
first loop - the vnode passed in would still need to be checked, though.
Eventually, it would be nice to move the check to the top, though, so that
we don't need to search for the patch delimiter twice.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24721 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-01 17:39:52 +00:00
Bruno G. Albuquerque
b48c7f231a - vnode_path_to_vnode() now returns B_NOT_A_DIRECTORY instead of B_NOT_ALLOWED
as expected by POSIX programs. This allowed be to compile Haiku under itself
  without any hacks at all, so I guess this means that now we are officially
  self-hosting!



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24720 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-01 15:38:01 +00:00
Axel Dörfler
10f0fc8f20 * Implemented sigwait().
* Not sure if it works as intended, as the specs are a bit vague.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24717 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-01 12:15:14 +00:00
Ingo Weinhold
32122dc5c4 * Since writers also might have to wait when there is still some room
in the buffer, they need to be notified after a read when their
  minimal write size requirement has just become satisfied. We were
  notifying only when there was no space in the buffer before, which
  caused bug #1755.
* Removed Inode::NotifyWriteDone(). It's not needed anymore, since we
  don't queue writers. They are always all notified, so that one doesn't
  have to notify the next one, when it's done.
* Renamed *Request* to *ReadRequest, since we do have WriteRequests now
  as well.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24701 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-30 22:35:41 +00:00
Ingo Weinhold
9fe0705bee My previous change to getgroups() broke the getgroups(0) special case,
which e.g. "awk" didn't like.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24691 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-30 20:02:38 +00:00
Jérôme Duval
7522f3082d reduced MTRR min size to 512KB
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24679 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-30 14:25:01 +00:00
Axel Dörfler
6328832fba * Changed get_boot_item() API: it now also can retrieve the size of the boot
item entry.
* The bios_ia32 video platform code now stores the available VESA modes in
  the new vesa_modes kernel_args field.
* When configuring a VESA mode via settings file, it's no longer needed to
  specify the exact mode - the closest available mode is now used. This should
  help with bug #1962.
* frame_buffer_console_init() now also creates a boot_item for the VESA modes
  in the kernel_args.
* The VESA accelerant now filters the mode list to only contain modes that
  are actually supported.
* Moved non-shared vesa driver data into its own file vesa_private.h.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24675 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-30 11:01:41 +00:00
Ingo Weinhold
360be1fc45 * Implemented support for chroot:
- Added a "root" vnode to the io_context. It is used for resolving
    paths and converting nodes to paths instead of sRoot. Some more
    passing around of io_context structures was necessary.
  - Introduced a new lock sIOContextRootLock to protect
    io_context::root. The current uses of io_context::io_mutex
    (put_vnode(), remove_vnode() while holding it) looked too suspicious
    to use that mutex in vnode_path_to_vnode().
  - Added _kern_change_root() syscall and chroot() libroot function.
  - Added chroot coreutils program to the image. Funnily it seems to be
    much easier to set up a little jail than under Linux (just copy
    bash and libroot.so into respective subdirs; mount another pipefs
    if you want pipe support).
    With Haiku allowing direct access to directories via inode IDs
    jailing is obviously not very secure at the moment.
  - Added /var/empty to the image. It will be the chroot target for ssh.
* Changed vfs.cpp:get_cwd() so that the io_context::io_mutex is no
  longer held when calling dir_vnode_to_path().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24673 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-30 05:59:54 +00:00
Ingo Weinhold
290946ce80 * Implemented some basics for supplementary groups support:
- The kernel stores the group IDs in the team structure. They are
    correctly inherited on fork() and load_image_etc().
  - Implemented getgroups() for real, i.e. it retrieves the groups
    associated with the process.
  - Implemented setgroups(), initgroups() and (the BSDish)
    getgrouplist(). The latter two read the group information from the
    "group database" /etc/group (if existing).
  - Change the BIND port config, since we do have getgrouplist() now.
* The set-uid feature was broken when the path to the executable was
  relative, since we used stat(), which, in the kernel, uses the kernel
  IO context.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24669 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-30 00:08:13 +00:00
Ingo Weinhold
8c117a6d88 Added function vfs_read_stat() that also allows for stat()ing files in
the user IO context from within the kernel.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24667 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-29 23:57:34 +00:00
Ingo Weinhold
3bef7d0252 Added functions malloc_referenced[_{acquire,release}]() that implement
reference counted memory allocations. Can be used for sharing immutable
structures.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24666 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-29 23:55:34 +00:00
Axel Dörfler
a7f6ff0ff8 * Applied patch by Vasilis that updates the doxygen comment style.
* Shuffled functions around to separate the private from the public API.
* Renamed global static io_vectors to sVectors.
* Rearranged includes, replaced deprecated malloc.h with stdlib.h.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24640 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-29 12:01:57 +00:00
Rene Gollent
153cc3c0f4 Use the old calculations for used_pages for the time being until the issue with sAvailableMemory is resolved.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24615 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-28 04:57:49 +00:00
Ingo Weinhold
82d444a25e Changed the page allocation tracking history to kernel tracing instead.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24614 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-27 23:13:01 +00:00
Ingo Weinhold
989a6e05ec Made kernel tracing safe to be used right after it has officially
been initialized.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24613 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-27 23:10:22 +00:00
Jérôme Duval
9fcee65eaf take into account areas starting or ending equally
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24612 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-27 22:31:42 +00:00
Ingo Weinhold
071f9c3aa2 Build configurations shouldn't be done in svn controlled files, so I
finally created a solution to avoid that: Header files that contain
configuration settings (and nothing else) go to build/config_headers.
To change settings, create a directory build/user_config_headers (which
is ignored by svn), copy the respective header there and modify it at
your leisure. Currently only tracing_config.h has been moved to the new
location, but more files will follow eventually. It is also recommended
to move optional macro definitions in Jamfile (as for BFS) to a config
header instead; the build system will then automatically rebuild on
changes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24611 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-27 22:01:38 +00:00
Axel Dörfler
9e79133f4d * Reverted r22315 as far as free_vnode() is concerned: removing the
vnode from the hash before putting it caused all sorts of problems.
* For example, BFS would trim its preallocations when the vnode is put;
  if someone would read that same vnode after it had been removed, but
  before BFS could trim it, it would read the old vnode which still 
  seemed to own the blocks which would subsequently be freed.
* This fixes bug #1914, and should also fix bug #1956.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24607 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-27 09:48:33 +00:00
Axel Dörfler
14438ad555 * write_cached_block() now moves a block to the unused list when it's
not referenced and clean (is no longer part of a transaction).
  This finally gets memory consumption to a moderate level; even 
  unpacking a large archive will no longer eat all memory.
* The "block_cache" KDL command will now print the number of unused
  blocks as well.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24606 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-27 09:38:53 +00:00
Ingo Weinhold
332e24fb43 Fixed a quasi-livelock in steal_pages() as proposed in ticket #1929.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24605 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-27 05:42:43 +00:00
Jérôme Duval
395880e0a9 we should really check whether the devices are used before reloading the driver
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24597 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-26 20:51:02 +00:00
Axel Dörfler
758962ec3b * Added arch_debug_contains_call() function that returns wether or not
a call chain contains a specific symbol (or address).
* Added a new KDL command "calling" that you can use to get a list of
  threads that have a specific function in their call chain.
* Removed extraneous white space.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24594 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-26 17:08:51 +00:00
Axel Dörfler
c32f787401 * Added new KDL command "string" that dumps a string given a pointer.
* Use parse_expression() where appropriate.
* Removed extraneous white space.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24593 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-26 16:21:33 +00:00
Axel Dörfler
5dafcc2b1b * Added new "symbol" command which is able to search for a symbol that
matches the specified pattern in all loaded kernel images.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24592 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-26 16:10:06 +00:00
Axel Dörfler
dc1a7867e0 * Added new pattern filters d#<expr>, x#<expr>, and s#<expr> which
set the actual pattern as "%d", "%x", and "%s" of the expression
  after '#' respectively. They are very slow, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24591 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-26 16:08:28 +00:00
Axel Dörfler
e77b684f9e * Added very basic possibility to set a filter for all KDL command
output using the new "filter" command.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24590 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-26 16:05:21 +00:00
Axel Dörfler
3bb1e6c264 * The block_cache KDL command now sets some useful variables.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24589 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-26 14:38:35 +00:00
Jérôme Duval
cd9ce121d9 now checks if another mtrr range is extended by a new one and extends it
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24582 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-25 20:55:12 +00:00
Axel Dörfler
c12ed8563a Fixed warning.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24581 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-25 20:29:49 +00:00
Axel Dörfler
cd31b326a3 * The "block_cache" command checked the wrong variable to see if a block
could be found or not, eventually resulting in a read fault.
* It now also uses parse_expression() for its second argument, since it
  now returns an uint64 in Haiku.
* Tracing output cut off the label too early.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24579 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-25 19:21:01 +00:00
Axel Dörfler
41f8d41647 Applied patch by Rene Gollent:
* Add a cached_pages field to the system_info structure, and change the
  meaning of the used_pages field to not include cached pages.
* Provide the needed info using the new calls vm_get_available_memory(),
  and vm_page_num_available_pages().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24571 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-25 11:51:45 +00:00
Axel Dörfler
a121b8c83c * Added a new flag for write stat: B_STAT_SIZE_INSECURE that allows a
file system to not fill newly created space with zeros. 
  BFile::SetSize() now uses this, while [f]truncate() does not. This
  is only a temporary work-around until BFS supports sparse files.
* Apps that want to reserve space to fill up later should use 
  BFile::SetSize() for now, as this will be a lot faster than 
  [f]truncate().
* cache_io() and the functions below now use a special mode when you 
  pass in a NULL buffer: for read access, the cache is only populated
  (useful for prefetching), for write access, the file is filled with
  zeros.
* Implemented BFS's Inode::FillGapWithZeros() using this method now.
* Removed extraneous white space.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24555 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-24 13:39:02 +00:00
Axel Dörfler
5e2ef462ec * Got rid of the duality of FS_WRITE_STAT_* vs. B_STAT_* flags (removed
the former ones).
* Removed extraneous white space.
* net_server settings are now also updated when the size of the 
  file changed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24552 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-24 12:04:47 +00:00
Ingo Weinhold
0956fd0502 Applied change proposed in #1917 after encountering the bug the third
time. Releasing the cache's store reference while holding the cache lock
could reverse the usual locking order -- the VFS could potentially call
the remove_vnode() or put_vnode() FS hook, which in turn could use the
file cache, thus resulting in a deadlock. Now we release the store ref
before locking the cache.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24548 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-24 05:15:42 +00:00
Rene Gollent
77570fb545 Disable tracing.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24545 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-24 01:02:59 +00:00
Rene Gollent
612ab37d12 _user_set_tzfilename now correctly updates the system RTC offset. This
makes switching between GMT and local time in time prefs work correctly
without requiring a reboot to recalculate the clock.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24544 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-24 01:01:51 +00:00
Bruno G. Albuquerque
7a66a9b8e4 - Added support in system info for extended cpu family and model.
- Take extended family and model into account when generating the cpu
  type and revision.
- Added Intel Core 2 Extreme to the cpu list.

Please review.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24509 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-21 16:44:05 +00:00
Rene Gollent
0026580104 Leave tracing disabled by default though.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24497 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-21 03:32:28 +00:00
Rene Gollent
7f9a9ff612 Fix broken TRACE statement.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24496 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-21 03:31:55 +00:00
Jérôme Duval
e958cea514 now fails if a write combining overlaps
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24494 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-20 22:12:28 +00:00
Axel Dörfler
a886f802fc * Added debug_screen_output_enabled() function.
* The boot splash code now checks wether debug screen output is enabled or not
  using the above function.
* The boot splash code no longer maps it's own copy of the frame buffer, instead,
  it will use the boot item feature as the VESA driver does. Also removed the
  lock, as that's not needed at all.
* Renamed splash.cpp to boot_splash.cpp, and boot/splash.h to boot_splash.h
  (it's not part of the boot loader, but the kernel).
* Removed dead code from boot_splash.cpp, added license. Replaced license
  header in boot_splash.h to a style guide conforming one.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24489 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-20 11:10:17 +00:00
Axel Dörfler
4495cd43c1 * Fixed warnings, mostly due to NULL changes.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24487 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-20 11:04:45 +00:00
Jérôme Duval
eb258077e7 added --help support for devfs_node debugger command
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24482 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-19 23:02:30 +00:00
Jérôme Duval
957d7d0732 added help support for devfs_driver debugger command
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24481 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-19 22:58:48 +00:00
Jérôme Duval
4e8c60ce4b style cleanup
replaced addr_t by uint64
more debug output


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24476 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-19 19:00:35 +00:00
Stephan Aßmus
a529aaf3c6 Fixed 32 bit blit modes for real...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24453 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-18 21:41:02 +00:00
Jérôme Duval
b20d05b4f7 clean up, comments, header
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24452 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-18 21:25:34 +00:00
Stephan Aßmus
c2de9613a6 Fixed 32 bit versions of blit*.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24450 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-18 20:45:07 +00:00
Stephan Aßmus
55ef60a5ae * Removed the Copyright image/rendering.
* Fixed the icons image, it was upside down.
* Support the new 24 bit boot screen images in the boot_loader and the kernel.
* Prepare the code for future indexed versions of the boot screen images.
  But the generate_boot_screen tool currently does not generate those.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24449 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-18 20:27:47 +00:00
Axel Dörfler
e9d948ce2d * entry_ref_to_vnode() now gets a "traverse" argument, so that it is
able to resolve symlinks.
* file_open_entry_ref() now evaluates the openMode and passes the
  correct "traverse" argument to entry_ref_to_vnode(). This fixes bug
  #1932 (symlink refs wouldn't be resolved).
* dir_open_entry_ref() now always resolves symlinks, all other uses of
  entry_ref_to_vnode() keep their previous behaviour, though.
* Fixed warnings; since Ingo's header changes, NULL now causes a warning
  when it is used as int.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24442 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-18 16:10:04 +00:00
Stephan Aßmus
7d85665d0f * Give boot stages a more meaningful name, make the max stage count known.
* Calculate icon offset from stage in splash.cpp, remove hard coded placement
  values. Draw only icon, not the whole image from top/left to right of
  icon.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24439 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-18 13:14:18 +00:00
Ingo Weinhold
48e299e2ef Fixed warning.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24438 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-18 12:26:50 +00:00
Stephan Aßmus
61a1f36f79 * Implemented 32 bit cropped blit. Untested. I am guessing that the functions
could be refactored to avoid code duplication (ie only cropping
  implementations, with the non-cropping function being a special case of the
  cropping version)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24436 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-18 11:18:38 +00:00
Stephan Aßmus
10134c6d28 * Apply coding style a little more firmly.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24435 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-18 11:09:13 +00:00
Stephan Aßmus
aa727f6643 patch by Artur Wyszynski (aljen):
* Added the feature of an animated boot screen (icons lighting up at
  different boot stages).
* Added first version of new boot splash images, generated by the new
  hsbg tool. (Also finally contains the "new" Haiku logo.)

changes by myself:
* Added Artur to the contributors list in About System.
* Fixed some left overs in the patch, kept tracing turned off.

TODO:
* Remove the need for hard coding the icon positions. (Maybe generate
  those from hsbg and put them into images.h? Have user provide icon
  spacing/offsets at the command line for hsbg?)
* Rename the stages to something meaningful.
* Use hsbg as a build system tool and generate images.h during build
  from PNGs provided in the artwork folder.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24434 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-18 10:25:53 +00:00
Stephan Aßmus
45ae49e9c5 patch by Artur Wyszynski (aljen):
* update the kernel copyright string


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24432 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-18 10:11:58 +00:00
Ingo Weinhold
8b76a59a0d Fixed race condition in the page writer: The state of the page we have
picked might have changed while we were locking its cache. Might fix
#1931.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24430 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-18 02:39:04 +00:00
Ingo Weinhold
1b32947d3f * Aligned the semantics of the read_symlink() FS module hook with the
readlink() function. It is no longer required to null-terminate the
  string, shall not fail, if the buffer is too small, and shall return
  the length of the string actually written into the buffer.
* Adjusted rootfs, devfs, and bfs accordingly. Also adjusted their
  read_stat() hooks to return the correct symlink length in st_size.
* Our readlink() does now comply to the standard (and BeOS).
  Additionally if the buffer is big enough it is nice to non-conforming
  apps and null-terminates it.
* BSymLink::ReadLink() explicitly null-terminates the string now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24425 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-17 21:37:40 +00:00
Jérôme Duval
4f893e39ab algorithm to find best suited mtrr values to match a memory region. tested ok with 3071MB.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24424 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-17 19:50:46 +00:00
Axel Dörfler
0cbc783bc0 * _user_uninitialize_partition() never marked the partition unbusy
again. This fixes bug #1928.
* Added license header.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24421 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-17 13:11:35 +00:00
Axel Dörfler
6011cc673f * Implemented SetContentName(), and SetContentParameters().
* Added license.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24420 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-17 13:07:57 +00:00
Ingo Weinhold
5513309cb4 Use a union instead of the macro.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24407 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-15 18:49:48 +00:00
Michael Lotz
f4af1fba51 Use the empty_index field as the allocation_id for large allocations and just
use the index of the first page of the allocation as an id. This removes the
need for separate id generation. This also fixes the possible problem of
multiple large allocations getting the same allocation_id (due to the limited
range of possible ids), which in the worst case (i.e. for adjacent allocations)
could cause pages to be freed that were still in use.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24405 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-15 17:35:34 +00:00
Axel Dörfler
fe8b72bc69 Applied patch by Vasilis:
* Fixed various warnings with GCC4 due to the double sHaikuRevision line.
* Turned system_info.c to a C++ file.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24404 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-15 16:59:30 +00:00
Ingo Weinhold
fae99f156e cached_block::Compare() was ignoring the upper 32 bit of the block
number. Was a problem only for partitions > 2^32 * block size (4TB
for 1KB blocks).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24393 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-14 22:03:26 +00:00
Ingo Weinhold
6044b22ddb Added new macro SYSCALL_TRACING_IGNORE_KTRACE_OUTPUT to disable tracing
for the _kern_ktrace_output() syscall.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24392 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-14 21:58:17 +00:00
Ingo Weinhold
2b0b4bee36 store_acquire_unreferenced_ref() saves the pointer of the vnode it got
from the call to vfs_get_vnode() now. Only this way it is safe to call
store_release_ref() later (as the page writer does). We had a potential
race condition -- if called after vm_cache_remove_consumer() had
released the last reference, the old vnode might already have been
deleted.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24386 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-13 23:41:14 +00:00
Ingo Weinhold
74d93b3526 With syscall kernel tracing enabled, the syscall return value (%eax,
%edx) was trashed before passing it to the user debugger. strace shows
the correct return values again.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24364 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-11 21:29:44 +00:00
Ingo Weinhold
4eb3560949 * Added real, effective and saved set- user and group IDs to the team
structure. They are properly inherited and updated on
  fork(), load_image(), and exec().
* Implemented the get[e]{u,g}id(), set[[r]e]{u,g}id() family for real.
* getgroups() also calls the kernel now, but only returns the effective
  group ID. Supplementary groups support is still missing.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24359 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-11 17:12:02 +00:00
Ingo Weinhold
f542307a98 We didn't copy the close-on-exec flags on fork(), thus always leaving
all FDs in a fork()+exec()ed child open. Makes Perl test
t/run/cloexec.t pass.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24336 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-09 18:00:17 +00:00
Ingo Weinhold
4a7f236b07 Process groups are now reference-counted. Processes in a group as well
as the death entries of a deceased processes that were in this group
and have not yet been reaped hold references to the group, so that it
won't be deleted until the group is empty and all gone group members
have been reaped. This fixes #1799 at last.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24335 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-09 17:56:27 +00:00
Ingo Weinhold
6e4432bc6f Add a tracing entry when executing a signal handler.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24333 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-09 17:45:52 +00:00
Ingo Weinhold
c1de3c34b3 Added deferred_free() function, that can be used to free allocations
in code that has interrupts disabled. The chunks of memories are queued
and free()d periodically by a kernel daemon.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24332 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-09 17:44:55 +00:00
Axel Dörfler
3c0020ae42 * Accept case insensitive boolean values.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24326 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-09 15:26:29 +00:00
Axel Dörfler
3f89bce410 * The module code now uses find_directory() and no hard-coded paths anymore.
* It now also supports the common directory path.
* search_module() checked the module paths in the wrong order, ie. it preferred
  modules in the system directory over the user directory.
* Clarified comment in vfs_get_module_path().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24323 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-09 14:21:04 +00:00
Axel Dörfler
fa28330bbf * Explained under which circumstances vnode_path_to_vnode() will clobber the
buffer of the provided "path" argument.
* Applied patch by Vasilis to fix some warnings when build on Linux (missing
  const on certain functions). We should probably fix the original
  {add|remove}_debugger_command() functions in Haiku as well.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24322 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-09 13:43:38 +00:00
Michael Lotz
d1189f0b05 Naive implementation of transfer_area(). It follows the suggested sematics
of the resolved ToDo, but could probably be made more efficient. Instead of
transfering the area, the area is cloned into the target teams' address space
and the original is deleted. This generates a new area_id for the transfered
area (as suggested by the ToDo). Updated syscall prototypes according to the
status_t to area_id return type change.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24320 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-09 12:56:59 +00:00
Axel Dörfler
d1893d6468 * Driver probe code now uses find_directory() to get the directories to
look for drivers (also added common directory).
* Now also honours the B_SAFEMODE_DISABLE_USER_ADD_ONS setting.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24316 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-08 23:14:06 +00:00
Axel Dörfler
637eef896b * Added a get_safemode_boolean() function for easy access to the safemode
options.
* module_init() now sets sDisableUserAddOns to whatever the safemode settings
  say, ie. the B_SAFEMODE_DISABLE_USER_ADD_ONS setting is now respected by
  the module code.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24315 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-08 23:12:46 +00:00
Jérôme Duval
dbba758fad added traces
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24245 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-05 21:05:13 +00:00
Jérôme Duval
2d2212bd71 here with 3GB of memory, a 4GB MTRR slot is being written, which triggers a reboot.
we now split more than 2GB MTRR slot, we might improve this and split more and more.
this could fix the bug #1711.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24244 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-05 20:06:18 +00:00
Axel Dörfler
753a97024e * This fixes the broken count of unhandled interrupts which caused some
problems in the past (it only worked for level triggered interrupts).
* Of course, the actual problem is that on current hardware we detect
  almost all interrupts as edge triggered...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24239 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-04 21:49:40 +00:00
Axel Dörfler
7dbbb04a3b * Since the device hooks can actually change when the driver is
republished, we now update them.
* This fixes occasional crashes with reloaded/repulished drivers.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24237 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-04 17:03:25 +00:00
Axel Dörfler
daa6f66e11 * Minor cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24236 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-04 16:59:59 +00:00
Axel Dörfler
890c615aee * unload_elf_image() never unloaded any image because the ref_count
check was wrong (never gets below zero if everything goes as 
  intended).
* Removed erroneous white space.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24232 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-04 12:36:53 +00:00
Axel Dörfler
57b9fd2d91 Applied patch by Olivier Coursière: this should help rebooting on some
machines, and fixes bug #1884, thanks!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24202 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-02 13:51:17 +00:00
Axel Dörfler
0c415f6265 "leaf" may be NULL, fixed crashing bug I introduced with
vfs_entry_ref_to_path().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24154 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-27 17:36:21 +00:00
Axel Dörfler
a77ed12b25 * Removed obsolete "ident" parameter from devfs_publish_device().
* driver_entry::api_version now stores the actual version instead of a
  pointer to it.
* Renamed node_path_entry to path_entry and reused it for driver 
  reloading: handle_driver_events() will now also check for drivers to
  add in the sDriversToAdd list.
* Added new devfs_driver_added(), and devfs_driver_removed() functions
  that trigger certain driver actions.
* Implemented notifying devfs on B_ENTRY_CREATED, B_ENTRY_REMOVED, and
  B_ENTRY_MOVED events in probe.cpp. The watched directory inode numbers
  are now stored in a hash for B_ENTRY_MOVED.
* unpublish_driver() did not actually delete the node, it only marked
  it removable since we never get/put the node. We now do, and so the
  node is actually removed as intended.
* Added "devfs_driver" KDL command.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24152 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-27 16:55:59 +00:00
Axel Dörfler
4f26630d82 * Factored a vfs_entry_ref_to_path() out of _user_entry_ref_to_path()
and made it public (within the kernel).
* _user_entry_ref_to_path() is now using that function.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24151 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-27 16:39:32 +00:00
Michael Lotz
6dffd08db7 Hopefully this is a good compromise. If more than 99% of the interrupts of a
vector are unhandled, it is disabled if it is not a shared interrupt vector
(as before). Otherwise a message is printed to indicate the condition. I
reduced the amount of interrupts to 10000, as with 100000 it would take over
half an hour on my machine to trigger. Feel free to adjust.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24146 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-26 20:54:04 +00:00
Axel Dörfler
e6fdb84b92 * If path equals "" it won't be published anymore.
* load_driver() now uses republish_driver() instead of publishing all
  devices every time. This allows published nodes to remain stable, no
  matter if the driver has been unloaded in the mean time or not.
* Offloaded driver reloading to a kernel daemon. Since this is regarded 
  to happen rarely, a simple event variable will be set when something
  happened, and the daemon will then check all known drivers.
* devfs_open() will now check if the driver has to be reloaded, and will
  do so before opening the device.
* Moved republish_driver() around again.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24141 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-26 14:54:41 +00:00
Axel Dörfler
ee0a072929 * While it was broken before, having the devices_used counter updated in
{get|put}_node() is not really what we want either; moved the maintenance
  into the open() and free_cookie() hooks.
* This should fix driver reloading on change for drivers that have been used
  before.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24135 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-26 10:41:43 +00:00
Michael Lotz
c0f9f1b158 Do not disable interrupt vectors for shared interrupts when more than 99% are
unhandled. Otherwise it brings more trouble than it solves as it also disables
the interrupt of other devices (most often USB or network).

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24120 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-25 18:56:18 +00:00
Axel Dörfler
351b7a2d24 * Added B_WATCH_INTERIM_STAT, and B_STAT_INTERIM_UPDATE definitions to
NodeMonitor.h.
* The latter will be set in "statFields" for interim updates when you have
  asked to get them via the former.
* BFS now uses the B_STAT_INTERIM_UPDATE flag for sending updates to actively
  written files.
* This makes us more compatible with BeOS again; if you only asked for
  B_WATCH_STAT, you will now only receive a notification if the file in
  question has been closed.
* Tracker now uses B_WATCH_INTERIM_STAT to always get all updates (ie.
  downloading a file will update its size and modification time in Tracker
  periodically during the download).
* Wether "needsTrimming" was true or not has no influence on wether or not
  the size index needs to be updated in BFS - only the actual file size is
  stored there, not the on-disk size.
* Added a TODO comment in Inode::WriteAt() that it would actually need to
  update the size index when changing the file size, not when the file has
  been closed (but that's probably too slow).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24114 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-25 13:54:30 +00:00
Ingo Weinhold
20e4f92cf5 switch_sem_etc() doesn't check the return value of add_timer(), hence we
need to make sure that we never get that far with a negative timeout or
we'll wait forever.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24083 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-23 16:01:59 +00:00
Ingo Weinhold
098adfe889 common_select/poll(): Consider all negative timeout values as infinite
timeout, not just -1. Paranoia only, since that should happen anyway.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24082 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-23 15:59:30 +00:00
Ingo Weinhold
5b702e5934 "thread" also prints the signal block mask, now.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24065 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-22 14:55:10 +00:00
Ingo Weinhold
bc2001bb39 We have to update the pending signals thread flag when restoring the
signal block mask when returning from a signal handler.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24064 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-22 14:54:03 +00:00
Ingo Weinhold
23b95b112d We have to remove the thread's condition variable entries when
interrupted early, i.e. when signals were already pending when we
started waiting. Fixes #1832.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24063 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-22 14:51:11 +00:00
François Revol
ff7eefe8e3 Call debugger_puts hooks on modules when serial debug output is enabled (modules themselves must reject loading if they don't find mymodule_debug_output in kernel settings).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24054 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-21 23:35:44 +00:00
Axel Dörfler
8327c8091f team::parent is NULL in case of the kernel - Expander crashed reliably
when expanding something with it.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24047 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-21 16:15:00 +00:00
Axel Dörfler
0dd3108ca0 * Added SIGNAL_FLAG_DONT_RESTART_SYSCALL for send_signal_etc() which
utilizes the THREAD_FLAG_DONT_RESTART_SYSCALL (but only in SIGCONT
  for now).
* resume_thread() is now using that flag to be compatible with BeOS.
* This fixes the Terminal hanging on close.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24045 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-21 13:19:54 +00:00
Ingo Weinhold
2efb87b92f Added TODO: Process groups should live on until the process is reaped.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24042 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-21 01:00:14 +00:00
Ingo Weinhold
562e2f204a * Removed unused team::pending_signals.
* Added team::flags. Currently only used for setting a flag when a team
  has exec()ed.
* Some improvements of _user_setpgid():
  - It failed incorrectly when the target process was a process group
    leader. According to the standard it shall fail when the process is
    a session leader. Moving a process group leader to another process
    group is fine, even if that leaves the group leaderless.
  - Fixed race conditions. We need to recheck the error conditions when
    we hold the team spinlock. Otherwise the situation could change
    while we allocated the new process group. This was one of the
    reasons for bug #1799 -- after the shell fork()'s both parent and
    child invoke setpgid() for the child.
  - Fixed behavior for pid == pgid. It doesn't necessarily mean that a
    new group has to be created.
  - Fixed update of target process group orphaned state.
  - Squashed TODO: setpgid() on a child is supposed to fail after the
    child has exec()ed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24041 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-21 00:46:22 +00:00
Axel Dörfler
db55a020e6 * Started implementing node monitoring in the devfs and device manager.
* Right now, only already known loaded drivers will be monitored for changes;
  their devices aren't republished, though, since that would cause a deadlock
  in the node notification mechanism (listeners are called synchronously);
  need to offload that the event handling to another thread.
* On changes of (known) driver directories, the device manager will now print
  some info to the syslog.
* Fixed republish_driver() I broke recently (would skip every other node), and
  moved it to the driver functions section of the devfs.cpp.
* Implemented currently unused unpublish_driver() function that would have to
  be called before reloading a driver.
* If a driver is in use when it's updated, we mark it, but we don't do anything
  with that info when we could.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24036 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-20 16:55:05 +00:00
Axel Dörfler
9448bb6e0b Added add_node_listener() and remove_node_listener() kernel private functions
to watch a node.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24035 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-20 16:48:16 +00:00
Axel Dörfler
849246ba77 Improved (and tested) the advisory file locking mechanism a bit:
* our flock::l_len was inclusive, while it's exclusive (the last byte locked
  is (l_start - 1 + l_len) not just (l_start + l_len).
* F_UNLCK removes all locks of the calling process that are within the specified
  region - existing locks might also cut or divided.
* Apparently, a single team can lock the same region as often as it wants.
* advisory_locking is now using a DoublyLinkedList instead of its C counterpart.
* advisory_lock now has start + end fields, instead of offset + len, it's
  handier this way.
* This fixes bug #1791.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24020 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-19 19:16:36 +00:00
Axel Dörfler
350e0b20a5 * Simplified devfs_rescan_driver() since the driver hash is now based on the
name of the drivers.
* Allow driver::publish_devices() to return NULL to hint that it has no devices
  to publish anymore (ie. existing devices will be unpublished in this case).
* republish_driver() now also calls load_driver() in case the driver is not
  loaded.
* publish_device() and unpublish_node() now maintain the new
  driver_entry::devices_published field, so we always know how many devices
  a driver has now.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24016 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-19 14:59:30 +00:00
Michael Lotz
b024c395d7 Fix bad error in calculating the leak check info address when updating the
size of a reallocated block. If you had kernel heap leak checking on, this
could have caused the first four bytes of the next block to be overwritten
with the size of the reallocation of the previous block.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24011 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-19 00:42:54 +00:00
Michael Lotz
d4d25a55bd We should lock around register_elf_image() as we modify the image hash in there.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24010 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-18 22:54:12 +00:00
Ingo Weinhold
306fe53248 We forgot to unpublish our temporary condition variable. Since it was
allocated on the stack, condition variable related structures would be
trashed, causing all kinds of problems. Fixes #1811 and #1812.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24009 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-18 21:51:34 +00:00
Axel Dörfler
447c081fe4 * sigsuspend() must only block blockable signals.
* Minor comment cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24000 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-18 12:31:17 +00:00
Michael Lotz
cf46897b4c Use a dedicated heap to allocate everything that is needed during heap growth.
This eliminates the edge case where the grow thread would not be able to create
a new area because no memory could be allocated for the allocation of the area.
As this case cannot happen anymore, it is also not possible to deadlock in
memalign. Therefore the timeout (which would only have prevented the deadlock
but wouldn't have solved the edge case anyway) has been removed too.
Add options to dump the dedicated grow heap and to only print the current heap
count to the "heap" debugger command.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23994 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-18 01:04:19 +00:00
Marcus Overhagen
08c01f715f gcc4 build fix
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23992 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-17 19:18:31 +00:00
Marcus Overhagen
b91371e409 gcc4 build fix
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23991 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-17 19:14:50 +00:00
Ingo Weinhold
4048494ce4 axeld + bonefish:
* Implemented automatic syscall restarts:
  - A syscall can indicate that it has been interrupted and can be
    restarted by setting a respective bit in thread::flags. It can
    store parameters it wants to be preserved for the restart in
    thread::syscall_restart::parameters. Another thread::flags bit
    indicates whether it has been restarted.
  - handle_signals() clears the restart flag, if the handled signal
    has a handler function installed and SA_RESTART is not set. Another
    thread flag (THREAD_FLAGS_DONT_RESTART_SYSCALL) can prevent syscalls
    from being restarted, even if they could be (not used yet, but we
    might want to use it in resume_thread(), so that we stay
    behaviorally compatible with BeOS).
  - The architecture specific syscall handler restarts the syscall, if
    the restart flag is set. Implemented for x86 only.
  - Added some support functions in the private <syscall_restart.h> to
    simplify the syscall restart code in the syscalls.
  - Adjusted all syscalls that can potentially be restarted accordingly.
  - _user_ioctl() sets new thread flag THREAD_FLAGS_IOCTL_SYSCALL while
    calling the underlying FS's/driver's hook, so that syscall restarts
    can also be supported there.
* thread_at_kernel_exit() invokes handle_signals() in a loop now, as
  long as the latter indicates that the thread shall be suspended, so
  that after waking up signals received in the meantime will be handled
  before the thread returns to userland. Adjusted handle_signals()
  accordingly -- when encountering a suspending signal we don't check
  for further signals.
* Fixed sigsuspend(): Suspending the thread and rescheduling doesn't
  result in the correct behavior. Instead we employ a temporary
  condition variable and interruptably wait on it. The POSIX test
  suite test passes, now.
* Made the switch_sem[_etc]() behavior on interruption consistent.
  Depending on when the signal arrived (before the call or when already
  waiting) the first semaphore would or wouldn't be released. Now we
  consistently release it.
* Refactored _user_{read,write}[v]() syscalls. Use a common function for
  either pair. The iovec version doesn't fail anymore, if anything could
  be read/written at all. It also checks whether a complete vector
  could be read/written, so that we won't skip data, if the underlying
  FS/driver couldn't read/write more ATM.
* Some refactoring in the x86 syscall handler: The int 99 and sysenter
  handlers use a common subroutine to avoid code duplication.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23983 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-17 15:48:30 +00:00
Marcus Overhagen
4af8877673 build fix for r23929
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23982 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-17 14:59:52 +00:00
Ingo Weinhold
fe19cba8f0 axeld + bonefish:
Before starting to wait on a condition variable check for pending
signals first, if the call is interruptable.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23980 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-17 14:38:23 +00:00
Ingo Weinhold
7d2d758d46 axeld + bonefish:
Make ktrace_printf() available in the kernel, too.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23979 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-17 14:36:47 +00:00
Ingo Weinhold
d63cbbe2df Added "error" debugger command to print the error string for a given
numeric error code.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23978 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-17 14:36:03 +00:00
Ingo Weinhold
25f0ac90a9 axeld + bonefish:
The return value of Inode::WaitForRequest() is status_t not bool. So the
method would always fail when it actually succeeded. This affected reads
from pipes which didn't have data. The bug was hidded since VFS code
mostly checks error codes only against < B_OK, so that such a read would
be treated as 0 byte read.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23976 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-17 14:34:34 +00:00
Ingo Weinhold
9ae93dcd7f _user_normalize_path() was broken for symlinks in absolute paths.
Fixes #1778.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23969 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-17 13:32:08 +00:00
Michael Lotz
aabef40563 * Add a "stats" argument to the kernel heap leak checker to only print the
total count of allocations and bytes.
* Also add a few more bin sizes (for 8, 24 and 48 bytes) turns out especially
  allocations of 20-24 bytes are pretty common. And as it only wastes a few
  bytes per page this doesn't hurt at all.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23961 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-14 23:16:50 +00:00
Michael Lotz
cf2687e48f Only clear 0xdeadbeef if there is 0xdeadbeef present. The size field of the
heap leak check info would otherwise be overwritten for allocations that still
fit the 16 byte bin (i.e. allocations of 0-4 bytes).

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23956 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-12 22:25:18 +00:00
Michael Lotz
4af6cd5f38 Adding two debug features to the new heap implementation:
* Tracing of allocations, reallocations and frees
* Leak checking infrastructure to dump allocations

The leak checking code records the team and thread id when an allocation is
made as well as stores the originally requested size. It also adds the
"allocations" debugger command that can dump all current allocations (usually
a huge list) or filter by either a team or thread id. This way it's easily
possible to find leftover allocations of no more active teams/threads.
Combined with the tracing support one might be able to track down the time and
reason of an allocation and possibly find the corresponding leak if it is one.
Note that kernel heap leak checking has to be enabled manually by setting the
KERNEL_HEAP_LEAK_CHECK define to 1.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23953 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-12 20:20:35 +00:00
Michael Lotz
75fe8391f9 Fix the build. Apparently this file wasn't recompiled on my end before.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23942 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-10 21:53:53 +00:00
Michael Lotz
5c4d1c5e21 Complete rework of the heap implementation. Freelists are now part of the pages
and pages are now kept in lists as well. This allows to return free pages once
a bin does not need them anymore. Partially filled pages are kept in a sorted
linked list so that allocation will always happen on the fullest page - this
favours having full pages and makes it more likely lightly used pages will get
completely empty so they can be returned. Generally this now goes more in the
direction of a slab allocator.
The allocation logic has been extracted, so a heap is now simply attachable to
a region of memory. This allows for multiple heaps and for dynamic growing. In
case the allocator runs out of free pages, an asynchronous growing thread is
notified to create a new area and attach a new heap to it.
By default the kernel heap is now set to 16MB and grows by 8MB each time all
heaps run full.
This should solve quite a few issues, like certain bins just claiming all pages
so that even if there is free space nothing can be allocated. Also it obviously
does aways with filling the heap page by page until it overgrows.
I think this is now a well performing and scalable allocator we can live with
for quite some time. It is well tested under emulation and real hardware and
performs as expected. If problems come up there is an extensive sanity checker
that can be enabled by PARANOID_VALIDATION that covers most aspects of the
allocator. For normal operation this is not necessary though and is therefore
disabled by default.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23939 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-10 21:00:13 +00:00
Ingo Weinhold
2c986936df Added new syscall _kern_normalize_path() to normalize a path.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23929 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-08 03:06:14 +00:00
Michael Lotz
cfc9593fa8 Fix possible though unlikely SMP issue reported by Robert Szeleney. One must
not use a single static variable to synchronize CPUs at two points. In an
environment where CPUs do not really run concurently (in emulation or with
logical processors) it would be possible for CPUs to get trapped in the first
synchronization while another CPU might just do its thing and change the
sync variable again. These CPUs would then never leave the first loop as the
exit condition has already passed again. The key is to use two different sync
variables like it is done in early kernel initialization. As I didn't manage
to trigger this code though I am not sure if this is gonna work.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23926 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-07 23:19:28 +00:00
Ingo Weinhold
0c221f53a3 Also check the syscall number to avoid problems.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23920 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-07 19:07:26 +00:00
Ingo Weinhold
3d779beaa3 Don't invalidate the syscall number, since that's not handled graciously
in the syscall handler.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23919 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-07 19:06:03 +00:00
Ingo Weinhold
3832c7ec7f Always clear the THREAD_FLAGS_64_BIT_SYSCALL_RETURN flag, even when
using the int 99 syscall method. Otherwise it would remain set e.g.
after _kern_restore_signal_frame() and the next syscall would look like
one returning a 64 bit value.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23918 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-07 19:04:38 +00:00
Ingo Weinhold
385627911c Debug code. From time to time I still see 64 bit return values when they
should be 32 bit only.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23917 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-07 16:04:24 +00:00
Ingo Weinhold
9835c090a6 Added a boolean "force" parameter to thread_yield(). When true, the
function has the old behavior. When false, it just calls the scheduler
without any priority adjustment or other stuff.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23906 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-07 11:40:31 +00:00
Axel Dörfler
0b26e0b1d4 * When removing a media, only the device was unmounted if needed, not its child partitions.
Not sure if this is the right place, Ingo might want to review that one.
* This fixes unmounting sessions of a multi-session CD, ie. the BeOS CD (it currently panics
  when trying to access a device that's not there anymore - for debugging only, of course :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23894 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-06 11:46:44 +00:00
Axel Dörfler
dbc1da17ed * devfs now uses the driver's name instead of its node_ref to see if it
already knows this driver.
* This should also allow to have a driver in home/config/add-ons/... overlays
  a driver with the same name in system/add-ons/...
* This should also fix bug #1750.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23892 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-06 11:13:14 +00:00
Michael Lotz
0d83dc06e3 * Use 0xdeadbeef as an indicator to only conditionally walk the freelist.
This is not safe when already freed memory is overwritten. But since we also
  store the next pointer of the freelist in there, overwriting would break the
  freelist and cause a crash in that case. This gives a drastic performance
  boost when freelists grow during use and especially when opening and closing
  a lot of programs.
* Optimize filling the freed element with 0xdeadbeef by writing 4 bytes at a
  time instead of using single byte writes. Works as all our bins have an
  element size that is a multiple of four. Put a panic in there just in case
  this assumption isn't met for some reason.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23879 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-05 20:21:44 +00:00
Michael Lotz
9a2cc3ad3f * Fix some coding style issues
* Stumbled upon a possible bug while trying to understand the reuse of large
  allocations. The "first" variable was always set to the current index at the
  end of the loop, even if it was already set. This should have caused that
  the success condition to never be reached.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23866 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-04 21:53:57 +00:00
Ingo Weinhold
350b6dbc3a * Removed AbstractTraceEntry::sPrintTeamID and added a flags field to
TraceOutput for output options instead.
* Added "traced" option --difftime. Instead of the absolute system time
  it prints the difference time to the previously printed entry.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23864 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-04 17:54:40 +00:00
Axel Dörfler
08f2fdac37 * "call" now sets some useful debugger variables, like _argX for all arguments,
and _frame for the stack frame.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23849 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-03 18:04:25 +00:00
Axel Dörfler
db18308b90 Fixed the "call" command to actually show the arguments that belong to the
function name it prints.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23846 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-03 17:52:43 +00:00
Michael Lotz
2362422c38 Do not just overwrite the thread state when suspending a thread since this easily causes problems on SMP systems (triggers the panic in the scheduler).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23839 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-03 16:18:19 +00:00
Michael Lotz
f87d72d788 Introduce a B_NO_LOCK_VECTOR flag to be used with install_io_interrupt_handler().
When specified it desigantes that the interrupt handler should not lock the
vector with a spinlock when executing the installed interrupt handlers. This
is necessary to allow the same interrupt vector to be handled in parallel on
different CPUs. And it is required for the CPU halt to work synchronously when
there is more than one AP CPU. Though the acquire_spinlock() should cause IPIs
to be processed, only this fixed the SMP_MSG_FLAG_SYNC problem for me.
Not locking is safe as long as it is guaranteed that no interrupt handler is
registered or removed while the interrupt handler is running. We can guarantee
this for the SMP interrupt handlers we install in arch_smp_init() as they are
never uninstalled. Probably this flag should be made private though.
Restored the SMP_MSG_FLAG_SYNC when entering the kernel debugger.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23838 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-03 16:16:17 +00:00
Axel Dörfler
a32a4683ff * Implemented flock() semantics to the advisory locking backend. Not tested
(must also compare to BSD; I've looked at their sources, but I might have
  missed something).
* Added sys/file.h and the flock() system call.
* common_fcntl() could forget to put back the file descriptor on some error
  conditions (I guess we should introduce and use a DescriptorGetter class).
* Cleaned up fcntl.h, moved the BSD extensions S_IREAD and S_IWRITE to
  sys/stat.h where they belong, and added the missing S_IEXEC to them.
* Added some more comments.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23836 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-03 15:37:31 +00:00
François Revol
82610ec8eb * get rid of ppc stuff
* possible types of exception frames


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23833 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-03 11:39:28 +00:00
Axel Dörfler
5905a0ae34 * Fixed _{kern|user}_{read|write}[v]() functions to not move the descriptor's
file position in case an offset was specified.
* Reverted r23828-r23830 in File.cpp: don't fix the symptoms but the cause
  of the problem (hey, that has to be in the kernel, right? :))
* Cleanup of File.cpp, removed OpenBeOS namespace.
* Moved user_fd_kernel_ioctl() to the section where it belongs to (that
  function should be renamed, though).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23832 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-02 23:50:51 +00:00
Axel Dörfler
987de53746 * Also replaced the cpu store's lock with a recursive lock in order
to fix bug #1731.
* However, it turns out that depot destruction obviously doesn't work
  correctly, at least we keep partial or full slabs around when we're
  using them (which causes the code to panic).
* Therefore, I've now disabled depots completely, until I find the time
  to really work on that code.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23825 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-02 14:20:33 +00:00
Axel Dörfler
45b17b80d1 * Temporarily switched to a recursive lock for the depot.
* While this is not a really good idea for a lock with supposedly little
  contention, but it'll fix bug #1731. I haven't tested it yet, but will
  do so in a minute :-)
* I will need to rework the slab anyway so that it's possible to use it
  as a replacement for our heap, and then I'll switch back to a benaphore
  again.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23822 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-02 12:12:54 +00:00
Axel Dörfler
5ccd99565d Benaphores are nice and fast, but they aren't useful for debugging at
all.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23820 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-01 23:05:26 +00:00
Ingo Weinhold
0c6f7530ef syscalls.cpp also includes syscall_numbers.h, now.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23809 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-01 12:23:28 +00:00
Ingo Weinhold
a02bbcd455 Renamed "printteam" switch for "traced" command to "--printteam".
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23808 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-01 12:21:41 +00:00
Ingo Weinhold
34aae00fe9 Syscall tracing no longer fetches the string parameter of the
_kern_ktrace_output() syscall, since it will be stored in a separate
entry anyway.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23807 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-01 12:15:00 +00:00
Ingo Weinhold
7bb85c7b55 Clarifying comment.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23806 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-01 12:11:02 +00:00
Axel Dörfler
3cec75dc33 * Debugger modules now have two methods: enter_debugger() and exit_debugger().
* The kernel now opens up to 8 debugger modules (and puts them into an array;
  maybe we'll want to switch to a doubly linked list when there is the need).
* Implemented an example debugger module that prints a stack trace of the
  current thread when the kernel debugger is entered (not included in the
  image).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23794 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-31 12:25:43 +00:00
Marcus Overhagen
3cad4dae71 Print ids in decimal.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23780 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-28 23:19:54 +00:00
Marcus Overhagen
7694461ea6 Use decimal for thread ids.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23779 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-28 22:58:02 +00:00
Marcus Overhagen
c486dde9d6 cosmetic
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23778 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-28 22:48:56 +00:00
Marcus Overhagen
fad02fc2ac Print thread ids in decimal.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23777 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-28 22:43:22 +00:00
François Revol
9a507b45d4 Some reorg.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23759 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-27 01:39:28 +00:00
Ingo Weinhold
62c35bb99a Corrected "threads" usage text.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23756 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-26 22:48:05 +00:00
Michael Lotz
7f5698963f Add concurency handling when entering the kernel debugger. Previously there
was a race condition when more than one CPU would enter the debugger at the
same time (or rather before one CPU could stop all the others). We now use the
inDebugger variable to tell if someone is already in the debugger and then
only process inter CPU messages and retry entering the debugger.
Since sending the synchronous broadcast most of the time hung over here with
SMP enabled I removed the synchronous flag and added a simple spin to give the
other CPUs a chance to process the halt request. Added comments that explain
the reasons and a ToDo to revert to synchronous delivery once we fixed the
problem. The kernel debugger is now usable on my quad core.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23751 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-26 19:12:22 +00:00
Ingo Weinhold
f2e758e5da Added usage message for the thread-related debugger commands.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23750 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-26 18:45:35 +00:00
Michael Lotz
36b55f4694 Don't panic in case a thread is not in the wait queue of a sem anymore. On SMP
systems it can easily happen that the thread gets removed from the queue (when
it times out for example) during the time we don't hold the sem lock.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23749 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-26 18:44:23 +00:00
Michael Lotz
1b0e74fc18 Don't clobber the thread variable as we use it again. Since it always is NULL
at the end of that loop we guaranteed a crash when this special handling was
triggered.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23748 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-26 18:17:12 +00:00
Ingo Weinhold
803a36434d * Used add_debugger_command_etc() and added a usage text for "team" and
"teams".
* "team" without arg prints info about the current team.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23746 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-26 10:47:27 +00:00
Ingo Weinhold
e03ff02033 Set team::name to the last path component instead of to the truncated
path. Makes the "teams" output prettier and "team <name>" becomes
usable.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23745 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-26 10:36:20 +00:00
Michael Lotz
7e80cf0096 Missed this setting of thread state which is now unnecessary. Otherwise nothing in the kernel seems to mess with the state outside of the scheduler so checking for B_THREAD_RUNNING there should be fine.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23740 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-25 17:37:20 +00:00
Michael Lotz
6761f5a660 Move the handling of still running threads into scheduler_enqueue_in_run_queue().
This should be in line with all uses of scheduler_enqueue_in_run_queue() and
simplifies a few places where it is used.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23738 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-25 15:55:54 +00:00
Michael Lotz
d925650968 Apply the same logic as in r23731 to all other places in the semaphore code
where threads are enqueued into the run queue.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23733 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-25 13:55:17 +00:00
Michael Lotz
2f3f3d79b5 Fix the underlying problem that caused the issue of running threads being
enqueued into the run_queue again. Modified the workaround to a panic in the
scheduler so we notice when something else does the same.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23731 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-25 13:27:00 +00:00
Michael Lotz
bc1dc61522 Implement a workaround for a concurency issue on SMP systems:
A thread that just missed a semaphore and put itself into the sems notify
queue could be enqueued into the run queue by release_sem_etc() of another
CPU before the CPU running the thread had a chance to reschedule it. Therefore
there is a timeframe where a thread can be running on one CPU and already be
in the run queue again. In this case no other CPU may schedule this thread
because then it would overwrite the threads' CPU pointer which kills the rest
of the scheduler logic, smp_get_current_cpu() and everything that depends on
that (like the kernel debugger). The more CPUs you have the easier this could
happen, up to the point where it was always triggered during boot on my quad
core system. The system would freeze and you could not enter the kernel
debugger, because two CPUs thought they were the same and disabled each other
through SMP communication. This makes booting my system stable and might fix
the occasional hang on boot for other SMP systems with only 2 CPUs/cores.
I've put a ToDo comment that details this above the workaround. Maybe we
should fix this in another way. Reviews, comments and suggestions welcome ;-)

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23721 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-24 15:14:10 +00:00
Stephan Aßmus
72f7b29018 Limit the number of stack frames we print. Infinite recursions or, even worse,
cyclic stack frames would be seriously annoying.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23712 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-23 21:47:17 +00:00
Axel Dörfler
a39bfc19fd Made the paging mechanism a bit more useful for commands: it will now wait when
the command would overwrite its own output, not always on the bottom of the
screen.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23699 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-22 08:24:35 +00:00
Axel Dörfler
6eabbacd70 * Fixed compare_blocks() function; it actually gets cached_block**.
* Added block_writer thread that continuously writes back blocks for all current
  block caches.
* A block cache now maintains the number of dirty blocks if it doesn't use
  transactions. That knowledge could also be used in block_cache_sync()...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23698 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-22 08:16:04 +00:00
Ingo Weinhold
325b88a661 * Introduced debugger command flag B_KDEBUG_DONT_PARSE_ARGUMENTS.
For commands with this flag set, the parser won't parse the
  arguments provided (it will only check for matching parentheses and
  brackets), but will pass the unparsed argument list string to the
  command instead.
* Set the new flag for the "expr" command, so one doesn't have to quote
  the expression to evaluate anymore (or put it in parentheses).
* Fixed tokenizing of quoted and unquoted strings in expression mode.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23697 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-21 23:25:34 +00:00
Axel Dörfler
5af13da19d * The block cache now sorts the blocks before synchronizing a transaction.
* This should speed up writing a transaction considerably.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23694 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-21 20:34:06 +00:00
Axel Dörfler
4a67038e56 * Added a new function hash_insert_grow() that grows the hash table when needed.
* Removed the public hash_grow() function again (at least for now, it's only
  private).
* Removed the newSize argument from hash_grow(); it will compute the new size
  automatically.
* The block cache is now using hash_insert_grow() instead of hash_insert()
  which should make hash lookups much faster with some 10 thousand blocks,
  also increased the initial table size from 32 to 1024...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23692 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-21 19:57:40 +00:00
Ingo Weinhold
5fa74667c5 Changed semantics of "traced" invocation without arguments. Instead of
printing the last 30 entries, it continues the last iteration, thus
making the more common use case more comfortable. The old functionality
is still available via "traced 0".


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23689 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-21 17:59:19 +00:00
Ingo Weinhold
b4f58d8758 Renamed syscall_parameters_info structure to extended_syscall_info (and
kSyscallParametersInfos to kExtendedSyscallInfos) and added "name"
field. Now the classes for syscall kernel tracing don't need to lookup
the syscall function symbol anymore, which speeds up printing/filtering
of those entries dramatically.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23687 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-21 15:29:00 +00:00
Ingo Weinhold
a54c125e37 Added experimental ktrace_[v]printf() functions to libroot. Their output
is recorded in a kernel trace entry (if tracing is enabled).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23686 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-21 15:10:05 +00:00
Ingo Weinhold
64fe37ee89 * AbstractTraceEntry records the team ID too, now.
* Added "printteam" switch to "traced" command, enabling the printing of
  the team ID.
* Added "team" filter to the "traced" command expression language.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23684 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-21 13:31:27 +00:00
Ingo Weinhold
0bf73dd2f1 Increased the maximum number of command line arguments to a more
comfortable number. Somewhat more complex "traced" filter expressions
tended to exceed the old limit easily. 


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23683 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-21 13:09:39 +00:00
Ingo Weinhold
635aca08c5 Removed unused variable.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23682 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-21 13:06:52 +00:00
Ingo Weinhold
56213ff41a Some "traced" command optimizations:
* Made the iterator static, so that it's possible to move from the
  iteration position of the previous invocation to the current start,
  instead of always having to start from the beginning or the end.
* Filtered backward iteration:
  - Restrict the range to dump to the entries between the first and the
    last filter match.
  - Use new FILTER_MATCH entry flag to avoid applying the filter a
    second time in the print loop.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23681 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-21 11:56:24 +00:00
Axel Dörfler
731262c6dd * Rethought fs_sync(): since we no longer deadlock when calling
vm_cache_write_modified() here anymore since quite some time, it actually
  doesn't make any sense to call the file system's "fsync" method here.
  This should make syncing all file systems much faster when many vnodes are
  in use.
* If a file system doesn't use the file cache, it can still just sync everything
  it needs to in its "sync" method.
* Added a TODO item on how to improve sync speed further, if necessary.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23679 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-21 10:28:32 +00:00
Ingo Weinhold
6d36996620 * Fixed my fix for make_space() wrapping. It's always a good idea to
write code aligned to what one has written in the comment (or the
  other way around).
* Made trace_entry structure doubly linked, by introducing a
  previous_size member. By using bit fields, shrinking the flags field
  to 4 bits, and not saving the lower two bits of size and previous_size
  (which are always 0 due to alignment), the structure remains 4 byte
  sized and can still address the same entry size.
* kBufferSize is no longer one less than it could be.
* "traced" command:
  - Use static variable for the iteration state rather then cluttering
    the temporary debug variable name space.
  - The <count> parameter can now be negative, in which case the entries
    before (and including) <start> are printed.
  - Added a new optional parameter, specifying the maximal number of
    entries to be filtered. Filtered iteration is beautifully
    comfortable now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23678 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-21 00:41:45 +00:00
Ingo Weinhold
902425896d Made kputs() available in the kernel and used it for printing debugger
command usage texts, which can be too long for kprintf().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23677 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-21 00:15:33 +00:00
François Revol
f7d4128dfa This should be enough for query_tmap_interrupt.
We use an indirect page descriptor instead of pointing the page to itself like on x86.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23668 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-20 19:53:23 +00:00
Ingo Weinhold
6d986c16fe * Use dprintf_no_syslog() for debug output, since we have interrupts
disabled in most cases.
* Wrapping in make_space() was broken. When wrapping the second time or
  later, sFirstEntry would already be greater than sAfterLastEntry and
  resetting sAfterLastEntry to the beginning of the buffer would
  erroneously "free" all entries between the buffer start and the
  original sAfterLastEntry. If the tracing buffer was small enough,
  the odds were that a not yet fully initialized entry would already
  be re-allocated, causing all kinds of weird behavior.
* When an entry that is not yet fully initialized needs to be
  freed, we let the allocation causing the freeing fail. We can't wait
  for the entry, since we've interrupts disabled and since the entry
  initialization might even try to allocate more (buffer) entries.
* make_space() is now safe to be called in any situation, and
  allocate_entry() will do that, which simplifies things there and
  avoids a few duplicate checks.
* Moved maximum allocation size check from alloc_tracing_buffer() to
  allocate_entry(). Just in case... :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23662 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-20 16:11:24 +00:00
François Revol
60db426624 unfinished
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23659 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-20 10:31:08 +00:00
Ingo Weinhold
4c4b14c3bb The "traced" command can now be passed a filter expression consisting of
boolean operators ("not", "and", "or") and filters matching thread IDs
or contained strings.
I'm still not fully happy with the command. It should be possible to
define a filter and then comfortably scroll through the matching
entries. Currently having to specify an index range of the unfiltered
entries is rather unhandy in combination with filtering.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23658 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-20 00:34:37 +00:00
Ingo Weinhold
f7a5d9c583 Changed TraceEntry::Dump() to take a TraceOutput& and removed
AbstractTraceEntry::AddDump(char*, size_t).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23655 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-19 22:23:32 +00:00
Ingo Weinhold
ab23dfa7f7 Moved tracing macro definitions into separate tracing_config.h header.
So now there's a central place to enable tracing in general and for
individual components.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23645 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-19 17:24:34 +00:00
Axel Dörfler
5f7a62cfdd * Added debugger command "transaction" and added a new "-t" option to
"block_cache" to dump info about transactions.
* Improved tracing.
* Now uses the new add_debugger_command_etc().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23644 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-19 17:01:26 +00:00
Ingo Weinhold
2477bce504 Added support for userland symbol lookup in "sc" and "call". Having
used it for an hour or so, I really wonder how we could live without it.
:-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23640 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-19 16:33:03 +00:00
Ingo Weinhold
1111ffc50b An outermost stack frame (having a NULL previous frame) was
incorrectly recognized as iframe. Fixes the read fault when doing "sc"
for a kernel thread.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23628 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-19 10:56:40 +00:00
Ingo Weinhold
42a5ea091a Oops, "f" is a hex digit, too. Hex numbers with "f" in them work again
in the kernel debugger.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23627 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-19 10:35:55 +00:00
Ingo Weinhold
46cb5cfdd3 When a main thread (i.e. a team) dies, we have to send the SIGCHLD to
its parent while still holding the team spinlock. We were racing with
wait_for_child(), since after the child invoked
team_set_job_control_state(), the parent thread could continue as soon
as the team spinlock was released. The SIGCHLD could thus arrive way
later and interrupt another syscall. This could be reproduced with the
compile_bench.sh script from time to time: When interrupted while
waiting for the next subprocess, the gcc frontend would delete a still
needed temporary file.

The whole thing is actually only a problem, because we don't support
automatic syscall restarts yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23625 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-18 23:39:13 +00:00
Ingo Weinhold
c964a2f228 Use TraceOutput.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23624 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-18 22:18:42 +00:00
Ingo Weinhold
adf78fdae2 TraceBuffer simplifies things a bit.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23623 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-18 22:17:15 +00:00
Ingo Weinhold
f1047a1c3e Introduced helper class TraceOutput that represents an output buffer
and added AbstractTraceEntry::AddDump(TraceOutput&) method.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23622 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-18 22:15:30 +00:00
Ingo Weinhold
2f1836da5c Kernel tracing for signals.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23621 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-18 21:32:38 +00:00
Ingo Weinhold
8d3d1be1ca Kernel tracing of syscalls uses more information about the syscall
parameters, now. We print 64 bit values correctly, and also fetch
strings from userland and print them. 


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23620 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-18 19:33:09 +00:00
Ingo Weinhold
8bd6d45df3 * If passed a userland pointer alloc_tracing_buffer_{memcpy,strcpy}()
checks it now. 
* Check for NULL pointer in alloc_tracing_buffer_strcpy(), and also
  determine the length of userland strings before allocating the buffer
  (using user_strlcpy()).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23619 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-18 19:29:43 +00:00
Ingo Weinhold
aba70a8ca2 Adjusted the fake goto, so that passing a NULL target buffer together
with a 0 size to user_strlcpy() is OK. This way one can use it as a safe
strnlen().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23617 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-18 19:20:54 +00:00
Axel Dörfler
960f8f2430 * Renamed sBufferStart to sFirstEntry, and sBufferEnd to
sAfterLastEntry.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23614 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-18 18:35:45 +00:00
Axel Dörfler
f70280a733 * alloc_tracing_buffer() now refuses to allocate more than 65532 bytes;
we use a uint16 size internally (and that has to include the length of
  the trace_entry structure, too.
* We now track how many entries have been written to the log during the
  runtime.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23613 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-18 18:18:35 +00:00
Jérôme Duval
bbaaf4b7c3 gcc4 requires a cast, so we prepend (void *) to cast every syscall function
fixed syscall.cpp inclusions due to renaming


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23611 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-18 17:39:43 +00:00
Axel Dörfler
5d0afa4e4e * cache_detach_sub_transaction() didn't really work: it did not put all needed
blocks into the new transaction, but it would set that transaction on all
  blocks of the old transaction, too. Also, it did not correctly update the
  num_blocks/sub_num_blocks fields of the old transaction. Even worse, it did
  return B_OK instead of the ID of the new transaction...
* get_writable_cached_block() did not correctly maintain the number of blocks
  in the sub transaction.
* write_cached_block() did not free the original_data of a block when it wrote
  it back as part of a previous transaction.
* Changed "cookie" for cache_next_block_in_transaction() to "long", so it will
  be 64 bits when needed.
* Improved the API for detaching sub transactions: you can now get the blocks
  of only the main (parent) transaction as well, added new
  cache_block_in_main_transaction() function.
* BFS now flushes the log when there is no space left for the current
  transaction.
* _WriteTransactionToLog() allocated a "vecs" array, but never freed it.
* _WriteTransactionToLog() now also supports detaching the current sub
  transaction if the whole thing is getting too large (it will now also panic
  if that doesn't work out).
* Removed a useless optimization: making the blocks available in the cache
  isn't really needed, as all blocks in a transaction are locked into the
  cache, anyway.
* Implemented Transaction::WriteBlocks().
* Minor cleanup, removed some dead code, fixed warnings in the fs_shell's
  block_cache when compiled with debug output on.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23610 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-18 17:07:18 +00:00
Ingo Weinhold
c3b7f3b979 We weren't correctly clearing the THREAD_FLAGS_64_BIT_SYSCALL_RETURN
flag -- in fact we were setting it -- so after the first syscall with 64
bit return value we were always taking the slow kernel exit.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23609 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-18 15:49:21 +00:00
Ingo Weinhold
a7e979cabb Print the correct usage when too many parameters were given.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23608 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-18 15:37:51 +00:00
Ingo Weinhold
74652349dd * sEntries only counts the "normal" (i.e. non-buffer) entries, now.
* "traced" command:
  - Was printing one more entry than asked to.
  - Fixed broken index handling. They were starting at 0, but the last
    one was sEntries nevertheless. We consistently let them start at 1,
    now. 0 can be passed as special index, causing the last entries to
    be printed.
  - Added options "backward"/"forward" which will print the entries
    preceding respectively succeeding the ones printed on the previous
    invocation. The command is continuable in this case, i.e. simply
    pressing RET afterwards will reinvoke the command, allowing for
    comfortable scrolling through a long list of entries.
  - Added detailed usage message.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23607 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-18 15:32:02 +00:00
Ingo Weinhold
548dcc600e * syscalls.c -> syscalls.cpp
* With post syscall debugging enabled, the x86 syscall handling didn't
  remove all parameters from the stack after calling the respective user
  debugger hook. Should have been harmless though, since the following
  code didn't rely on the stack being in order.
* Added syscall pre/post (kernel) tracing functions
  trace_{pre,post}_syscall(). They are generic, but need to be invoked
  by the architecture specific syscall code. Currently only done for
  x86.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23600 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-18 02:13:27 +00:00
Ingo Weinhold
21c92a08d4 * Don't invoke the TraceEntry destructor for simple buffer entries,
since that's seriously unhealthy.
* Added TODO that uninitialized entries must not be discarded.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23599 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-18 02:04:04 +00:00
Ingo Weinhold
21e73322d8 Also trace set_job_control_entry() and wait_for_child().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23597 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-18 00:01:32 +00:00
Ingo Weinhold
bd0689e668 Added usage message to "cvar" and "cvars" debugger commands and define
temporary variables.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23596 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-17 23:22:29 +00:00
Ingo Weinhold
5aee691ed8 The "sem" and "port" debugger commands set some temporary variables,
now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23595 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-17 23:07:59 +00:00