Commit Graph

4162 Commits

Author SHA1 Message Date
Ingo Weinhold
0c615a01ae * Removed old mutex implementation and renamed cutex to mutex.
* Trivial adjustments of code using mutexes. Mostly removing the
  mutex_init() return value check.
* Added mutex_lock_threads_locked(), which is called with the threads
  spinlock being held. The spinlock is released while waiting, of
  course. This function is useful in cases where the existence of the
  mutex object is ensured by holding the threads spinlock.
* Changed the two instances in the VFS code where an IO context of
  another team needs to be locked to use mutex_lock_threads_locked().
  Before it required a semaphore-based mutex implementation.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25283 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-01 22:07:36 +00:00
Ingo Weinhold
ee96aa8f6e * Replaced cutex::release_count by flags field. It is only one thread
that can unlock the mutex, so one bit is sufficient.
* Added cutex_init_etc() which has an additional "flags" parameter.
  The only specifyable flag is CUTEX_FLAG_CLONE_NAME, which causes the
  function to strdup() the given name and free() its copy in
  cutex_destroy().
* cutex_destroy() does now unblock waiting threads.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25280 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-01 18:06:09 +00:00
Ingo Weinhold
184de764fe Replaced the vm_cache mutex by a cutex. This should save quite a few
semaphores.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25277 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-01 01:59:09 +00:00
Ingo Weinhold
8562499f44 * Introduced a new locking primitive I called "cutex" (sorry for the
name, couldn't resist :-P). It's semantically equivalent to a mutex,
  but doesn't need a semaphore (it uses thread blocking and a simple
  queue instead). Initialization can't fail. In fact it is ready to use
  without initialization when living in the bss segment, also in the
  early boot process. It's as fast as a benaphore in cases of low lock
  contention, and faster otherwise.  Only disadvantage is the higher
  immediate memory footprint of 16 bytes.
* Changed how the "thread" and "threads" debugger commands list the
  objects they are waiting for. Cutexes are also included.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25276 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-01 01:53:07 +00:00
Ingo Weinhold
514fb1360b * Removed select_sync::lock. The only thread that was still locking was
the selecting thread, which has obviously no effect.
* Changed select_info::events to vint32. It is now updated atomically.
  This removes a race condition when concurrent threads would notify at
  the same time.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25273 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-30 16:12:20 +00:00
Ingo Weinhold
2428097297 Removed superfluous uint32 ref parameter from select() FS hook.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25268 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-30 00:06:17 +00:00
Axel Dörfler
801591dbde * Added an atomic_pointer_set() template function to util/atomic.h.
* Made the pointers const.
* Changed how the ARP module maintains its arp_entry::request_buffer: it
  now uses the atomic_pointer*() functions to make sure there is no race
  condition, and it's deleted only once.
* Getting an ARP entry would return uninitialized data, if the entry hadn't
  been resolved yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25263 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 22:03:03 +00:00
Axel Dörfler
b1d749f8f1 * Added an atomic.h header that provides a C++ file with a templatized
64-bit safe version of atomic_test_and_set() for pointers:
  atomic_pointer_test_and_set().
* The VFS is now using this function (it's not used anywhere else in the
  kernel this way).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25260 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 21:05:05 +00:00
Axel Dörfler
c0b5962cd6 * Removed unused function benaphore_lock_etc(). A timeout is not really a
good idea for a benaphore.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25257 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 20:20:36 +00:00
Ingo Weinhold
0e8836d284 Fixed build for paranoia disabled globally, but enabled for individual
components.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25253 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 18:42:31 +00:00
Stephan Aßmus
f466d35d9c Rewrote parts related to drawing the labels. The order of drawing happens as
this (seems to be what R5 BStatusBar does):
* combine the "trailing text" with the "trailing label" and truncate the
  resulting string on the left side according to the width of the entire
  control
* combine the "label" with the "text" and truncate that on the right side
  according to the space left by the right hand text.

-> No more overlaps (theoretically, in practise there are still overlaps
  because our BFont::TruncateString() does not respect the width in some
  situations.)

* Changed _SetTextData() accordingly, it is not used anymore for the
  label and trailing label, and could therefor be simplified a little.
* fixed _BarFrame() to not return fractional coords, which could sometimes
  leave a dirty line of pixels.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25244 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-29 12:42:10 +00:00
Ingo Weinhold
97c0a2b3f1 * Paranoia checks were accidentally globally enabled by default. Object
* cache paranoia was always enabled.
* Changed from paranoia on/off to levels. Adjusted the macros to take a
  level argument.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25215 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-27 15:13:31 +00:00
Ingo Weinhold
2b8ae28a15 * Added kernel tracing. Even with optional stack traces.
* Added "mode" parameter to set_paranoia_check(), which specifies
  whether the check is supposed to already exist/not exist yet. This
  allows for, as it turns out, very useful additional tests. Added
  {ADD,UPDATE}_PARANOIA_CHECK macros that imply the used "mode"
  parameter.
* PARANOIA_SLOT_COUNT was accidentally redefined in the source file.
* Fixed remove_paranoia_check(). It didn't remove anything.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25207 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-27 03:14:36 +00:00
Ingo Weinhold
65f4015279 Support for stack traces in tracing entries:
* Added capture_tracing_stack_trace() which allocates space in the
  tracing buffer and captures the stack trace according to the given
  parameters.
* Added TraceOutput::PrintStackTrace() to print a stack trace thus
  created.
* Added TraceEntry::DumpStackTrace() callback which is supposed to print
  a stack trace for the entry, if it can do that.
* Added "--stacktrace" switch to the "traced" command, which causes the
  stack traces for all entries that have one to be printed as well.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25205 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-27 03:02:01 +00:00
Ingo Weinhold
4dd0a2c7b6 Added arch_debug_get_stack_trace() that can be used to get a stack trace
(the list of return addresses) for the current stack.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25204 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-27 02:54:27 +00:00
François Revol
d4a5975f50 - some fields needed to build usb_serial
- use the dano version by default
- s/ddraquire/ddaquire/


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25203 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-26 23:52:58 +00:00
François Revol
3196359ad2 - some more defines
- the dano version is exposed as v1.1 so drivers can use select with a simple ifdef
- add copyrights from the tty driver as I'll be copying code from it.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25201 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-26 21:56:46 +00:00
François Revol
42889352f8 A stubbed tty bus manager.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25198 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-26 21:20:13 +00:00
Ingo Weinhold
dfa611bb04 Added paranoia checks debug facility. It helps checking that data in
memory haven't changed behind one's back.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25193 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-26 20:25:02 +00:00
Jérôme Duval
e8bc20e263 updated mesa to 7.0.3
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25189 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-26 16:33:15 +00:00
François Revol
807cf76df0 memory barrier functions available for drivers.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25183 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-26 15:18:04 +00:00
Jérôme Duval
67ed230831 fix warning
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25182 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-26 15:12:55 +00:00
Jérôme Duval
66cb27d82e patch from JiSheng which fixes firewire build warnings and fix atomic_set_int to use atomic_or
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25181 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-26 15:02:43 +00:00
Stephan Aßmus
03baa14fe9 Style improvements.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25171 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-26 09:53:49 +00:00
Ingo Weinhold
123e47de1b Was using __{BEGIN,END}_DECLS without including <sys/cdefs.h>.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25163 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-25 20:29:47 +00:00
Ingo Weinhold
0e42d1bcd8 Our sockaddr_storage is only 128 bytes long. Hence invocations of bind()
or connect() that passed sizeof(sockaddr_un) would always fail. 


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25138 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-24 22:30:54 +00:00
Ingo Weinhold
cc6e7cb347 Added the BSDish openpty().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25135 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-24 21:30:38 +00:00
Ingo Weinhold
fb913b19be Added POSIX functions posix_openpt(), grantpt(), ptsname(), and
unlockpt(), which provide a portable way of opening a pty.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25134 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-24 21:29:13 +00:00
Ingo Weinhold
06b7c7ffe2 * Set reasonable terminal flag defaults. This makes telnetd fully usable
again.
* Publish /dev/ptmx. Opening it will open a fresh pty master. In
  principle /dev/pt/ is obsolete now, but I guess we keep it around for
  compatibility with BeOS. Though there shouldn't be many applications
  opening a pty, that we might be interested in...
* New ioctls B_IOCTL_GET_TTY_INDEX (returns the tty index) and
  B_IOCTL_GRANT_TTY (grants tty slave access rights).



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25133 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-24 21:26:35 +00:00
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
f842b6fa57 * Added THREAD_BLOCK_TYPE_OTHER.
* Made the object pointer passed to thread_prepare_to_block() const, so
  that strings can be passed without casting. Passing a string could
  maybe be made a convention for THREAD_BLOCK_TYPE_OTHER.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25109 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-22 21:43:54 +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
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
Axel Dörfler
945fb7e32a * Replaced destructor with destructorFunc to please python - it's not a reserved
keyword, so this stupid python should really be fixed instead.
* Enforced the 80 column limit.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25090 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-20 21:20:07 +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
e378ab1c09 Added MethodDeleter class, which calls a specified method on the object
when destroyed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25067 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-20 02:54:38 +00:00
François Revol
0ab2d7407c Fixed ksocket header as we don't use a socket module anymore.
Fixes building nbd, will help with nfs and googlefs.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25061 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-19 23:58:26 +00:00
Oliver Ruiz Dorantes
39399f65f0 - Implement RemoteDevice::GetFriendlyName() in kit and handle the required reply in the server.
- Now a discovery process is nicer.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25053 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-19 16:53:06 +00:00
Axel Dörfler
45e95a057f * Removed the old net_stack driver code, and the kernel socket interface.
* Also removed the header files that belong to those files.
* Only kept the userland_ipc.h header for now, to remember us about the
  former userland server driver (that I also removed - it can always be
  resurrected from SVN if needed).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25045 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-19 12:42:25 +00:00
Stephan Aßmus
1dde19ddbc Fix the GCC version check for the virtual destructor. Thanks to Micheal for
showing how to do it.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25043 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-19 07:01:48 +00:00
Ingo Weinhold
f694f63e2b * Moved private passwd/group/shadow passwd limit constants from
<libroot_private.h> to <user_group.h>.
* Added support in the registrar for adding and modifying users.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25040 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-19 00:10:51 +00:00
Oliver Ruiz Dorantes
fae5a1d349 - Add inquiry fields for the RemoteDevice, to store the information retrieved .
- Update those fields at discovering




git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25006 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-17 19:17:10 +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
a94ce1c912 * Reorganized the passwd and group support: A dedicated thread in the
registrar provides access to the DBs via a port message based
  protocol. The functions in libroot just ask the registrar now.
* Added Linuxish shadow passwd support. No putspent() though -- we'll
  provide private functions.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25002 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-17 16:19:18 +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
Oliver Ruiz Dorantes
01e363a708 - Reflect the APi change in the RemoteDevice
- Implement function to compare Bluetooth Addresses


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24992 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-16 22:17:55 +00:00
Stephan Aßmus
261a29594b Applied patch by Artur Wyszynski:
* Added virtual destructor to BRefFilter in case the GCC version is 3 or newer
  (can't do it for GCC 2.95.3, since that would break binary compatibility
  AFAIKT)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24986 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-16 20:11:54 +00:00
Stephan Aßmus
52e06f988d Applied patch by Artur Wyszynski:
* Renamed BView::Alignment() to LayoutAlignment() which fixes a ton of warnings
  and some conflicts with BControls.
* Added virtual destructor to BRefFilter in case the GCC version is 3 or newer
  (can't do it for GCC 2.95.3, since that would break binary compatibility 
  AFAIKT)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24983 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-16 17:11:40 +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
Oliver Ruiz Dorantes
be79ee53e1 - Add Implicit namespaces
- Fix constructors & and friend classes



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24976 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-15 22:26:32 +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
Ingo Weinhold
34cbfd39d3 Added CObjectDeleter class, which invokes a given destructor function.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24963 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-13 22:33:44 +00:00
Jérôme Duval
801fe71d43 added amd geode lx cpu type, untested
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24960 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-13 17:20:46 +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
Axel Dörfler
4b3b81da9e This header is no longer necessary, since Ingo added the BSD timer macros
to our sys/time.h - this fixes a lot of warnings, too.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24952 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-13 02:28:43 +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
97cdbb548e Added support for sending/receiving ancillary data. The protocol modules
have two more optional hooks for attaching supplied ancillary data to a
net_buffer and for processing received ancillary data. Not sure, if that
is flexible enough for all kinds of ancillary data, but it is for
SCM_RIGHTS and also should for SCM_CRED[ENTIAL]S (if we ever decide to
implement one of those) -- don't know any other types on other protocol
levels.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24941 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-12 09:28:05 +00:00
Ingo Weinhold
62d7da1f45 Added support for attaching ancillary data to a net_buffer. It's a naive
implementation ATM, since it malloc()s the required memory.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24940 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-12 09:19:44 +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
Ingo Weinhold
ac4630e161 * Added <sys/param.h> include, which is needed for _ALIGN().
* Added SCM_RIGHTS macro.
* Added a few non-standard but widely-used CMSG_*() macros.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24936 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-12 08:30:25 +00:00
Ingo Weinhold
43d5590ce1 Yep, first clear THREAD_FLAGS_SYSCALL, then check whether it is set.
That would explain why syscall restarts were broken. In fact there's no
reason to check the flag at all, since we know we set it.

ftp appears to work again.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24918 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-11 20:36:50 +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
Stephan Aßmus
f156c25d14 Applied patch by JiSheng Zhang:
Synchronized firewire bus manager with FreeBSD current.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24916 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-11 17:35:11 +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
Stefano Ceccherini
838c73ba76 Removed unused BWindow friend classes, renamed some BView member
variables to fit our guidelines.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24912 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-11 09:26:11 +00:00
Stefano Ceccherini
18af47f5c4 Renamed some private methods to have the underline prefix, now that
BWindow doesn't call them directly anymore.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24911 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-11 08:53:25 +00:00
Stefano Ceccherini
150ddd17b1 added missing header
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24910 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-11 08:29:54 +00:00
Stefano Ceccherini
10f4d0679a Added a class MenuPrivate to handle access to private BMenu methods.
BMenuItem and BWindow are no longer friends of BMenu, but use this class 
instead.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24909 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-11 08:22:09 +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
3cc3dcb385 Preparation for socket file descriptors.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24905 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-11 03:33:59 +00:00
Ingo Weinhold
89df64c56e Added two helper classes for dealing with restarts of ioctl() like
syscalls.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24903 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-11 03:29:42 +00:00
Ingo Weinhold
bab4c3bbff Changed the type of msghdr::{msg_name,msg_control} to void* as dictated
by POSIX.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24902 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-11 03:27:53 +00:00
Ingo Weinhold
681fe624a3 Define HAVE_STDINT_H unconditionally. We have it, and some header
modification seemed to have caused the macro not to get defined anymore.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24901 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-11 03:25:56 +00:00
Ingo Weinhold
7e8cb518e9 Finally decided to put the often copied RETURN_AND_SET_ERRNO() macro
into a header. This version instantiates the given argument only once.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24900 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-11 03:23:51 +00:00
François Revol
716bba3eae start of a header for a beos compatible tty module.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24899 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-10 23:29:45 +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
Ingo Weinhold
ef7cb2253b Rather use a char[] for the path. uint8_t[] is rather uncomfortable to
use with the string and *printf() functions.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24882 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-10 03:06:11 +00:00
Ingo Weinhold
64cd033664 Added socket macros.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24881 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-10 03:04:03 +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
4f61b1059c Added some macros and an error message if another compiler than GCC is used.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24872 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-09 14:21:45 +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
cfc3fa87da * Cleaned up InterfaceDefs.h, added TODO about getting rid of declaring
_init_interface_kit_() in there.
* Moved private get_mode_parameter() into the BPrivate namespace.
* Renamed interface_misc.h to InterfacePrivate.h.
* Minor other cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24869 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-09 10:07:35 +00:00
Axel Dörfler
3d7e508f7b Added sys/poll.h header by popular request (see ticket #2037).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24864 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-08 09:17:07 +00:00
Michael Lotz
d419b482ad Integrate the USBKit into libdevice and make it public. I left the USBKit.h
name, as it in fact is like a kit in the kit. It combines the different BUSB*
classes as compared to SerialPort.h where there really is a 1:1 relationship
between the header and the (one) class. If someone has a better fitting name
please shout.
Separated the usb_raw.h into usb_raw.h which defines the protocol and
usb_raw_private.h which holds the internal device structure for usb_raw. This
reduces the header dependencies.
Hopefully cought all occurencies of USBKit.a usage (in usb_dev_info and
the usb_webcam media add-on) but might have missed something that is not in
the image.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24858 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-07 19:24:16 +00:00
Axel Dörfler
b9fe86d2d7 * Added pthread_setconcurrency(), and pthread_getconcurrency() functions.
* Since we use a 1:1 mapping, they don't do anything besides remembering the
  level set, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24855 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-07 10:57:01 +00:00
François Revol
038ed3d1f2 Add _SC_PAGE_SIZE sysconf().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24850 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-07 01:08:18 +00:00
Stephan Aßmus
636bff2fd2 Patch by Philippe Saint-Pierre:
* Revised the RLE algorithm used for compressing the boot splash artwork to
  handle uncompressed runs.
* Compress the RGB channels separately for improved efficiency.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24844 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-06 20:10:50 +00:00
Michael Lotz
5aa70ae110 * Add a AlternateAt() method to the BUSBInterface class that can retrieve the
usb_interface_descriptor of an alternate interface without having to switch
  to it.
* Add some reserve bytes to all classes and add some reserved virtual slots
  where the objects are publically constructable.
* Remove the source compatibilty defines that were briding the old USB* with
  the new BUSB* class names.
* Implement the usb_raw side of getting an alternate interface descriptor.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24842 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-06 19:59:24 +00:00
Michael Lotz
a43222b925 * Implemented setting an alternate interface through the USBKit library based
on a patch by Salvatore Benedetto, adapted to the usb_raw interface by me
* Added two convenience functions IsStalled() and ClearStall() to USBEndpoint

Both changes are actually untested, so if you have a use for them and encounter
problems please shout.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24837 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-06 16:22:59 +00:00
Stephan Aßmus
6a1d169c52 * Removed trailing spaces in ScrollBar.h
* It's not a good idea to archive fProportion as int32, seeing it's a float
  on [0..1].
* Implemented archive constructor for BScrollBar. Untested.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24832 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-06 15:11:31 +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
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
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
Michael Pfeiffer
e664c41006 Restored the copyright notice before r24684, as pointed out by Marcus Overhagen on the Haiku-commits mailing list, r24684 is a copyright violation.
Also reverted some meaningful comments.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24807 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-05 11:55:14 +00:00