Commit Graph

1458 Commits

Author SHA1 Message Date
Ingo Weinhold
023bf5fcda * Added support for timeouts.
* Added support for non-published condition variables. One has to call
  Init() on those, and add entries directly with the
  ConditionVariable::Add() method.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25110 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-22 21:46:23 +00:00
Ingo Weinhold
60222c8bac * Made thread_block_with_timeout_lock() more user-friendly. It allows
passing 0 as timeout flags or B_INFINITE_TIMEOUT as timeout, in which
  case no timer will be used.
* Implemented missing thread_block_with_timeout().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25104 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-22 19:46:08 +00:00
Ingo Weinhold
c2d96d4500 Added back accidentally removed check for B_THREAD_SUSPENDED when
delivering a kill signal.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25102 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-22 19:01:23 +00:00
Axel Dörfler
43bae01508 * Made waiting for a timer handler more power usage friendly.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25101 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-22 18:46:34 +00:00
Ingo Weinhold
6cef245eca * Detemplatized ConditionVariable{Entry}. Merged them with their
respective Private* base class.
* Changed sigwait() and sigsuspend() to use thread_block() instead of a
  condition variable.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25100 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-22 18:32:15 +00:00
Ingo Weinhold
b95f6d4710 * Introduced a set of functions (thread_prepare_to_block(),
thread_block(), thread_unblock(),...) that allow a thread to wait for
  something without needing a semaphore or condition variable. It can
  simply block and another thread can unblock it. Supports timeouts and
  interrupting. Both semaphores and condition variables use this
  common mechanism, now.
* Semaphores:
  - Some simplifications due to the thread blocking mechanism.
  - Changed locking order to sem -> thread. It was the other way around
    before and when introducing the wait_for_objects() support I had
    also introduced a situation where the locking was reverse, which
    could potentially cause a dead lock on SMP systems.
  - Instead of queueing thread structures, a semaphore queues
    queued_thread entries now, which are created on the stack. The
    thread::sem structure could thus be removed.
  - Added sem_entry::net_count, which is sem_entry::count plus the
    acquisition count of all waiting threads. This number is needed in
    remove_thread_from_sem() and instead of computing it there we
    maintain it.
  - Fixed remove_thread_from_sem(). It would not unblock threads, if
    the sem count was <= 0.
  - Made sem::last_acquirer unconditional. It is actually needed for
    sem_info::latest_holder. Fixed fill_sem_info() accordingly.
  - Added some optional tracing output, though only via ktrace_printf().
* Condition variables:
  - Could be simplified significantly through the use of the thread
    blocking mechanism. Removed a good deal of unnecessary code.
  - Moved the ConditionVariableEntry "flags" parameter from Wait() to
    Add(), and adjusted all places where condition variables are used
    accordingly.
* snooze() uses thread_block_with_timeout() instead of a semaphore.
* Simplified thread interrupting in the signal and user debugger code.
  Instead of separate functions for threads waiting on a semaphore or
  condititon variable, we only have a single thread_interrupt(), now.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25099 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-22 16:22:42 +00:00
Ingo Weinhold
e01cebeb0a * cancel_timer():
- If the hook of the timer we're cancelling is currently being
    executed, we do now wait till it is finished. This is how the BeBook
    specifies the function to behave.
  - Periodic timers would not be cancelled, if their hook was being
    invoked at the same time, since they weren't in the queue during
    that time.
  - Since we know the CPU on which the timer is scheduled (timer::cpu),
    we don't have to look through any other CPU queue to find it.
  - Fixed the return value. It should report whether the timer had
    already fired, and was not always doing that.
* Added private add_timer() flag B_TIMER_ACQUIRE_THREAD_LOCK. It causes
  the thread spinlock to be acquired before the event hook is called.
  cancel_timer() doesn't wait for timers with the flag set. Instead we
  check in the timer interrupt function after acquiring the thread
  spinlock whether the timer was cancelled in the meantime. Calling
  cancel_timer() with the thread spinlock being held does thus avoid any
  race conditions and won't deadlock, if the event hook needs to acquire
  the thread spinlock, too. This feature proves handy for some kernel
  internal needs.
* The scheduler uses a B_TIMER_ACQUIRE_THREAD_LOCK timer now and
  cancel_timer() instead of the no longer needed
  _local_timer_cancel_event().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25098 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-22 15:29:22 +00:00
Ingo Weinhold
93027f442f Added "straced" debugger command which basically works like "traced",
but also prints post syscall entries not matching the filter, if the
respective pre syscall entry matched. This way one also sees the syscall
return values. Works only in forward direction ATM.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25095 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-22 14:57:50 +00:00
Ingo Weinhold
f97199edd3 Made dump_tracing() (the "traced" command function) available in the
kernel and added a WrapperTraceFilter* parameter, which allows for
additional filtering. This way other commands can print tracing output
with special filtering. 


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25094 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-22 14:52:48 +00:00
Ingo Weinhold
8db2e37492 Removed the feature that a thread can wait for more than one condition
variable at once. It wasn't used anymore, and the code gets simpler.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25080 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-20 15:19:48 +00:00
Ingo Weinhold
66aac81e98 We use only a single condition variable (instead of thread different
ones) for wait_for_child(), which is notified when any job control
condition (child dead, stopped, continued) occurs. These events are
relatively rare anyway, and it simplifies the code.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25079 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-20 15:15:58 +00:00
Ingo Weinhold
0c45a1202d Ignore the trailing new line when printing trace entries.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25066 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-20 02:53:28 +00:00
Axel Dörfler
49aadb1dac Fixed the build of vfs_net_boot.cpp - I obviously messed up the full build I
thought I had done.
Of course, that wouldn't have happened if Ingo didn't break the network boot
with his netstack changes ;-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25058 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-19 19:28:34 +00:00
Ingo Weinhold
2e4a383953 Removed obsolete notify_listener().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25055 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-19 17:42:34 +00:00
Ingo Weinhold
2d9a40222f ReceiveFrom() can now return the message_port_info for the received
message, if desired.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25004 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-17 17:58:02 +00:00
Ingo Weinhold
7727e08e5f Added experimental public API get_port_message_info_etc(). It is similar
to port_buffer_size_etc(), but returns the info through a structure,
which also identifies the sender (uid, gid, team ID) of the message.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25003 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-17 17:46:02 +00:00
Ingo Weinhold
e09769a94c Added Dump() method. It prints some general info and a list of the
message fields, no data, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25001 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-17 16:05:37 +00:00
Bruno G. Albuquerque
044f45b2db - Another patch by Hervé W.
- Updated code so Processor IDs for older processor do not have to be 
modified.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24979 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-15 23:51:17 +00:00
Ingo Weinhold
5b53519c63 Some setre{g,u}id() tweaking. What happens to the saved set-{g,u}id is
not specified by the standard, but other systems set it as well in most
cases. We set it to real {g,u}uid now, if that changes. OpenSSH (sshd)
seems to be agreeable with that solution.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24974 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-15 21:18:07 +00:00
Ingo Weinhold
3cf7ecd1e4 * Added <sys/mman.h> header. It declares only mmap() and munmap() yet
and defines the macros needed by them.
* Renamed syscall sys_vm_map_file() to _kern_map_file() and changed the
  path to an FD parameter. Changed vm_map_file() accordingly and
  adjusted the kernel ELF loader and the runtime loader.
* Added syscall _kern_unmap_memory().
* Added bool unmapAddressRange parameter to vm_create_anonymous_area()
  and map_backing_store(). If true and the address specification is
  B_EXACT_ADDRESS, all areas in the specified address range will be
  deleted (unless an area is covered only partially).
* Introduced B_SHARED_AREA flag, which is set on areas that have been
  created by {vm,_user}_map_file() with REGION_NO_PRIVATE_MAP. When
  fork()ing those areas won't be copied CoW, but rather be cloned. This
  is needed for mmap() MAP_SHARED.
* {vm,_user}_map_file() also accept an FD argument < 0, in which case an
  anonymous area is created.
* Implemented mmap() and munmap(). Currently there's the restriction
  that we can't partially unmap areas. Otherwise the functions should be
  rather compliant. We also support the non-POSIX extension
  MAP_ANONYMOUS.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24964 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-13 22:52:11 +00:00
Bruno G. Albuquerque
9c383d9867 Applied patch by Hervé W.
- Updated Intel processor IDs.
- Only take extended family/model into account on Intel processors.




git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24958 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-13 07:27:12 +00:00
Ingo Weinhold
f13ba03959 * Removed SyscallRestartWrapper comparison operators. They are not
needed, since we've got a cast operator.
* Reverted r24927-r24929. There's no potential ambiguity anymore.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24949 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-12 17:18:31 +00:00
Ingo Weinhold
460c990c5d The syscalls that were returning an address always copied back the full
address back to userland, even if the provided buffer was smaller. Fixes
a problem with Firefox, which is for some reason providing a buffer
smaller than our sockaddr_in.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24948 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-12 16:59:49 +00:00
Jérôme Duval
c103aef2b3 disabled check for memory overlaps for the time being
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24946 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-12 13:36:33 +00:00
Ingo Weinhold
5f2d64a25e * _user_{send,recf}msg() no longer copy iovecs on the stack. They use
the heap and the IOV_MAX limit.
* They also take the responsibility of copying the ancillary data in and
  out.
* These syscalls were badly broken. They used a member of an
  uninitialized structure instead of the iovec pointer passed from
  userland. sendmsg() would thus fail or send arbitrary data, recvmsg()
  would overwrite arbitrary memory.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24939 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-12 08:50:17 +00:00
Ingo Weinhold
0cc82d47d4 Added close_fd_index() which is pretty much like close(), but gets the
IO context in which to close the FD.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24937 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-12 08:32:29 +00:00
Jérôme Duval
6cb51e58bc better cast to the good type to avoid confusing gcc
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24929 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-12 07:17:01 +00:00
Jérôme Duval
b1459ca4b4 hmm I managed to break the comparaison order...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24928 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-12 07:08:56 +00:00
Jérôme Duval
bdfe92370f gcc4 build fix. Here is one of the two errors:
src/system/kernel/fs/fd.cpp: In function 'ssize_t common_user_vector_io(int, off_t, const iovec*, size_t, bool)':
src/system/kernel/fs/fd.cpp:727: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the 
second:
headers/private/kernel/syscall_restart.h:151: note: candidate 1: bool SyscallRestartWrapper<Type>::operator<(const Type&) const [with Type = long int]
src/system/kernel/fs/fd.cpp:727: note: candidate 2: operator<(long int, int) <built-in>


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24927 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-12 07:04:45 +00:00
Ingo Weinhold
3118b3a7cb * Added fd_ops::set_flags() hook. It's only implemented by socket FDs
ATM.
* Changed common_fcntl() to also work for non-vnode-based FDs. Only the
  operations that require a vnode do fail now. F_SETFL uses the new
  fd_ops::set_flags() if available, falling back to the vnode respective
  operation.
* Changed some direct accesses to file_descriptor::u::vnode. It was safe
  in those cases, but might not be anymore if we ever change fd_vnode().

ftp can at least connect to servers again, now, but apparently we still
have a problem with syscall restarts -- downloads fail after one second,
when the timer goes off.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24917 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-11 19:21:14 +00:00
Axel Dörfler
ac0e5c1ce5 The fs_sync() function (or any other, for that matter) must not hold the
sMountMutex lock when calling sync() on a file system. This fixes a potential
deadlock (I just encountered for the first time).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24915 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-11 17:01:25 +00:00
Ingo Weinhold
75015ff525 * Renamed THREAD_FLAGS_IOCTL_SYSCALL to THREAD_FLAGS_SYSCALL,
syscall_restart_ioctl_is_restarted() to syscall_restart_is_restarted,
  IoctlSyscallFlagUnsetter to SyscallFlagUnsetter, and
  IoctlSyscallRestartWrapper to SyscallRestartWrapper, as they are no
  longer only used for ioctl().
* Removed unused syscall_restart_ioctl_handle_post().
* Made SyscallRestartWrapper a lot fancier. Instead of storing a
  reference to the result value, it stores the value itself, and it
  features all the interesting operators that make it appear like that
  value. This simplifies the use of the class quite a bit.
* THREAD_FLAGS_SYSCALL is now set for all socket function and the
  read[v](), write[v]() syscalls.
* Added is_syscall() function and net_stack hook to the net stack.
* Removed "kernel" parameter from all net_stack_interface and net_socket
  module hooks. They aren't need any longer, since is_syscall() can be
  used instead.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24914 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-11 16:13:47 +00:00
Axel Dörfler
9493edbe9f Applied patch by Christian Fasshauer:
* get_dir_path_and_leaf() now removes trailing slashes from the path.
* This fixes bug #2016, thanks!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24913 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-11 14:37:48 +00:00
Ingo Weinhold
df50f7a9b4 * Changed the way the socket functions work:
- The net_stack driver is no longer used. Instead we have a kernel
    module which is directly used by syscall implementations in the
    kernel. I.e. we no longer tunnel those functions through ioctls, but
    have normal syscalls.
  - Removed the superfluous net starter module.
  - Implemented the FDTYPE_SOCKET type file_descriptors, that is sockets
    are no longer vnode based.
  - Adjusted libnetwork (the socket function implementations)
    accordingly.
  - Adjusted netstat accordingly.
* Socket module:
  - Implemented socketpair().
  - Added "kernel" parameter to the control hook. Quite a few more hooks
    would actually need the parameter, but I didn't change those yet,
    since that would probably also require changes to the protocol
    module interface.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24908 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-11 04:12:23 +00:00
Ingo Weinhold
446d50a652 Removed unused _kern_socket() dummy.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24907 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-11 03:37:18 +00:00
Ingo Weinhold
0fc6c43728 Resolved TODO: We can check for sockets, now.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24906 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-11 03:35:15 +00:00
Ingo Weinhold
08b2313e70 * Fixed some checks for user addresses. IS_KERNEL_ADDRESS is not the
same as !IS_USER_ADDRESS.
* Use the new IoctlSyscallFlagUnsetter helper class in _kern_ioctl().
  The former implementation wasn't checking correctly for a previous
  syscall flag.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24904 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-11 03:32:45 +00:00
François Revol
ef16b3bb76 Use the thread's stack size for RLIMIT_STACK, this should work even if we ever implement changing a thread's stack.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24898 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-10 21:56:22 +00:00
François Revol
c4a7b4e09e Report the stack size from getrlimit(), we might want to get fancier later but that should be enough. Tcl will want that.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24893 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-10 19:27:26 +00:00
Axel Dörfler
c28d31cce6 Removed unused variables.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24889 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-10 12:48:42 +00:00
Ingo Weinhold
f8b4d83f2f New service function vfs_create_special_node() to create special nodes.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24883 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-10 03:07:07 +00:00
Axel Dörfler
8b79f1fd68 * Added open_module_list_etc() that also allows to specify a required name
suffix. You can use this to verify the version of a module_info structure.
* Made module_info::std_ops optional.
* Minor cleanup in module.h.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24873 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-09 14:36:04 +00:00
Axel Dörfler
037f70947f * Cleaned up KernelExport.h completely, removed deprecated and non implemented
API, uses the _PRINTFLIKE macro where appropriate.
* Got rid of the "qent" structure, struct timer now contains everything we
  need. This makes the affected code in sem.cpp, signal.cpp, and timer.c much
  cleaner, and resolves a few TODOs.
* Minor cleanup in vfs.cpp.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24871 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-09 14:21:06 +00:00
Axel Dörfler
36de598e0f * block_cache_sync[_etc]() now also waits for all notifications to be handled.
This fixes a potential problem where a volume would be left marked dirty on
  a clean reboot as reported by Vasilis; no harm would have been done to the
  data on the volume, though (it would just replay a log entry that it didn't
  need to).
* Unified the naming of the notifier/writer thread: renamed the thread to "block
  notifier/writer", and the variable holding the thread ID to
  sNotifierWriterThread.
* Added a few more doxygen descriptions to the private functions.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24870 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-09 11:04:26 +00:00
Axel Dörfler
391fdf1e99 * notify_transaction_listeners() would always remove all listeners when it
was asked to. Unfortunately, it also removed the TRANSACTION_WRITTEN
  listeners (that were added before notifying other listeners), so that BFS
  could never free up space in the log. Now, it will only remove the listeners
  it may remove. This fixes bug #2024.
* Rearranged functions a bit, moved notification/listener related private
  functions together.
* Added tracing entry for written transactions as well.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24853 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-07 10:39:01 +00:00
Ingo Weinhold
25eb8cd717 * Renamed pipefs.cpp to fifo.cpp.
* Removed the pipefs functionality. We only need to support FIFO nodes.
* Renamed the remaining pipefs_*() functions to fifo_*().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24834 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-06 15:50:28 +00:00
Ingo Weinhold
a1db78790d Removed pipefs from the built-in modules.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24833 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-06 15:45:07 +00:00
Michael Lotz
3568352d8d When a partition was unpublished from devfs the devfs_delete_vnode() would
also free the device info which it must not do, as this info is in fact just
a pointer to the device info of the raw node. Removing a raw device that had
partitions published therefore always lead into KDL when closing the raw
device after unpublising the partition, as the close_hook pointer which sits
in the device info now was 0xdeadbeef. This should make for example unplugging
USB devices work as expected.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24827 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-06 12:07:45 +00:00
Michael Lotz
fc38019945 Rename vfs_stat_entry_ref() to vfs_stat_node_ref() as that's what a dev_t and
ino_t combination really is.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24825 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-06 09:18:27 +00:00
Ingo Weinhold
6e36a49e62 * Added _kern_create_pipe() syscall, creating a pipe as an entryless
FIFO. Reimplemented pipe() to use it.
* pipefs is no longer mounted. Will remove the superfluous code soon.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24823 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-06 02:49:12 +00:00
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